Day 3:Create VM using Azure CLI

The Nautilus DevOps team is in the process of migrating some of their workloads to Azure. One of the tasks involves creating a new Virtual Machine (VM) using the Azure CLI. The team does not have access to the Azure portal but can manage Azure resources via the azure-client host (the landing host for this lab).

  1. Create a new Azure Virtual Machine named xfusion-vm using the Azure CLI.

  2. Use the Ubuntu2204 image and set the VM size to Standard_B2s.

  3. Make sure the admin username is set to azureuser and SSH keys are generated for secure access.

  4. Use Standard_LRS storage account, disk size must be 30GB and ensure the VM xfusion-vm is in the running state after creation.

When I try to do this task, I face these problems in the last command…please, how can I solve it…

~ ➜  az group list
[
  {
    "id": "/subscriptions/acd62f7d-cb02-4fd9-aa3e-3bbdea281b68/resourceGroups/kml_rg_main-df250fa04ffd464d",
    "location": "westus",
    "managedBy": null,
    "name": "kml_rg_main-df250fa04ffd464d",
    "properties": {
      "provisioningState": "Succeeded"
    },
    "tags": null,
    "type": "Microsoft.Resources/resourceGroups"
  }
]

~ ➜  az vm create --resource-group kml_rg_main-df250fa04ffd464d --name xfusion-vm --image Ubuntu2204 --size Standard_B2s --os-disk-size-gb 30 --generate-ssh-key --output json --verbose--image Ubuntu2204 --size 
Default username root is a reserved username. Use azureuser instead.
SSH key files '/root/.ssh/id_rsa' and '/root/.ssh/id_rsa.pub' have been generated under ~/.ssh to allow SSH access to the VM. If using machines without permanent storage, back up your keys to a safe location.
{"error":{"code":"InvalidTemplateDeployment","message":"The template deployment 'vm_deploy_38DaFXJh3sDSPRhKdbSQQJapDpUT1U2A' is not valid according to the validation procedure. The tracking id is '3acaf6d3-4a42-4f5a-89b1-6098bf00b078'. See inner errors for details.","details":[{"code":"SkuNotAvailable","message":"The requested VM size for resource 'Following SKUs have failed for Capacity Restrictions: Standard_B2s' is currently not available in location 'westus'. Please try another size or deploy to a different location or different zone. See https://aka.ms/azureskunotavailable for details."}]}}
Command ran in 9.700 seconds (init: 0.244, invoke: 9.455)