How to migrate SQL Server to Microsoft Azure Stack
Published Oct 28 2019 01:06 AM 13.2K Views
Microsoft

As mentioned last week, we created a short video series about how you can migrate workloads to Microsoft Azure Stack. I also mentioned that we will release a complementary blog post to each of the videos which some more guidance and links. In this blog post, we will have a quick look at how you can migrate your SQL Server database to a virtual machine running on Azure Stack.

 

How to migrate SQL Server to Microsoft Azure Stack

There are many ways you can migrate an existing SQL Server to Azure Stack or Azure. In this blog, we are focusing on backing up the database to an Azure Stack Blob Storage account and importing the database into a SQL server running inside an IaaS virtual machine running on Azure Stack. 

 

As mentioned before there are many different methods you could achieve this. If you want to find out more about the different migration methods, check out the following Microsoft Docs article for migrating a SQL Server database to SQL Server in an Azure VM. These can also work for VMs running on Azure Stack.

 

In our scenario, we are using the method to back up a database to an Azure Blob Storage account running on Azure Stack.

 

First, you will need to create SQL Server credentials for authentication to the Microsoft Azure Blob storage service. In our example, we are going to use a Shared Access Signature (SAS) token.

 

CREATE CREDENTIAL azsblobcred
WITH IDENTITY= 'azssqlbackup',
SECRET = '<secret>'

 

To back up the SQL database you can run the following command:

 

BACKUP DATABASE [sqldb]  
TO URL = 'https://<mystorageaccountname>.blob.<region>.<azurestackFQDN>/<mycontainername>/sqldb.bak'
WITH CREDENTIAL = 'azsblobcred';  
GO

 

Now you will need to deploy an Azure Stack virtual machine with SQL Server. You can manually create a virtual machine on Azure Stack and install SQL Server on it, or you can use a marketplace item that already comes with SQL Server preinstalled. 

 

After the SQL Server has successfully been deployed, you need to create the same SQL credentials for the Azure Blob Storage service running on Azure Stack on the new server.

 

CREATE CREDENTIAL azsblobcred
WITH IDENTITY= 'azssqlbackup',
SECRET = '<secret>'

 

Now you can restore the SQL database to the new SQL Server running on Azure Stack.

 

RESTORE DATABASE sqldb FROM URL = 'https://<mystorageaccountname>.blob.<region>.<azurestackFQDN>/<mycontainername>/sqldb.bak'   
WITH CREDENTIAL = 'XXX'
GO

 

Now your database will be imported to the new SQL Server running on Azure Stack.

If you have any questions, feel free to leave a comment.

 

Azure Stack Migration Series

 

You can find the full playlist with the complete Azure Stack Migration video series on YouTube.

 

2 Comments

Awesome AzureStack Serie Thomas :cool:

Copper Contributor
Version history
Last update:
‎Mar 26 2020 02:11 AM
Updated by: