To view available long-term backups from the Azure portal, follow these steps:
In the Azure portal, select your managed instance and then select Backups. On the Available backups tab, select the database for which you want to see available backups. Select Manage.

In the Manage backups pane, review the available backups.

You can also restore from this page by choosing the backup and selecting Restore.
Alternatively, to restore a backup from long-term retention by using the Azure portal, follow these steps:
Sign in to the Azure portal.
Go to the target SQL Managed Instance where you plan to restore your database to.
On the Overview page, choose + New database to open the Create Azure SQL Managed Database page.
On the Basics tab of the Create Azure SQL Managed Database page, provide subscription and resource group details under Project details. Then, under Database details provide the new name of the database you plan to restore. Confirm the correct managed instance is listed in the drop down. Then select Next: Data source >
On the Data source tab, choose Point-in-time restore under Use existing data. Provide the subscription, resource group and managed instance that contains the source database. From the Managed database drop-down, choose the database you want to restore, and then choose the point in time you want to restore the database from. The source and target instance can be the same, or two different instances. Select Next : Additional settings >
On the Additional settings tab, you can check the box to inherit the retention policy from the source database, or, alternatively, you can select Configure retention to open the Configure policies page, and set your desired retention policies for your restored database. When finished, select Review + create.
On Review + create, when validation is successful, select Create to restore your database.
This action starts the restore process, which creates a new database and populates it with data from the original database at the specified point in time. For more information about the recovery process, see Recovery time.
View LTR policies
Run the az sql midb ltr-policy show command to view the LTR policy for a single database within an instance.
az sql midb ltr-policy show \
--resource-group mygroup \
--managed-instance myinstance \
--name mymanageddb
View LTR backups
Use the az sql midb ltr-backup list command to view the LTR backups within an instance.
az sql midb ltr-backup list \
--resource-group mygroup \
--location eastus2 \
--managed-instance myinstance
Delete LTR backups
Run the az sql midb ltr-backup delete command to remove an LTR backup. You can run az sql midb ltr-backup list to get the backup name
.
az sql midb ltr-backup delete \
--location eastus2 \
--managed-instance myinstance \
--database mymanageddb \
--name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000"
Important
Deleting LTR backup is non-reversible. To delete an LTR backup after the instance has been deleted you must have Subscription scope permission. You can set up notifications about each delete in Azure Monitor by filtering for operation 'Deletes a long term retention backup'. The activity log contains information on who and when made the request. See Create activity log alerts for detailed instructions.
Restore from LTR backups
Run the az sql midb ltr-backup restore command to restore your database from an LTR backup. You can run az sql midb ltr-backup show to get the backup-id
.
Create a variable for the backup-id
with the command az sql db ltr-backup show
for future use.
get_backup_id=$(az sql midb ltr-backup show
--location eastus2 \
--managed-instance myinstance \
--database mydb \
--name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000" \
--query 'id' \
--output tsv)
Restore your database from an LTR backup
az sql midb ltr-backup restore \
--dest-database targetmidb \
--dest-mi myinstance \
--dest-resource-group mygroup \
--backup-id $get_backup_id
Important
To restore from an LTR backup after the instance has been deleted, you must have permissions scoped to the subscription of the instance and that subscription must be active.
Note
From here, you can connect to the restored database using SQL Server Management Studio to perform needed tasks, such as to extract a bit of data from the restored database to copy into the existing database or to delete the existing database and rename the restored database to the existing database name. See point in time restore.
View LTR policies
This example shows how to list the LTR policies within an instance for a single database.
# gets the current version of LTR policy for a database
$LTRPolicy = @{
InstanceName = $instanceName
DatabaseName = $dbName
ResourceGroupName = $resourceGroup
}
Get-AzSqlInstanceDatabaseBackupLongTermRetentionPolicy @LTRPolicy
This example shows how to list the LTR policies for all of the databases on an instance.
# gets the current version of LTR policy for all of the databases on an instance
$Databases = Get-AzSqlInstanceDatabase -ResourceGroupName $resourceGroup -InstanceName $instanceName
$LTRParams = @{
InstanceName = $instanceName
ResourceGroupName = $resourceGroup
}
foreach($database in $Databases.Name){
Get-AzSqlInstanceDatabaseBackupLongTermRetentionPolicy @LTRParams -DatabaseName $database
}
Clear an LTR policy
This example shows how to clear an LTR policy from a database.
# remove the LTR policy from a database
$LTRPolicy = @{
InstanceName = $instanceName
DatabaseName = $dbName
ResourceGroupName = $resourceGroup
RemovePolicy = $true
}
Set-AzSqlInstanceDatabaseBackupLongTermRetentionPolicy @LTRPolicy
View LTR backups
This example shows how to list the LTR backups within an instance.
$instance = Get-AzSqlInstance -Name $instanceName -ResourceGroupName $resourceGroup
# get the list of all LTR backups in a specific Azure region
# backups are grouped by the logical database id, within each group they are ordered by the timestamp, the earliest backup first
Get-AzSqlInstanceDatabaseLongTermRetentionBackup -Location $instance.Location
# get the list of LTR backups from the Azure region under the given managed instance
$LTRBackupParam = @{
Location = $instance.Location
InstanceName = $instanceName
}
Get-AzSqlInstanceDatabaseLongTermRetentionBackup @LTRBackupParam
# get the LTR backups for a specific database from the Azure region under the given managed instance
$LTRBackupParam = @{
Location = $instance.Location
InstanceName = $instanceName
DatabaseName = $dbName
}
Get-AzSqlInstanceDatabaseLongTermRetentionBackup @LTRBackupParam
# list LTR backups only from live databases (you have option to choose All/Live/Deleted)
$LTRBackupParam = @{
Location = $instance.Location
DatabaseState = 'Live'
}
Get-AzSqlInstanceDatabaseLongTermRetentionBackup @LTRBackupParam
# only list the latest LTR backup for each database
$LTRBackupParam = @{
Location = $instance.Location
InstanceName = $instanceName
OnlyLatestPerDatabase = $true
}
Get-AzSqlInstanceDatabaseLongTermRetentionBackup @LTRBackupParam
Delete LTR backups
This example shows how to delete an LTR backup from the list of backups.
# remove the earliest backup
# get the LTR backups for a specific database from the Azure region under the given managed instance
$LTRBackupParam = @{
Location = $instance.Location
InstanceName = $instanceName
DatabaseName = $dbName
}
$ltrBackups = Get-AzSqlInstanceDatabaseLongTermRetentionBackup @LTRBackupParam
$ltrBackup = $ltrBackups[0]
Remove-AzSqlInstanceDatabaseLongTermRetentionBackup -ResourceId $ltrBackup.ResourceId
Important
Deleting LTR backup is non-reversible. To delete an LTR backup after the instance has been deleted you must have Subscription scope permission. You can set up notifications about each delete in Azure Monitor by filtering for operation 'Deletes a long term retention backup'. The activity log contains information on who and when made the request. See Create activity log alerts for detailed instructions.
Restore from LTR backups
This example shows how to restore from an LTR backup. Note, this interface did not change but the resource ID parameter now requires the LTR backup resource ID.
# restore a specific LTR backup as an P1 database on the instance $instanceName of the resource group $resourceGroup
$LTRBackupParam = @{
Location = $instance.Location
InstanceName = $instanceName
DatabaseName = $dbname
OnlyLatestPerDatabase = $true
}
$ltrBackup = Get-AzSqlInstanceDatabaseLongTermRetentionBackup @LTRBackupParam
$RestoreLTRParam = @{
TargetInstanceName = $instanceName
TargetResourceGroupName = $resourceGroup
TargetInstanceDatabaseName = $dbName
FromLongTermRetentionBackup = $true
ResourceId = $ltrBackup.ResourceId
}
Restore-AzSqlInstanceDatabase @RestoreLTRParam
Important
To restore from an LTR backup after the instance has been deleted, you must have permissions scoped to the subscription of the instance and that subscription must be active. You must also omit the optional -ResourceGroupName parameter.
Note
From here, you can connect to the restored database using SQL Server Management Studio to perform needed tasks, such as to extract a bit of data from the restored database to copy into the existing database or to delete the existing database and rename the restored database to the existing database name. See point in time restore.