Move on-prem SQL server VM to azure SQL VM

Brice Milla 31 Reputation points
2020-08-26T21:22:26.727+00:00

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.

Azure Migrate
Azure Migrate
A central hub of Azure cloud migration services and tools to discover, assess, and migrate workloads to the cloud.
737 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,047 questions
Azure Site Recovery
Azure Site Recovery
An Azure native disaster recovery service. Previously known as Microsoft Azure Hyper-V Recovery Manager.
659 questions
0 comments No comments
{count} votes

Accepted answer
  1. Cris Zhan-MSFT 6,611 Reputation points
    2020-08-28T09:11:29.907+00:00

    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'}  
    
    1 person found this answer helpful.

3 additional answers

Sort by: Most helpful
  1. Cris Zhan-MSFT 6,611 Reputation points
    2020-08-27T02:47:54.51+00:00

    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.


  2. Ronen Ariely 15,096 Reputation points
    2020-08-27T06:10:51.603+00:00

    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://learn.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  
    

  3. Ronen Ariely 15,096 Reputation points
    2020-08-27T16:50:05.567+00:00

    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