Hi Team,
I’m trying to complete a lab task that requires creating a VM using Azure CLI.
I used this command:
az vm create
–resource-group
–name xfusion-vm
–image Ubuntu2204
–size Standard_B2s
–location westus
–admin-username azureuser
–generate-ssh-keys
–os-disk-size-gb 30
But the VM creation always fails with this error:
{“status”:“Failed”,“error”:{“code”:“DeploymentFailed”,“target”:“/subscriptions/f0c3bcdd-5ce2-4fa0-8cf3-41559747512b/resourceGroups/kml_rg_main-38f7ca9e182a4862/providers/Microsoft.Resources/deployments/vm_deploy_6OameyvVgtz1ebUiHokRyNJ15muejdW2”,“message”:“At least one resource deployment operation failed. Please list deployment operations for details. Please see Deployment history - Azure Resource Manager | Microsoft Learn for usage details.”,“details”:[{“code”:“ResourceDeploymentFailure”,“target”:“/subscriptions/f0c3bcdd-5ce2-4fa0-8cf3-41559747512b/resourceGroups/kml_rg_main-38f7ca9e182a4862/providers/Microsoft.Compute/virtualMachines/xfusion-vm”,“message”:“The resource write operation failed to complete successfully, because it reached terminal provisioning state ‘Failed’.”,“details”:[{“code”:“RequestDisallowedByPolicy”,“message”:“Resource ‘xfusion-vm_OsDisk_1_c2922b8a98434b69a252789a897e68c6’ was disallowed by policy. Reasons: ‘Global: This storage configuration is not allowed. Ensure the disk size is 128 GB or less and the SKU is not Premium for Compute disks. For Storage accounts, use Standard_LRS or Standard_RAGRS SKUs.’. See error details for policy resource IDs. Target: ‘/subscriptions/f0c3bcdd-5ce2-4fa0-8cf3-41559747512b/resourceGroups/kml_rg_main-38f7ca9e182a4862/providers/Microsoft.Compute/disks/xfusion-vm_OsDisk_1_c2922b8a98434b69a252789a897e68c6’.”}]}]}}
The same VM works when I create it through the Azure Portal UI, where I can select Standard HDD manually.
In the CLI, the OS disk type cannot be changed (the flags for setting Standard_LRS are not supported in the lab).
So every Ubuntu image ends up using Premium_LRS → which is denied → and the VM deployment fails.
I tried alternate images and URNs, but many are blocked or return “Artifact not found”.
Bottom line:
I am unable to complete the lab using only the CLI because Ubuntu22.04 always triggers a policy block in the KodeKloud Azure sandbox.
Can someone please check this?
Either allow Standard_LRS for Ubuntu22.04 by default, or enable CLI parameters to change the OS disk SKU.
Thanks!