'VMCustomization' is not enabled for the Subscription. Error trying to create vm from command line

Jay 61 Reputation points
2022-02-08T19:24:01.407+00:00

C:\WINDOWS\system32>az vm create --resource-group "psdemo-rg" --name "psdemo-win-cli" --image "win2019datacenter" --admin-username "demoadmin" --admin-password "<snip>"
It is recommended to use parameter "--public-ip-sku Standard" to create new VM with Standard public IP. Please note that the default public IP used for VM creation will be changed from Basic to Standard in the future.
{"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"BadRequest","message":"{\r\n \"error\": {\r\n \"code\": \"BadRequest\",\r\n \"message\": \"'VMCustomization' is not enabled for the Subscription. Please register the Subscription for 'Microsoft.Compute/VMCustomizationPreview' to use the feature.\"\r\n }\r\n}"}]}}

I'm unable to find anything about VMCustomizationPreview in azure. What does this mean? how to Fix?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,980 questions
{count} votes

Accepted answer
  1. kobulloc-MSFT 26,346 Reputation points Microsoft Employee
    2022-02-08T23:55:10.46+00:00

    Hello, @Jay !

    Resolution: This appears to be an issue with the Azure CLI with the release of 2.33.0 (thank you @Jay for bringing this to our attention).

    • A hotfix was deployed on 2/14
    • You can use az upgrade to upgrade your CLI to version 2.33.1 to resolve this issue.
    • The Azure Cloud Shell update has completed and it is now running 2.33.1 as of 3pm PST on 2/18 (this should mean that Azure Learn modules are now unblocked).

    Error: 'VMCustomization' is not enabled for the Subscription
    Attempting to use az vm create with Azure CLI version 2.33.0 will result in the following error:

    'VMCustomization' is not enabled for the Subscription. Please register the Subscription for 'Microsoft.Compute/VMCustomizationPreview' to use the feature.

    https://learn.microsoft.com/en-us/azure/virtual-machines/windows/quick-create-cli#create-virtual-machine

    az vm create \  
        --resource-group myResourceGroup \  
        --name myVM \  
        --image Win2019Datacenter \  
        --public-ip-sku Standard \  
        --admin-username azureuser  
    

    Using version 2.33.0 of the Azure CLI (az --version), you will get the VM Customization error:

    172682-image.png

    Using another version of the Azure CLI the command executes successfully:

    172404-image.png

    What is VM Customization (Private Preview)?
    VM Customization is in private preview and is designed to provide customization for Hyperthreading and Constrained Cores:

    https://aka.ms/vmcustomization

    The VM Customization feature is designed to provide two important customization features to customers, Hyperthreading and Constrained Cores. Hyperthreading provides customers the ability to disable hyperthreading on their VMs at the time of creation and Constrained Cores allows customization of the “constrained core counts” which helps to optimize the database licensing cost customers pay for.

    1 person found this answer helpful.

12 additional answers

Sort by: Most helpful
  1. Hardik Chudasama 26 Reputation points
    2022-04-05T07:40:01.29+00:00

    This is now resolved for MS Learn Module

    One your Active Sandbox Try Running

    Install-Module -Name Az.Compute -RequiredVersion 4.24.1

    OR

    Install-Module -Name Az.Compute -RequiredVersion 4.25

    Then

    Pwsh

    That starts a new powershell session

    New-AzVm -ResourceGroupName learn-d2a8d1e3-0259-4d64-a7ec-8348a719b240 -Name "testvm-eus-01" -Credential (Get-Credential) -Location "East US" -Image UbuntuLTS -OpenPorts 22 -PublicIpAddressName "testvm-01"

    will work successfully now!

    2 people found this answer helpful.
    0 comments No comments

  2. Greg Cockburn 11 Reputation points
    2022-02-10T10:52:59.967+00:00

    Cloud Shell is running 2.33.0 and is affected by this bug. How do you downgrade Cloud Shell?

    1 person found this answer helpful.

  3. kobulloc-MSFT 26,346 Reputation points Microsoft Employee
    2022-02-17T16:34:47.003+00:00

    @Phil Georgiou , updating to 2.33.1 will resolve this issue however the Azure Cloud Shell takes a while to update and I haven't seen an update for that yet. I'm continuing to follow the status of the Azure Cloud Shell and Azure Learn modules today.

    1 person found this answer helpful.

  4. Adrian Suhov 6 Reputation points
    2022-02-09T16:43:41.147+00:00

    I am experiencing the same issue with az cli. I was just about to ask the community about it when I found this post.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.