Restores a SQL database.
Syntax FromPointInTimeBackupRestore-AzSqlDatabase
[-ResourceGroupName] <String>
-PointInTime <DateTime>
-ResourceId <String>
-ServerName <String>
-TargetDatabaseName <String>
[-FromPointInTimeBackup]
[-Edition <String>]
[-ServiceObjectiveName <String>]
[-ElasticPoolName <String>]
[-AsJob]
[-LicenseType <String>]
[-HAReplicaCount <Int32>]
[-BackupStorageRedundancy <String>]
[-ZoneRedundant]
[-Tag <Hashtable>]
[-AssignIdentity]
[-EncryptionProtector <String>]
[-UserAssignedIdentityId <String[]>]
[-KeyList <String[]>]
[-FederatedClientId <Guid>]
[-EncryptionProtectorAutoRotation]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
FromPointInTimeBackupWithVcore
Restore-AzSqlDatabase
[-ResourceGroupName] <String>
-PointInTime <DateTime>
-ResourceId <String>
-ServerName <String>
-TargetDatabaseName <String>
-Edition <String>
-ComputeGeneration <String>
-VCore <Int32>
[-FromPointInTimeBackup]
[-AsJob]
[-LicenseType <String>]
[-HAReplicaCount <Int32>]
[-BackupStorageRedundancy <String>]
[-ZoneRedundant]
[-Tag <Hashtable>]
[-AssignIdentity]
[-EncryptionProtector <String>]
[-UserAssignedIdentityId <String[]>]
[-KeyList <String[]>]
[-FederatedClientId <Guid>]
[-EncryptionProtectorAutoRotation]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
FromDeletedDatabaseBackup
Restore-AzSqlDatabase
[-ResourceGroupName] <String>
-DeletionDate <DateTime>
-ResourceId <String>
-ServerName <String>
-TargetDatabaseName <String>
[-FromDeletedDatabaseBackup]
[-PointInTime <DateTime>]
[-Edition <String>]
[-ServiceObjectiveName <String>]
[-ElasticPoolName <String>]
[-AsJob]
[-LicenseType <String>]
[-HAReplicaCount <Int32>]
[-BackupStorageRedundancy <String>]
[-ZoneRedundant]
[-Tag <Hashtable>]
[-AssignIdentity]
[-EncryptionProtector <String>]
[-UserAssignedIdentityId <String[]>]
[-KeyList <String[]>]
[-FederatedClientId <Guid>]
[-EncryptionProtectorAutoRotation]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
FromDeletedDatabaseBackupWithVcore
Restore-AzSqlDatabase
[-ResourceGroupName] <String>
-DeletionDate <DateTime>
-ResourceId <String>
-ServerName <String>
-TargetDatabaseName <String>
-Edition <String>
-ComputeGeneration <String>
-VCore <Int32>
[-FromDeletedDatabaseBackup]
[-PointInTime <DateTime>]
[-AsJob]
[-LicenseType <String>]
[-HAReplicaCount <Int32>]
[-BackupStorageRedundancy <String>]
[-ZoneRedundant]
[-Tag <Hashtable>]
[-AssignIdentity]
[-EncryptionProtector <String>]
[-UserAssignedIdentityId <String[]>]
[-KeyList <String[]>]
[-FederatedClientId <Guid>]
[-EncryptionProtectorAutoRotation]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
FromGeoBackup
Restore-AzSqlDatabase
[-ResourceGroupName] <String>
-ResourceId <String>
-ServerName <String>
-TargetDatabaseName <String>
[-FromGeoBackup]
[-Edition <String>]
[-ServiceObjectiveName <String>]
[-ElasticPoolName <String>]
[-AsJob]
[-LicenseType <String>]
[-HAReplicaCount <Int32>]
[-BackupStorageRedundancy <String>]
[-ZoneRedundant]
[-Tag <Hashtable>]
[-AssignIdentity]
[-EncryptionProtector <String>]
[-UserAssignedIdentityId <String[]>]
[-KeyList <String[]>]
[-FederatedClientId <Guid>]
[-EncryptionProtectorAutoRotation]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
FromGeoBackupWithVcore
Restore-AzSqlDatabase
[-ResourceGroupName] <String>
-ResourceId <String>
-ServerName <String>
-TargetDatabaseName <String>
-Edition <String>
-ComputeGeneration <String>
-VCore <Int32>
[-FromGeoBackup]
[-AsJob]
[-LicenseType <String>]
[-HAReplicaCount <Int32>]
[-BackupStorageRedundancy <String>]
[-ZoneRedundant]
[-Tag <Hashtable>]
[-AssignIdentity]
[-EncryptionProtector <String>]
[-UserAssignedIdentityId <String[]>]
[-KeyList <String[]>]
[-FederatedClientId <Guid>]
[-EncryptionProtectorAutoRotation]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
FromLongTermRetentionBackup
Restore-AzSqlDatabase
[-ResourceGroupName] <String>
-ResourceId <String>
-ServerName <String>
-TargetDatabaseName <String>
[-FromLongTermRetentionBackup]
[-Edition <String>]
[-ServiceObjectiveName <String>]
[-ElasticPoolName <String>]
[-AsJob]
[-LicenseType <String>]
[-HAReplicaCount <Int32>]
[-BackupStorageRedundancy <String>]
[-ZoneRedundant]
[-Tag <Hashtable>]
[-AssignIdentity]
[-EncryptionProtector <String>]
[-UserAssignedIdentityId <String[]>]
[-KeyList <String[]>]
[-FederatedClientId <Guid>]
[-EncryptionProtectorAutoRotation]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
FromLongTermRetentionBackupWithVcore
Restore-AzSqlDatabase
[-ResourceGroupName] <String>
-ResourceId <String>
-ServerName <String>
-TargetDatabaseName <String>
-Edition <String>
-ComputeGeneration <String>
-VCore <Int32>
[-FromLongTermRetentionBackup]
[-AsJob]
[-LicenseType <String>]
[-HAReplicaCount <Int32>]
[-BackupStorageRedundancy <String>]
[-ZoneRedundant]
[-Tag <Hashtable>]
[-AssignIdentity]
[-EncryptionProtector <String>]
[-UserAssignedIdentityId <String[]>]
[-KeyList <String[]>]
[-FederatedClientId <Guid>]
[-EncryptionProtectorAutoRotation]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Restore-AzSqlDatabase cmdlet restores a SQL database from a geo-redundant backup, a backup of a deleted database, a long term retention backup, or a point in time in a live database. The restored database is created as a new database. You can create an elastic SQL database by setting the ElasticPoolName parameter to an existing elastic pool. You can also perform a cross subscription restore for a datawarehouse database.
Examples Example 1: Restore a database from a point in time$Database = Get-AzSqlDatabase -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database01"
Restore-AzSqlDatabase -FromPointInTimeBackup -PointInTime UTCDateTime -ResourceGroupName $Database.ResourceGroupName -ServerName $Database.ServerName -TargetDatabaseName "RestoredDatabase" -ResourceId $Database.ResourceID -Edition "Standard" -ServiceObjectiveName "S2"
The first command gets the SQL database named Database01, and then stores it in the $Database variable. The second command restores the database in $Database from the specified point-in-time backup to the database named RestoredDatabase.
Example 2: Restore a database from a point in time to an elastic pool$Database = Get-AzSqlDatabase -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database01"
Restore-AzSqlDatabase -FromPointInTimeBackup -PointInTime UTCDateTime -ResourceGroupName $Database.ResourceGroupName -ServerName $Database.ServerName -TargetDatabaseName "RestoredDatabase" -ResourceId $Database.ResourceID -ElasticPoolName "ElasticPool01"
The first command gets the SQL database named Database01, and then stores it in the $Database variable. The second command restores the database in $Database from the specified point-in-time backup to the SQL database named RestoredDatabase in the elastic pool named elasticpool01.
Example 3: Restore a deleted database$DeletedDatabase = Get-AzSqlDeletedDatabaseBackup -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database01"
Restore-AzSqlDatabase -FromDeletedDatabaseBackup -DeletionDate $DeletedDatabase.DeletionDate -ResourceGroupName $DeletedDatabase.ResourceGroupName -ServerName $DeletedDatabase.ServerName -TargetDatabaseName "RestoredDatabase" -ResourceId $DeletedDatabase.ResourceID -Edition "Standard" -ServiceObjectiveName "S2" -PointInTime UTCDateTime
The first command gets the deleted database backup that you want to restore by using Get-AzSqlDeletedDatabaseBackup. The second command starts the restore from the deleted database backup by using the Restore-AzSqlDatabase cmdlet. If the -PointInTime parameter is not specified, the database will be restored to the deletion time.
Example 4: Restore a deleted database into an elastic pool$DeletedDatabase = Get-AzSqlDeletedDatabaseBackup -ResourceGroupName $resourceGroupName -ServerName $sqlServerName -DatabaseName 'DatabaseToRestore'
Restore-AzSqlDatabase -FromDeletedDatabaseBackup -DeletionDate $DeletedDatabase.DeletionDate -ResourceGroupName $DeletedDatabase.ResourceGroupName -ServerName $DeletedDatabase.ServerName -TargetDatabaseName "RestoredDatabase" -ResourceId $DeletedDatabase.ResourceID -ElasticPoolName "elasticpool01" -PointInTime UTCDateTime
The first command gets the deleted database backup that you want to restore by using Get-AzSqlDeletedDatabaseBackup. The second command starts the restore from the deleted database backup by using Restore-AzSqlDatabase. If the -PointInTime parameter is not specified, the database will be restored to the deletion time.
Example 5: Geo-Restore a database$GeoBackup = Get-AzSqlDatabaseGeoBackup -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database01"
Restore-AzSqlDatabase -FromGeoBackup -ResourceGroupName "TargetResourceGroup" -ServerName "TargetServer" -TargetDatabaseName "RestoredDatabase" -ResourceId $GeoBackup.ResourceID -Edition "Standard" -ServiceObjectiveName "S2"
The first command gets the geo-redundant backup for the database named Database01, and then stores it in the $GeoBackup variable. The second command restores the backup in $GeoBackup to the SQL database named RestoredDatabase.
Parameters -AsJobRun cmdlet in the background
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -AssignIdentityGenerate and assign a Microsoft Entra identity for this database for use with key management services like Azure KeyVault.
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -BackupStorageRedundancyThe Backup storage redundancy used to store backups for the SQL Database. Options are: Local, Zone, Geo and GeoZone.
Parameter properties Type: String Default value: None Accepted values: Local, Zone, Geo, GeoZone Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -ComputeGenerationThe compute generation to assign to the restored database
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Aliases: Family Parameter sets FromPointInTimeBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False FromDeletedDatabaseBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False FromGeoBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False FromLongTermRetentionBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -ConfirmPrompts you for confirmation before running the cmdlet.
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Aliases: cf Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -DefaultProfileThe credentials, account, tenant, and subscription used for communication with azure
Parameter properties Type: IAzureContextContainer Default value: None Supports wildcards: False DontShow: False Aliases: AzContext, AzureRmContext, AzureCredential Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -DeletionDateSpecifies the deletion date as a DateTime object. To get a DateTime object, use the Get-Date cmdlet.
Parameter properties Type: DateTime Default value: None Supports wildcards: False DontShow: False Parameter sets FromDeletedDatabaseBackup Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False FromDeletedDatabaseBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -EditionSpecifies the edition of the SQL database. The acceptable values for this parameter are:
Specifies the name of the elastic pool in which to put the SQL database.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets FromPointInTimeBackup Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False FromDeletedDatabaseBackup Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False FromGeoBackup Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False FromLongTermRetentionBackup Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -EncryptionProtectorThe encryption protector key for SQL Database.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -EncryptionProtectorAutoRotationThe AKV Key Auto Rotation status
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -FederatedClientIdThe federated client id for the SQL Database. It is used for cross tenant CMK scenario.
Parameter properties Type: Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -FromDeletedDatabaseBackupIndicates that this cmdlet restores a database from a backup of a deleted SQL database. You can use the Get-AzSqlDeletedDatabaseBackup cmdlet to get the backup of a deleted SQL database.
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Parameter sets FromDeletedDatabaseBackup Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False FromDeletedDatabaseBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -FromGeoBackupIndicates that this cmdlet restores a SQL database from a geo-redundant backup. You can use the Get-AzSqlDatabaseGeoBackup cmdlet to get a geo-redundant backup.
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Parameter sets FromGeoBackup Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False FromGeoBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -FromLongTermRetentionBackupIndicates that this cmdlet restores a SQL database from a long term retention backup.
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Parameter sets FromLongTermRetentionBackup Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False FromLongTermRetentionBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -FromPointInTimeBackupIndicates that this cmdlet restores a SQL database from a point-in-time backup.
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Parameter sets FromPointInTimeBackup Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False FromPointInTimeBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -HAReplicaCountThe HA Replica Count used to store backups for the SQL Database.
Parameter properties Type: Int32 Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -KeyListThe list of AKV keys for the SQL Database.
Parameter properties Type:String[]
Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -LicenseTypeThe license type for the Azure Sql database.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -PointInTimeSpecifies the point in time, as a DateTime object, that you want to restore your SQL database to. To get a DateTime object, use Get-Date cmdlet. Use this parameter together with the FromPointInTimeBackup parameter.
Parameter properties Type: DateTime Default value: None Supports wildcards: False DontShow: False Parameter sets FromPointInTimeBackup Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False FromPointInTimeBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -ResourceGroupNameSpecifies the name of the resource group to which this cmdlet assigns the SQL database.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: 0 Mandatory: True Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -ResourceIdSpecifies the ID of the resource to restore.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Aliases: Id Parameter sets (All) Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -ServerNameSpecifies the name of the SQL database server.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -ServiceObjectiveNameSpecifies the name of the service objective.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets FromPointInTimeBackup Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False FromDeletedDatabaseBackup Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False FromGeoBackup Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False FromLongTermRetentionBackup Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: True Value from remaining arguments: False -TagThe tags to associate with the Azure Sql Database
Parameter properties Type: Hashtable Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -TargetDatabaseNameSpecifies the name of the database to restore to.
Parameter properties Type: String Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -UserAssignedIdentityIdThe list of user assigned identity for the SQL Database.
Parameter properties Type:String[]
Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -VCoreThe Vcore numbers of the restored Azure Sql Database.
Parameter properties Type: Int32 Default value: None Supports wildcards: False DontShow: False Aliases: Capacity Parameter sets FromPointInTimeBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False FromDeletedDatabaseBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False FromGeoBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False FromLongTermRetentionBackupWithVcore Position: Named Mandatory: True Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Aliases: wi Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False -ZoneRedundantThe zone redundancy to associate with the Azure Sql Database. This property is only settable for Hyperscale edition databases.
Parameter properties Type: SwitchParameter Default value: None Supports wildcards: False DontShow: False Parameter sets (All) Position: Named Mandatory: False Value from pipeline: False Value from pipeline by property name: False Value from remaining arguments: False CommonParametersThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs DateTime String Outputs AzureSqlDatabaseModelRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4