sql server warrior

A Blog For SQL Server Technology

Menu

Skip to content
  • Home
  • About Me

Tag Archives: Azure blob storage

2Jun2019

Migrating your MS SQL Database from on-premise to Azure

by emadmousa83

The below guide illustrates backup/restore method through URL to Azure Blog storage from on-premise MS SQL to Azure SQL Database. Moreover, there are multiple ways to migrate to Azure VM for example: Converting on-premises machine to Hyper-V VHDs and then upload to Azure Blob storage. Also, for minimum downtime you can use Always-On availability Group by adding Azure Replica to your on-premise Always-On Infrastructure transnational replication.

First, you need to create a storage account in Azure portal.

Second, you need create a container as shown below:

Picture1

After that go to your storage homepage and under SETTINGS choose “Shared access signature” SAS:

Picture2

A shared access signature (SAS) is a URI that grants restricted access rights to Azure Storage resources. You can provide a shared access signature to clients who should not be trusted with your storage account key but whom you wish to delegate access to certain storage account resources. By distributing a shared access signature URI to these clients, you grant them access to a resource for a specified period of time. By default the access allowed is 8 hours !

Picture3

On the bottom of the page choose “Generate SAS and connection string” …..copy the contents of the URL’s.

Picture4

Now access your on-premise SQL Server Instance using SQL Server Management Studio and create a credential:

CREATE CREDENTIAL

[https://STORAGE_ACCOUNT.blob.core.windows.net/CONTAINER_NAME] WITH IDENTITY= ‘shared access signature’,SECRET=’SAS_TOKEN’

// the highlighted in yellow are required to be replaced with actual values

CREATE CREDENTIAL

[https:emostg.blob.core.windows.net/emoblob] WITH IDENTITY= ‘shared access signature’,SECRET=’sv=2017-11-09&ss=b&srt=sco&sp=rwdlac&se=2018-08-18T15:41:41Z&st=2018-08-18T07:41:41Z&spr=https,http&sig=WSi5e21DOygLtdO%2B2NJ%2FacKhlqJP6id1URIs%2F4oWCdc%3D’

Now you can take backup from a database on premise to your Azure blog storage, in management studio using the GUI:

In the backup choose “URL”

Picture5

The following is the generated T-SQL statement:

BACKUP DATABASE [AdventureWorks2014] TO  URL = N’https://XXXstg.blob.core.windows.net/XXXblob/advworks2014.bak’ WITH NOFORMAT, NOINIT,  NAME = N’AdventureWorks2014-Full Database Backup’, NOSKIP, NOREWIND, NOUNLOAD, COMPRESSION,  STATS = 10

GO

Then in Azure Portal execute the following t-sql:

RESTORE DATABASE [AdventureWorks2014]

FROM URL =’https://XXXstg.blob.core.windows.net/XXXblob/advworks2014.bak’

WITH REPLACE, STATS=5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Azure blob storage, Azure SQL Database, backup database to SAS, backup MSSQL database to blob storage, backup restore MSSQL to Azure, create a storage account in Azure portal, migrate database to Cloud Azure, Migrate MSSQL Database to Azure SQL Database, Migrate MSSQL to Azure, Migrate SQL Server Database to Azure, migrate to Azure, migrate your MSSQL to Azure, migrate your SQL Server from on-premise to Azure, MSSQL blob storage backup, restore MSSQL database from blob storage, restore SQL Server database to Azure, SQL Server in Azure Leave a comment

Blog Stats

  • 198,836 hits

Top Posts & Pages

  • Always-On Error: The target database is participating in an availability group and is currently not accessible for queries
  • How to migrate all data from one datafile to another in SQL Server
  • SQL Server Ledger Feature
  • SQL Server Management Studio 20 and Network Encryption Options
  • Error Code: 0x80071398 the operation failed because either the specified cluster node is not the owner of the group
  • PowerBI Report Server Error you are not allowed to view this folder
  • SQL Server Service Broker Setup in Always-On Availability Group
  • Database Error: The login packet used to open the connection is structurally invalid; the connection has been closed

Archives

  • February 2026
  • November 2025
  • September 2025
  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • November 2024
  • October 2024
  • July 2024
  • May 2024
  • April 2024
  • March 2024
  • October 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • August 2022
  • July 2022
  • June 2022
  • March 2022
  • January 2022
  • September 2021
  • June 2021
  • March 2021
  • January 2021
  • November 2020
  • September 2020
  • June 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018
  • August 2018
  • July 2018
  • April 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • July 2017
  • May 2017
  • April 2017
  • February 2017
  • December 2016
  • October 2016
  • September 2016
  • August 2016
  • July 2016
  • June 2016
  • March 2016
  • December 2015
  • October 2015
  • September 2015
  • August 2015
  • March 2015

Recent Posts

  • SQL Server 2025 API End Points Feature
  • SQL Server Error: Server is in script upgrade mode
  • SQL Server – Query Store Query Hints
  • SQL Server 2025 TEMPDB Resource Governor (Optimizing TEMPDB Usage)
  • SQL Server 2025 Backup Acceleration with ZSTD compression algorithm

Recent Comments

emadmousa83's avataremadmousa83 on PowerBI Report Server Upgrade…
Saravanakumar S's avatarSaravanakumar S on PowerBI Report Server Upgrade…
Niklas Iveslatt's avatarNiklas Iveslatt on SSL Certificate Management in…
Andrew Torres's avatarAndrew Torres on An error occurred within the r…
sumitmore1990's avatarsumitmore1990 on An error occurred within the r…
Blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Subscribe Subscribed
    • sql server warrior
    • Already have a WordPress.com account? Log in now.
    • sql server warrior
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...
 

    Design a site like this with WordPress.com
    Get started