Cyber Deals - Get up to 65% off on CKA, CKAD, CKS, KCNA, KCSA exams and courses!

On-premise SQL Server to Azure SQL Migration using Log Replay Service (LRS)-Part 2 Preparation

On-premise SQL Server to Azure SQL Migration using Log Replay Service (LRS)-Part 2 Preparation

Steps to execute

Make backups of SQL Server

You can make backups of SQL Server by using either of the following options:

  • Back up to local disk storage, and then upload files to Azure Blob Storage, if your environment restricts direct backups to Blob Storage.
  • Back up directly to Blob Storage with the TO URL option in T-SQL, if your environment and security procedures allow it.
-- Example of how to make a full database backup to a URL
BACKUP DATABASE [SampleDB]
TO URL = 'https://<mystorageaccountname>.blob.core.windows.net/<containername>/<databasefolder>/SampleDB_full.bak'
WITH INIT, COMPRESSION, CHECKSUM
GO
-- Example of how to make a transactional log backup to a URL
BACKUP LOG [SampleDB]
TO URL = 'https://<mystorageaccountname>.blob.core.windows.net/<containername>/<databasefolder>/SampleDB_log.trn'  
WITH COMPRESSION, CHECKSUM

Here our database is AdventureWorks2016

Generate a Blob Storage SAS authentication token for LRS

Azure Blob Storage is used as intermediary storage for backup files between SQL Server and SQL Managed Instance. You need to generate an SAS authentication token, with only list and read permissions, for LRS. The token will enable LRS to access Blob Storage and use the backup files to restore them on SQL Managed Instance.

Follow these steps to generate the token:

  1. Open Storage Explorer from the Azure portal.

  2. Expand Blob Containers .

  3. Right-click the blob container and select Get Shared Access Signature .

  1. Select the timeframe for token expiration. Ensure that the token is valid for the duration of your migration.

  2. Select the time zone for the token: UTC or your local time.

Important:

The time zone of the token and your managed instance might mismatch. Ensure that the SAS token has the appropriate time validity, taking time zones into consideration. If possible, set the time zone to an earlier and later time of your planned migration window.

6. Select the time zone for the token: UTC or your local time.

  1. Select Read and List permissions only.
Important:

Don’t select any other permissions. If you do, LRS won’t start. This security requirement is by design.

8. Select Create.

Copy parameters from the SAS token

Before you use the SAS token to start LRS, you need to understand its structure. The URI of the generated SAS token consists of two parts separated with a question mark ( ? ), as shown in this example:

In our example it will be

StorageContainerUri: [https://storageaccountsqlmitest.blob.core.windows.net/sqlmibackup/AdventureWorks2016](https://storageaccountsqlmitest.blob.core.windows.net/sqlmibackup/AdventureWorks2016)

StorageContainerSasToken: sv=2020-08-04&st=2021-12-17T17%3A01%3A53Z&se=2022-05-30T17%3A01%3A00Z&sr=c&sp=rl&sig=oo1mHExX5StH85yM6ngYP1onMcu5fpLSoH7PNy5C0Zk%3D

Copy the parameters as follows:

  1. Copy the first part of the token, starting from https:// all the way until the question mark (?). Use it as the StorageContainerUri parameter in PowerShell or the Azure CLI for starting LRS.
  2. Copy the second part of the token, starting from the question mark (?) all the way until the end of the string. Use it as the StorageContainerSasToken parameter in PowerShell or the Azure CLI for starting LRS.

Note: Don’t include the question mark when you copy either part of the token.

Log in to Azure and select a subscription

Use the following PowerShell cmdlet to log in to Azure:

Login-AzAccount

Select the appropriate subscription where your managed instance resides by using the following PowerShell cmdlet:

Select-AzSubscription -SubscriptionId <subscription ID>
Jagath Jayaprakash

Jagath Jayaprakash

ITO Service Delivery Consultant III at DXC Technology


Disclaimer: Views expressed in articles are those of the respective authors and do not necessarily reflect the views of their employers or this site. While we aim for accuracy, please verify information before relying on it, and let us know if you spot an error.
Share:

Related Posts

Setup Amazon Managed Service for Grafana (AMG) on AWS EKS

Setup Amazon Managed Service for Grafana (AMG) on AWS EKS

https://aws.amazon.com/grafana/ Based on the previous article of setting up Amazon Managed Service for Prometheus (AMP) with open source Grafana , we …

Snowflake Vs Microsoft Azure: 6 Major Differences

Snowflake Vs Microsoft Azure: 6 Major Differences

Most organizations and companies are switching to cloud computing technology. Snowflake and Azure cloud computing-based technology are being very …

SigStore: Securing my software with a new standard

SigStore: Securing my software with a new standard

The secure dependencies dilemma I had one situation where the customer asking how we can ensure that our 3rd party libraries or any external public...

What is OpenShift

What is OpenShift

In this article you will learn what OpenShift is and why we are using OpenShift. We will also learn the features of OpenShift compared to other …

Deploying Service Mesh – AWS App Mesh onto AWS EKS

Deploying Service Mesh – AWS App Mesh onto AWS EKS

https://aws.amazon.com/app-mesh What is AWS App Mesh? AWS App Mesh is a service mesh that provides application-level networking to make it easy for …

OpenShift Operators (Kubernetes Operators)

OpenShift Operators (Kubernetes Operators)

An Operator is a method of packaging, deploying and managing a Kubernetes-native application.