How to register my Azure VM with the SQL IaaS Agent Extension

David C 191 Reputation points
2021-06-28T20:55:18.807+00:00

I deployed a Azure VM and installed SQL 2019 (as opposed to deploying a SQL Server VM from marketplace with SQL pre-installed).

I was reading about the benefits of SQL IaaS Agent Extension. See the following article:

"Register SQL Server VM with SQL IaaS Agent Extension"

https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/sql-agent-extension-manually-register-single-vm?branch=pr-en-us-80472&tabs=bash%2Cazure-cli

From the article:

Deploying a SQL Server VM Azure Marketplace image through the Azure portal automatically registers the SQL Server VM with the extension. However, if you choose to self-install SQL Server on an Azure virtual machine, or provision an Azure virtual machine from a custom VHD, then you must register your SQL Server VM with the SQL IaaS Agent extension to to unlock full feature benefits and manageability.

To utilize the SQL IaaS Agent extension, you must first register your subscription with the Microsoft.SqlVirtualMachine provider, which gives the SQL IaaS extension the ability to create resources within that specific subscription.

Per the above, I verified that the Microsoft.SQLVirtualMachine provider is registered.

Can I add the SQL IaaS Agent Extension to my Azure VM? I can't seem to find it anywhere. When I try to add it to my VM, Azure shows me a list of 3rd party and Microsoft extensions, but the SQL IaaS Agent is not among them.

SQL Server on Azure Virtual Machines
0 comments No comments
{count} votes

Accepted answer
  1. Olga Os - MSFT 5,831 Reputation points Microsoft Employee
    2021-06-28T22:28:55.493+00:00

    Hello @David C ,

    It seems you just didn't use the last required step to register your Azure VM with the SQL IaaS Agent Extension. You will need to run one more CLI (or PowerShell) command to register the SQL IaaS Agent Extension.

    This step from the same page:

    Register with extension:

    Lightweight management mode(CLI)

    # Register Enterprise or Standard self-installed VM in Lightweight mode  
    az sql vm create --name <vm_name> --resource-group <resource_group_name> --location <vm_location> --license-type <license_type>  
    

    //Name of the SQL virtual machine. The name of the new SQL virtual machine must be equal to the underlying virtual machine created from SQL marketplace image.

    or

    Full management mode (PowerShell)

    # Get the existing  Compute VM  
    $vm = Get-AzVM -Name <vm_name> -ResourceGroupName <resource_group_name>  
    # Register with SQL IaaS Agent extension in full mode  
    New-AzSqlVM -Name $vm.Name -ResourceGroupName $vm.ResourceGroupName -SqlManagementType Full  
    

    or
    NoAgent management mode(CLI)

    az sql vm create -n sqlvm -g myresourcegroup -l eastus |  
    --license-type <license type>  --sql-mgmt-type NoAgent   
    --image-sku Enterprise --image-offer <image offer>  
    

    ------------------------------------------------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Sincerely,
    Olga

    0 comments No comments

0 additional answers

Sort by: Most helpful