October 19, 2021

Get Azure VM Plan Information

Get azure ARM info from the command line.

This info is useful for creating a VM programatically with the azure API. To do so you will need the plan info which isn't neccessary with Terraform or other automation providers.

  1. First grab the SKU, offer and publisher  from the publisher like so:
az vm image list --location westus --publisher redhat --all

This will return a JSON list like the following but with many more results:

  {
    "offer": "RHEL-SAP-HA",
    "publisher": "RedHat",
    "sku": "8_4",
    "urn": "RedHat:RHEL-SAP-HA:8_4:8.4.2021091201",
    "version": "8.4.2021091201"
  },
  {
    "offer": "rhel-sig-publishing-test",
    "publisher": "RedHat",
    "sku": "rhel77-sig-test",
    "urn": "RedHat:rhel-sig-publishing-test:rhel77-sig-test:7.8.20210222",
    "version": "7.8.20210222"
  }

2. Next use the sku, offer and publisher info to get the PLAN information:

az vm image show --location westus --publisher redhat --offer rhel-sig-publishing-test  --sku rhel77-sig-test --version 7.8.20210222

This will generate output like the following:

{
  "automaticOsUpgradeProperties": {
    "automaticOsUpgradeSupported": false
  },
  "dataDiskImages": [],
  "disallowed": {
    "vmDiskType": "Unmanaged"
  },
  "extendedLocation": null,
  "features": [
    {
      "name": "IsAcceleratedNetworkSupported",
      "value": "True"
    }
  ],
  "hyperVGeneration": "V1",
  "id": "/Subscriptions/4f27b38c-ad3f-43d8-a9a3-01182e5e2f9a/Providers/Microsoft.Compute/Locations/westus/Publishers/redhat/ArtifactTypes/VMImage/Offers/rhel-sig-publishing-test/Skus/rhel77-sig-test/Versions/7.8.20210222",
  "location": "westus",
  "name": "7.8.20210222",
  "osDiskImage": {
    "operatingSystem": "Linux",
    "sizeInBytes": 68719477248,
    "sizeInGb": 64
  },
  "plan": {
    "name": "rhel77-sig-test",
    "product": "rhel-sig-publishing-test",
    "publisher": "redhat"
  },
  "tags": null
}

You can now use the plan info contained within to create your VM in azure.