en-UShe-IL
You are here:   Blog
Register   |  Login

Blog Archive:

Maximize
* Can be used in order to search for older blogs Entries

Search in blogs


Blog Categories:

Maximize
* Can be used in order to search for blogs Entries by Categories

Blog Tags:

Maximize
* Can be used in order to search for blogs by keywords

TNWikiSummit


Awared MVP

 


Microsoft® Community Contributor 


Microsoft® Community Contributor


 Read this before you use the blog! Maximize

Recent Entries

Minimize
אוג31

Written by: ronen ariely
31/08/2020 10:57 RssIcon

Introduction

This post present step by step tutorial.

This information following the discussion in the Microsoft QnA forums here:
https://docs.microsoft.com/en-us/answers/questions/77890/move-on-prem-sql-server-vm-to-azure-sql-vm.html 

Step one: Create the Virtual Machine in the azure

 

Step two: Register subscription with resource provider

using the Portal

(1) select the relevant subscription
https://portal.azure.com/#blade/Microsoft_Azure_Billing/SubscriptionsBlade

(2) On the left menu click on "Resource providers"

(3) Enter "sql" in the filter, and Select Register

Step Three: Install SQL Server IaaS Agent Extension (SqlIaasExtension) on the Virtual machine

https://docs.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/sql-server-iaas-agent-extension-automate-management

Note! SQL Server IaaS extension have three management modes: Lightweight (fits for multiple instances), Full mode (fits for single instance), and NoAgent (Fits for old version of SQL Server). We will control this on next step.

Step four: Convert the Virtual Machine to SQL Server Virtual Machine

Open the Azure Cloud Shell, and execute the following command

$vm = Get-AzVM -Name "VMName" -ResourceGroupName "Resourcegroupname"
    # Register with SQL VM resource provider
    New-AzResource -Name $vm.Name -ResourceGroupName $vm.ResourceGroupName -Location $vm.Location `
       -ResourceType Microsoft.SqlVirtualMachine/SqlVirtualMachines `
       -Properties @{virtualMachineResourceId=$vm.Id;SqlServerLicenseType='PAYG'}

 

Step 5: Control the licence of SQL on VM

Changing the Licence type of SQL Server on Azure Virtual Machine using the Azure Portal: "SQL virtual machines"

https://portal.azure.com/#blade/HubsExtension/BrowseResource/resourceType/Microsoft.SqlVirtualMachine%2FSqlVirtualMachines

More

You might get error when you change something in the last step. In this case, check the SQL Server Error log file. If the issue is related to missing LOGIN SqlIaaSExtensionQuery then you will need to create it

USE [master]
GO
CREATE LOGIN [NT SERVICE\SqlIaaSExtensionQuery]
FROM WINDOWS WITH DEFAULT_DATABASE=[master]
GO
ALTER SERVER ROLE [sysadmin] ADD MEMBER [NT SERVICE\SqlIaaSExtensionQuery]
GO