Deploy VM from azure cli failing

Kyle Le 26 Reputation points
2022-02-10T00:01:09.123+00:00

Hi All,

I'm running into a very strange issue. I was able to successfully deploy VMs using Azure cli for a while. The command I'm using is:

az vm create --name <vm name> --resource-group <resource group> --image <image urn> --public-ip-sku Standard

I have not changed anything but recently I have been getting deployment failures running the same command that use to succeed. The failure message I would get is:

{"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":"'VMCustomization' is not enabled for the Subscription. Please register the Subscription for 'Microsoft.Compute/VMCustomizationPreview' to use the feature."}]}

The error message seems to be telling me to register for VMCustomizationPreview feature which I can't find when going to Subscriptions -> Preview features. Has anyone run into this and found a solution? I'm using azure cli version 2.33.0 if that matters. Thanks.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,244 questions
0 comments No comments
{count} vote

Accepted answer
  1. kobulloc-MSFT 23,736 Reputation points Microsoft Employee
    2022-02-10T00:17:07.06+00:00

    Hello, @Kyle Le !

    This is a known issue for Azure CLI version 1.33.0 which is currently being worked on (you can use az --version to check your current Azure CLI version). The temporary workaround is to revert to an older version of the Azure CLI (steps have been included in the links below).

    Description

    Error:

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

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

    172813-image.png

    Using 2.32.0 of the Azure CLI the command executes successfully:

    172404-image.png


2 additional answers

Sort by: Most helpful
  1. Hardik Chudasama 26 Reputation points
    2022-04-05T07:56:29.207+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!

    1 person found this answer helpful.
    0 comments No comments

  2. Hugues Mertens 1 Reputation point
    2022-02-10T15:52:23.337+00:00

    Hello, we have the same issue here and we have a ticket open with Microsoft.
    No news yet

    Case number 2202100050001252

    {"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":"'VMCustomization' is not enabled for the Subscription. Please register the Subscription for 'Microsoft.Compute/VMCustomizationPreview' to use the feature."}]}