New-AzVM: 'VMCustomization' is not enabled for the subscription - CloudShell error when creating a simple vm

Melvin Porter 1 Reputation point
2022-03-06T23:35:23.85+00:00

Hi everyone,

Anyone else experiencing similar error when creating a simple VM. Try this, open an Azure CloudShell and enter this:


 New-AzVm `
 -ResourceGroupName "myRG" `
 -Name "myVM" `
 -Location "East US" `
 -VirtualNetworkName "myVnet" `
 -SubnetName "mySubnet" `
 -SecurityGroupName "myNSG" `
 -PublicIpAddressName "myPublicIp"

cmdlet New-AzVM at command pipeline position 1
Supply values for the following parameters:
Credential
User: <enter your desired username>
Password for user <as specified above>: ###########

No Size value has been provided. The VM will be created with the default size Standard_D2s_v3.
New-AzVM: 'VMCustomization' is not enabled for the Subscription. Please register the Subscription for 'Microsoft.Compute/VMCustomizationPreview' to use the feature.


Everything except the VM is created in the resource group.
This also happens with the locally installed Windows PowerShell - with Az module v7.30 installed.
Does not happen with Windows PowerShell with Az module v 7.21

Any idea? Apparently a similar thing with AZ CLI too.

Cheers,

Melvin

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

5 answers

Sort by: Most helpful
  1. Hardik Chudasama 26 Reputation points
    2022-04-05T07:42:14.577+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. kobulloc-MSFT 26,811 Reputation points Microsoft Employee Moderator
    2022-03-07T01:04:00.537+00:00

    Hello, @Melvin Porter !

    The 'VMCustomization' is not enabled for the Subscription error you are seeing is a known issue with New-AzVm that we are currently investigating. I'm including all of my updates in the following thread:

    https://learn.microsoft.com/en-us/answers/questions/758151/how-do-i-fix-the-3439vmcustomization39-is-not-enab.html

    Thank you for including the Az module version numbers that are running into this issue! That will help as we continue to investigate the cause of this error.

    180472-image.png

    Temporary Workaround:
    On your local PowerShell client you can install and revert back to Az.Compute version 4.23.0, which is unaffected by this issue:

    1. Check your current Az.Compute version number using either Get-Module Az.Compute (this will return nothing if the module hasn't been loaded) or Get-Module -ListAvailable -Name Az.Compute -Refresh
    2. Install Az.Compute version 4.23: Install-Module Az.Compute -RequiredVersion 4.23.0 -Force
    3. Switch to Az.Compute version 4.23: Import-Module Az.Compute -RequiredVersion 4.23.0
    4. You should now be able to use New-AzVm
    0 comments No comments

  3. Shankar k 1 Reputation point
    2022-03-15T03:15:02.797+00:00

    I am also facing same issue since 4 days after my Az module upgrade, There is bug fix, try "Update-Module -Name Az" to have very latest version for Az.Compute with bug fix, it resolved my issue.

    0 comments No comments

  4. Szviták, Zsolt György 21 Reputation points
    2022-03-22T18:47:34.457+00:00

    Same issue in Azure Cloud Shell on 03/22/2022 :( ![185670-image.png][1] [1]: /api/attachments/185670-image.png?platform=QnA


  5. Tomasz Kauf 1 Reputation point
    2022-04-05T15:44:54.457+00:00

    Install-Module -Name Az.Compute -RequiredVersion 4.25 resolved the problem.... at least for me. Thanks a lot Aboyinthebox !!

    0 comments No comments

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.