SQL server licensing on an Azure virtual machine can be setup in two different ways:

  1. Azure Hybrid Benefits (AHB) which is a bring your own license model for users with Software Assurance.
  2. Pay as You Go (PAYG) model in which you are charged monthly for the SQL license. NOTE: If you selected an image from Azure with SQL preinstalled, you likely are paying as you go (PAYG) monthly for your SQL license.

Lets look at how to switch the licensing model.

Change Azure VM SQL license to use Azure Hybrid Benefits:

    1. Login to the Azure portal.
    2. Open a Powershell connection using the cloud shell in the top right of the portal.
    3. If necessary accept the prompt to create a blob storage location.  It should now connect to the terminal.
    4. Type ‘az’ to use the Azure CLI.
    5. You are now connected to the Azure CLI.  Enter the following command to change your Azure SQL Virtual Machine licensing type to use Azure Hybrid Benefits.  Note: update with your vm name and Resource Group the VM belongs.
      az sql vm update -n AZURE_VM_NAME -g RESOURCE_GROUP_NAME --license-type AHUB

Change Azure VM SQL license to Pay as You Go (PAYG):

Follow the same steps above but change step 5 to use the following command:

az sql vm update -n AZURE_VM_NAME -g RESOURCE_GROUP_NAME --license-type PAYG