Share via

Best approach to restore an azure sql db from one subscription top another subscription

Xhevahir Mehalla 45 Reputation points
2026-04-20T10:52:37.69+00:00

Hello

I have this scenario:

I have a susbcription A whihc has az azure sql db server and inside we have two sql db DEV and UAT db.

Each have their own user to access/setup.

I am creating anothe env on a different subscription B under the same tenant.

The sql db server will have the same name and inside that sql sever will have two sql db (DEV and UAT).

What I want is:

  1. Take UAT sql db from subscription A and I want this db to be the new sql db on subscription B.
  2. All users accessing sql db from subscription A should be moved access to new sql db on subscritpion B.
  3. On sql db server admin user which access both server need to be inplace once I create the azure sql on subscription B used the sql db from SQL db from subscription B.

Basically, I want to preserve what I had on subscription A from sql db UAT to be the new sql db on subscription B.

Dev sql db is fine to be empty on Subscription B.

the sql is small db (30 GB).

I know chatgbt gives me some advise I rather want to see what real human think.

Thanks

Xhev

Azure SQL Database

Answer accepted by question author
  1. Saraswathi Devadula 15,930 Reputation points Microsoft External Staff Moderator
    2026-04-20T12:11:20.3733333+00:00

    Hello **Xhevahir Mehalla

    **Moving a 30 GB Azure SQL Database between subscriptions in the same tenant is pretty straightforward—here’s a low-friction way to do it, plus how to carry over your users:

    1. Stand up your new logical SQL server in Subscription B:
      • Give it the same server admin (either Azure AD or SQL Auth) as in Subscription A.
      • Open the server firewall to allow Azure services (this makes the copy simpler).
    2. Copy the UAT database:

    Option A – T-SQL :
    • Connect to the master database on your target server (in Sub B) and run below query,

       sql CREATE DATABASE UAT AS COPY OF serverA-name.UAT (SERVICE_OBJECTIVE = YOUR_DESIRED_TIER);
    

    Option B – PowerShell / Azure CLI / Portal:
    • In PowerShell:

       powershell New-AzSqlDatabaseCopy ` -ResourceGroupName RG-B ` -ServerName serverB-name ` -DatabaseName UAT ` -CopyResourceId "/subscriptions/{subA}/resourceGroups/RG-A/providers/Microsoft.Sql/servers/serverA-name/databases/UAT" 
    

    • Or use the Azure portal’s “Copy” button on the UAT DB blade, picking your server in Sub B.

    1. Migrate your logins/users:
      • If you’re using Azure AD authentication, assigning the same AAD admin on the new server gives your users instant access (you’ll just need to re-grant any DB-level roles if needed).
      • For SQL Auth logins, script them out on the old server with a routine like sp_help_revlogin (which preserves SIDs/password hashes) and run that script on the new server so the database users map correctly.
    2. Validate & cleanup:
      • Test connectivity from your apps or SSMS.
      • Once all’s green, you can drop the old UAT copy or keep it around as a fallback.

    Hope that helps.

    https://learn.microsoft.com/en-us/azure/azure-sql/database/database-copy?view=azuresql&tabs=azure-portal#copy-to-a-different-subscription
    https://learn.microsoft.com/en-us/sql/t-sql/statements/create-database-transact-sql?view=azuresqldb-current&preserve-view=true&tabs=sqlpool#copy-a-database
    https://learn.microsoft.com/en-us/azure/azure-sql/database/database-copy?view=azuresql&tabs=azure-portal#copy-a-database

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.