Andie Letourneau

Moving Azure SQL Database from One Subscription to Another

Multiple Environments

Many companies like to separate Production from Development / UAT environments. I have frequently seen Dev / UAT deployed to one subscription, and Production to a different subscription. This works well for the Finance team because the billing for each environment is separated. However, having the environments in different subscriptions inserts a speed bump in a common practice among DBAs – restoring a copy of the Production database in the UAT and Dev environments to ensure that code is synchronized across all environments.

Azure SQL Database Restore Database 

In Azure SQL Database, when you select “Restore”, your options are limited to restoring the same server. Notice that the options for changing the subscription, resource group, and server are greyed out. Only the database name can be changed.

If you need to restore a copy of your Azure SQL database on the same server so that you can copy a deleted table back into your database, then this works fine.

The restore Azure SQL database operation will not allow restoring the database over the existing database, however, you can change the name of the database at any time.

 

Rename Azure SQL Database

In SQL Server Management Studio run the following command on your Azure SQL Server:

ALTER DATABASE OriginalDatabaseName MODIFY NAME = NewDatabaseName;

 

Azure SQL Database Copy Database

The next option would be to COPY the database. This option looks promising because it allows the database to be copied to another server, and if a different Azure SQL server does not exist, a new one may be created without having to leave the Copy dialog and create one separately.

Although the New Server option looks promising, it does not provide the desired options: changing the subscription and resource group.

All is not lost, a solution exists: since an Azure SQL Server can move from one Subscription to another, the database can be copied to a Migration server, moved to the other Subscription then copied onto the existing server to refresh the existing database.

It’s Easier than It Sounds

You must have at least Contributor rights in both subscriptions to successfully perform this operation.

  • Copy the Azure SQL Database to a new migration Azure SQL server using the “Copy database” blade as shown above. This server will exist only for the duration of the database transfer and can be deleted immediately following the completion of the process
  • Go to the Migration Azure SQL Server’s Overview page

  • Click on “Move” and select “Move to another subscription” in the drop list

In the above example, the user does not have access to move resources to the selected resource group.

  • With appropriate permissions, the next step is the validation of resources to move

(The above image is linked to the image in Microsoft Documents “Move resources to a new subscription” article because my account doesn’t have rights to perform this action so I cannot get a good screenshot. The validation dialog should show only the Migration Azure SQL server in this step.)

  • Upon completion of Validation, the Review screen pops up

  • Confirm Source and Target subscriptions, resource groups, and several resources to move then check the box and click “Move”
  • Azure will pop up a notification when the move has been completed
  • Go to the subscription and resource group where the Migration server has moved
  • Go to the overview page of your Azure SQL Database on the Migration server
  • Click on “Copy”
  • Select your UAT or Dev Azure SQL Server and set the database name
  • Click on “Review + Create”
  • Click on “Create” to complete the process

Upon successful completion of the deployment, the migration server may be deleted.

If you have questions about Azure SQL Database, either how to use it or how to implement it in your organization, reach out to us. Our expert team and solution offerings can help your business with any Azure product or service, including Managed Services offerings. Contact us at 888-8AZURE or  [email protected].

Andie LetourneauMoving Azure SQL Database from One Subscription to Another
Read More

How to Upload and Query a CSV File in Databricks

Welcome to another post in our Azure Every Day mini-series covering Databricks. Are you just starting out with Databricks and need to learn how to upload a CSV? In this post I’ll show you how to upload and query a file in Databricks. For a more detailed, step by step view, check out my video at the end of the post. Let’s get started!

Andie LetourneauHow to Upload and Query a CSV File in Databricks
Read More

Preparing for the New Azure Certification Exams

Are you planning to take the new Azure Certification exams and not sure how to best prepare yourself? As with any exam, preparation is key to a passing result. I’m here to give you some insight and tips on the new Azure exam experience and how to get prepared.

 

 

Andie LetourneauPreparing for the New Azure Certification Exams
Read More