Restore Azure SQL Database from GeoBackup to a different subscription

Simona Pantini 45 Reputation points
2024-04-12T09:15:18.03+00:00

Hi everybody,
I'm facing with this issues: i need to restore an azure SQL database from GeoBackup to a different server in a different subscription, but this error occurs "Long running operation failed with status 'Failed'. Additional Info:'The provided subscription 'x' did not match the subscription in the Url 'y'.'

I've chose this solution because any other solution, such Export/iImport operation or Copy operation, needs Public Network Access enabled to work.

Is there a way to avoid this?

Must say that I need to automate this operation, so I cannot accept any manual operation needed (i.e. Import/export with private link)

Azure SQL Database
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Amira Bedhiafi 15,596 Reputation points
    2024-04-16T07:18:41.5+00:00

    Based on this old thread :

    If you want to use Azure Portal for restore and Backups

    Perform a geo-restore operation using Azure Portal.

    Log in to the Azure portal -> Browse the Azure SQL Server -> Create a SQL database -> Select a backup -> Browse the database -> Click OK

    reference 1

    If you want to geo-restore operation using Powershell :

    1. Log in to the portal
    2. Open the CloudShell PowerShell console
    3. List the subscription. If your account has multiple subscriptions, then list the intended subscription where you have the database
    4. Set the subscription Id using Get-AzSubscription output piped to Set-AzContext.
    5. Get the geo-backups details into the variable $geobackups for the specified database SSISDB
    6. Prepare the restore by listing the target resource group name, target server and target database and
         Set-AzContext -SubscriptionId ù
         
      
    7. In this case, the SSISDB restored to the target Azure SQL database.
         
         $ourceGroupName= 'xxxxx'
         $ServerName='xxxxx'
         $TargetResourceGroup='xxxxx'
         $TargetServer='azuresqlxxxx'
         $TargetDatabaseName='SSISDB_Target'
         $GeoBackups = Get-AzSqlDatabaseGeoBackup -ResourceGroupName 
         $resourceGroupName -ServerName $ServerName
         $GeoBackups | Where-Object {$_.DatabaseName -eq "SSISDB"}
         ($GeoBackups | Where-Object {$_.DatabaseName -eq "SSISDB"}).ResourceId
         Restore-AzSqlDatabase -FromGeoBackup -ResourceGroupName 
         $TargetResourceGroup -ServerName $TargetServer -TargetDatabaseName 
         $TargetDatabaseName -ResourceId ($GeoBackups | Where-Object 
         {$_.DatabaseName -eq "SSISDB"}).ResourceId
      

  2. Amira Bedhiafi 15,596 Reputation points
    2024-04-19T12:16:33.5833333+00:00

    In your case restoring Azure SQL Database from GeoBackup to a different subscription is not possible.

    GeoBackups in Azure SQL Database are primarily designed for disaster recovery within the same subscription and geographical region

    @Simona Pantini since you cannot accept your own answer I tried to reformulate it.

    0 comments No comments