Unable to create Azure vm using cli

I am trying to create azure vm but I am facing errors:

Command: az vm create --name vm-handsonaks --public-ip-sku Standard --resource-group ODL-azure-994430 --image UbuntuLTS --admin-username azureuser --ssh-key-values ~/.ssh/id_rsa.pub --subnet $VM_SUBNET_ID --size Standard_D2s_v3

Error: Ignite (November) 2023 onwards “az vm/vmss create” command will deploy Gen2-Trusted Launch VM by default. To know more about the default change and Trusted Launch, please visit Trusted launch for Azure VMs - Azure Virtual Machines | Microsoft Learn
Consider using the “Ubuntu2204” alias. On April 30, 2023,the image deployed by the “UbuntuLTS” alias reaches its end of life. The “UbuntuLTS” will be removed with the breaking change release of Fall 2023.
{“status”:“Failed”,“error”:{“code”:“DeploymentFailed”,“target”:“/subscriptions/b2aec48f-6dad-4d57-ad25-dad521fe74a4/resourceGroups/ODL-azure-994430/providers/Microsoft.Resources/deployments/vm_deploy_iXQfWgiayTTwpq4sdcVAPfhaXuSpBtE3”,“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/b2aec48f-6dad-4d57-ad25-dad521fe74a4/resourceGroups/ODL-azure-994430/providers/Microsoft.Compute/virtualMachines/vm-handsonaks”,“message”:“The resource write operation failed to complete successfully, because it reached terminal provisioning state ‘Failed’.”,“details”:[{“code”:“RequestDisallowedByPolicy”,“message”:“Resource ‘vm-handsonaks_disk1_5a4799f6d83f4113992b5f8addf71acd’ was disallowed by policy. Policy identifiers: ‘[{"policyAssignment":{"name":"azure8922-994430-PolicyDefinition-ODL-azure-994430","id":"/subscriptions/b2aec48f-6dad-4d57-ad25-dad521fe74a4/resourceGroups/ODL-azure-994430/providers/Microsoft.Authorization/policyAssignments/azure8922-994430-PolicyDefinition-ODL-azure-994430"},"policyDefinition":{"name":"azure8922-994430-PolicyDefinition","id":"/subscriptions/b2aec48f-6dad-4d57-ad25-dad521fe74a4/providers/Microsoft.Authorization/policyDefinitions/azure8922-994430-PolicyDefinition"}}]’. Target: ‘/subscriptions/b2aec48f-6dad-4d57-ad25-dad521fe74a4/resourceGroups/ODL-azure-994430/providers/Microsoft.Compute/disks/vm-handsonaks_disk1_5a4799f6d83f4113992b5f8addf71acd’.”}]}]}}

Hi @sharatbhaskar1988,
You need to specify the --storage-sku flag. In the above command, I added the --storage-sku and
removed the --subnet (because I don’t know the value) flag.

It worked and created a VM.

Regards,

To create a VM,

az vm create --name vm-handsonaks --public-ip-sku Standard --resource-group ODL-azure-998221 --image UbuntuLTS --admin-username azureuser --storage-sku Standard_LRS --ssh-key-values ~/.ssh/id_rsa.pub --size Standard_D2s_v3

To delete the VM,

az vm delete --resource-group ODL-azure-998221 --name vm-handsonaks --yes