question

BriceMilla-0161 avatar image
0 Votes"
BriceMilla-0161 asked pituach commented

Move on-prem SQL server VM to azure SQL VM

I am moving a clients servers to azure. We have been using ASR for past migration and plan to do the same. We dont have SA on SQL server licensing.

The issue is when you move all the servers with ASR i do not see an option to make the migrated server a SQL VM only regular VM. I need help in how to make the migrated VM a SQL VM so SQL license is paid for through azure. We dont want to do a DB migration we just want to move all the VMs as is.

sql-server-generalazure-migrateazure-site-recovery
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Criszhan-msft avatar image
1 Vote"
Criszhan-msft answered pituach commented

Hi,

We dont have SA on SQL server licensing.

What the edition of SQL Server installed on the VM? The developer or Express? Try to run the following steps.

  1. Open the Azure Cloud Shell.
    21221-untitled.png

2.Next, please register the SQL Virtual Machine resource via following commands in Azure Cloud Shell. (Please change the VM name and resource group name to your VM's.)

 $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'}


untitled.png (136.6 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

That did it thank you so much!! I compiled all the steps I had to take. 21272-converttosqlvm.png


2 Votes 2 ·
converttosqlvm.png (77.5 KiB)

Hi BriceMilla-0161,

I'm glad to hear that you have solved the problem.
Thank you very much for sharing and summary.
Have a nice day!

0 Votes 0 ·

Thanks for the update
+1

0 Votes 0 ·
Criszhan-msft avatar image
0 Votes"
Criszhan-msft answered BriceMilla-0161 commented

Hi BriceMilla-0161,

You can choose to register the SQL Server VM in Azure after the migration using ASR. After registering, it would be a Azure SQL VM as you wish.

please refer to the MS article about how to register a VM as Azure SQL VM:
Register a SQL Server VM in Azure with the SQL VM resource provider (RP)

===============================================
If the response helped, do "Accept Answer" and upvote it.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

went through all the steps fine but the VM still shows as a normal VM and not a SQL VM. so i don't have access to license. Any ideas?

I see the SQL extension is installed and i have a sql config tab thats shows data its pulling from sql

0 Votes 0 ·
pituach avatar image
0 Votes"
pituach answered BriceMilla-0161 commented

Good day,

These are the steps I use basically

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: 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
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

went through all the steps fine but when i get to Step 4 there are no VMs listed.

i can see the SQLlaasExtention installed fine and i have a SQL config tab now but the VM still shows as a regular VM not a SQL VM.

Any ideas? thanks!

0 Votes 0 ·
pituach avatar image
0 Votes"
pituach answered BriceMilla-0161 commented

Hi,

Before I go and try to continue the discussion, I need to say in advance that there is a huge chance that I will be late to respond if any. It is impossible to follow threads which I participate expect using emails which I cannot use. There is not way to filter only my threads and sort them by update time so I will see which thread was responded. So I am sorry in advance if I do not respond

Anyhow, I came here here to check so here we can continue :-)



the VM still shows as a regular VM not a SQL VM.

Not sure what you mean by "regular VM not a SQL VM". A screenshot with explaining what you expect to see could help.

If you see your VM in the list in step 4, then you should be OK.

When you go to the link I gave you for step 4, do you see the VM?

If you see the VM then click on it and you should get options to manage the licence

20963-image.png



image.png (43.3 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

it does not show under SQL VMs just under VMs. This VM was an on prem test SQL server that we used ASR to move to azure as a test before we move our clients SQL VM to azure.

let me know if you have an other questions. appreciate the help.



21011-1.png20972-2.png


20957-3.png


0 Votes 0 ·
1.png (61.7 KiB)
2.png (46.2 KiB)
3.png (24.7 KiB)