Skip to content

Commit

Permalink
[Compute] Update Image aliases with new versioned aliases (Azure#25930)
Browse files Browse the repository at this point in the history
  • Loading branch information
wu5bocheng authored Mar 30, 2023
1 parent fa09e35 commit 9bde773
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 36 deletions.
42 changes: 42 additions & 0 deletions src/azure-cli/azure/cli/command_modules/vm/_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,69 @@
"version": "latest",
"architecture": "x64"
},
"CentOS85Gen2": {
"publisher": "OpenLogic",
"offer": "CentOS",
"sku": "8_5-gen2",
"version": "latest",
"architecture": "x64"
},
"Debian": {
"publisher": "Debian",
"offer": "debian-10",
"sku": "10",
"version": "latest",
"architecture": "x64"
},
"Debian11": {
"publisher": "Debian",
"offer": "debian-11",
"sku": "11-backports-gen2",
"version": "latest",
"architecture": "x64"
},
"Flatcar": {
"publisher": "kinvolk",
"offer": "flatcar-container-linux-free",
"sku": "stable",
"version": "latest",
"architecture": "x64"
},
"FlatcarLinuxFreeGen2": {
"publisher": "kinvolk",
"offer": "flatcar-container-linux-free",
"sku": "stable-gen2",
"version": "latest",
"architecture": "x64"
},
"openSUSE-Leap": {
"publisher": "SUSE",
"offer": "opensuse-leap-15-3",
"sku": "gen2",
"version": "latest",
"architecture": "x64"
},
"OpenSuseLeap154Gen2": {
"publisher": "SUSE",
"offer": "openSUSE-leap-15-4",
"sku": "gen2",
"version": "latest",
"architecture": "x64"
},
"RHEL": {
"publisher": "RedHat",
"offer": "RHEL",
"sku": "7-LVM",
"version": "latest",
"architecture": "x64"
},
"RHELRaw8LVMGen2": {
"publisher": "RedHat",
"offer": "RHEL",
"sku": "8-lvm-gen2",
"version": "latest",
"architecture": "x64"
},
"SLES": {
"publisher": "SUSE",
"offer": "sles-15-sp3",
Expand All @@ -66,6 +101,13 @@
"sku": "18.04-LTS",
"version": "latest",
"architecture": "x64"
},
"Ubuntu2204": {
"publisher": "Canonical",
"offer": "0001-com-ubuntu-server-jammy",
"sku": "22_04-lts-gen2",
"version": "latest",
"architecture": "x64"
}
},
"Windows": {
Expand Down
70 changes: 36 additions & 34 deletions src/azure-cli/azure/cli/command_modules/vm/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
az disk create -g MyResourceGroup -n MyDisk --size-gb 10 --location eastus2 --zone 1
- name: Create a disk from image.
text: >
az disk create -g MyResourceGroup -n MyDisk --image-reference Canonical:UbuntuServer:18.04-LTS:18.04.202002180
az disk create -g MyResourceGroup -n MyDisk --image-reference Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:latest
- name: Create a disk from the OS Disk of a compute gallery image version
text: >
az disk create -g MyResourceGroup -n MyDisk --gallery-image-reference /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/galleries/myGallery/images/myImage/versions/1.0.0
Expand Down Expand Up @@ -363,10 +363,10 @@
- az vm image list
- az vm image show
examples:
- name: Create an image builder template from an UbuntuLTS 18.04 image. Distribute it as a managed image and a shared image gallery image version. Specify the staging resource group id as the image template that will be used to build the image.
- name: Create an image builder template from an Ubuntu2204 image. Distribute it as a managed image and a shared image gallery image version. Specify the staging resource group id as the image template that will be used to build the image.
text: |
scripts="https://my-script-url.net/customize_script.sh"
imagesource="Canonical:UbuntuServer:18.04-LTS:18.04.201903060"
imagesource="Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:latest"
az image builder create --image-source $imagesource -n myTemplate -g myGroup \\
--scripts $scripts --managed-image-destinations image_1=westus \\
Expand Down Expand Up @@ -1604,6 +1604,7 @@
type: string
short-summary: >
The name of the operating system image as a URN alias, URN, custom image name or ID, custom image version ID, or VHD blob URI. In addition, it also supports shared gallery image.
Please use the image alias including the version of the distribution you want to use. For example: please use Debian11 instead of Debian.'
This parameter is required unless using `--attach-os-disk.` Valid URN format: "Publisher:Offer:Sku:Version". For more information, see https://docs.microsoft.com/azure/virtual-machines/linux/cli-ps-findimage
populator-commands:
- az vm image list
Expand All @@ -1617,9 +1618,9 @@
- name: --computer-name
short-summary: The host OS name of the virtual machine. Defaults to the name of the VM.
examples:
- name: Create a default Ubuntu VM with automatic SSH authentication.
- name: Create a default Ubuntu2204 VM with automatic SSH authentication.
text: >
az vm create -n MyVm -g MyResourceGroup --image UbuntuLTS
az vm create -n MyVm -g MyResourceGroup --image Ubuntu2204
- name: Create a default RedHat VM with automatic SSH authentication using an image URN.
text: >
az vm create -n MyVm -g MyResourceGroup --image RedHat:RHEL:7-RAW:7.4.2018010506
Expand All @@ -1644,20 +1645,20 @@
- name: Create a VM by attaching to an unmanaged operating system disk from a VHD blob uri.
text: >
az vm create -g MyResourceGroup -n MyVm --attach-os-disk https://vhd1234.blob.core.windows.net/vhds/osdisk1234.vhd --os-type linux --use-unmanaged-disk
- name: 'Create an Ubuntu Linux VM using a cloud-init script for configuration. See: https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init.'
- name: 'Create an Debian11 VM using a cloud-init script for configuration. See: https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init.'
text: >
az vm create -g MyResourceGroup -n MyVm --image debian --custom-data MyCloudInitScript.yml
- name: Create a Debian VM with SSH key authentication and a public DNS entry, located on an existing virtual network and availability set.
az vm create -g MyResourceGroup -n MyVm --image Debian11 --custom-data MyCloudInitScript.yml
- name: Create a Debian11 VM with SSH key authentication and a public DNS entry, located on an existing virtual network and availability set.
text: |
az vm create -n MyVm -g MyResourceGroup --image debian --vnet-name MyVnet --subnet subnet1 \\
az vm create -n MyVm -g MyResourceGroup --image Debian11 --vnet-name MyVnet --subnet subnet1 \\
--availability-set MyAvailabilitySet --public-ip-address-dns-name MyUniqueDnsName \\
--ssh-key-values @key-file
- name: Create a simple Ubuntu Linux VM with a public IP address, DNS entry, two data disks (10GB and 20GB), and then generate ssh key pairs.
text: |
az vm create -n MyVm -g MyResourceGroup --public-ip-address-dns-name MyUniqueDnsName \\
--image ubuntults --data-disk-sizes-gb 10 20 --size Standard_DS2_v2 \\
--image Ubuntu2204 --data-disk-sizes-gb 10 20 --size Standard_DS2_v2 \\
--generate-ssh-keys
- name: Create a Debian VM using Key Vault secrets.
- name: Create a Debian11 VM using Key Vault secrets.
text: >
az keyvault certificate create --vault-name vaultname -n cert1 \\
-p "$(az keyvault certificate get-default-policy)"
Expand All @@ -1669,23 +1670,23 @@
az vm create -g group-name -n vm-name --admin-username deploy \\
--image debian --secrets "$vm_secrets"
--image debian11 --secrets "$vm_secrets"
- name: Create a CentOS VM with a system assigned identity. The VM will have a 'Contributor' role with access to a storage account.
text: >
az vm create -n MyVm -g rg1 --image centos --assign-identity [system] --scope /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/MyResourceGroup/myRG/providers/Microsoft.Storage/storageAccounts/storage1 --role Contributor
- name: Create a debian VM with a user assigned identity.
az vm create -n MyVm -g rg1 --image CentOS85Gen2 --assign-identity [system] --scope /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/MyResourceGroup/myRG/providers/Microsoft.Storage/storageAccounts/storage1 --role Contributor
- name: Create a Debian11 VM with a user assigned identity.
text: >
az vm create -n MyVm -g rg1 --image debian --assign-identity /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/resourcegroups/myRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myID
- name: Create a debian VM with both system and user assigned identity.
az vm create -n MyVm -g rg1 --image Debian11 --assign-identity /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/resourcegroups/myRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myID
- name: Create a Debian11 VM with both system and user assigned identity.
text: >
az vm create -n MyVm -g rg1 --image debian --assign-identity [system] /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/resourcegroups/myRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myID
az vm create -n MyVm -g rg1 --image Debian11 --assign-identity [system] /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/resourcegroups/myRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myID
- name: Create a VM in an availability zone in the current resource group's region.
supported-profiles: latest
text: >
az vm create -n MyVm -g MyResourceGroup --image Centos --zone 1
az vm create -n MyVm -g MyResourceGroup --image CentOS85Gen2 --zone 1
- name: Create multiple VMs. In this example, 3 VMs are created. They are MyVm0, MyVm1, MyVm2.
text: >
az vm create -n MyVm -g MyResourceGroup --image centos --count 3
az vm create -n MyVm -g MyResourceGroup --image CentOS85Gen2 --count 3
- name: Create a VM from shared gallery image
text: >
az vm create -n MyVm -g MyResourceGroup --image /SharedGalleries/{gallery_unique_name}/Images/{image}/Versions/{version}
Expand Down Expand Up @@ -2689,7 +2690,7 @@
vm_secrets=$(az vm secret format -s "$secrets")
az vm create -g group-name -n vm-name --admin-username deploy \\
--image debian --secrets "$vm_secrets"
--image Debian11 --secrets "$vm_secrets"
"""

helps['vm secret list'] = """
Expand Down Expand Up @@ -2926,7 +2927,8 @@
type: string
short-summary: >
The name of the operating system image as a URN alias, URN, custom image name or ID, or VHD blob URI. In addition, it also supports shared gallery image.
Valid URN format: "Publisher:Offer:Sku:Version".
Please use the image alias including the version of the distribution you want to use. For example: please use Debian11 instead of Debian.'
This parameter is required unless using `--attach-os-disk.` Valid URN format: "Publisher:Offer:Sku:Version". For more information, see https://docs.microsoft.com/azure/virtual-machines/linux/cli-ps-findimage
populator-commands:
- az vm image list
- az vm image show
Expand All @@ -2940,18 +2942,18 @@
- name: Create a Linux VM scale set with an auto-generated ssh key pair, a public IP address, a DNS entry, an existing load balancer, and an existing virtual network.
text: |
az vmss create -n MyVmss -g MyResourceGroup --public-ip-address-dns-name my-globally-dns-name \\
--load-balancer MyLoadBalancer --vnet-name MyVnet --subnet MySubnet --image UbuntuLTS \\
--load-balancer MyLoadBalancer --vnet-name MyVnet --subnet MySubnet --image Ubuntu2204 \\
--generate-ssh-keys
- name: Create a Linux VM scale set from a custom image using the default existing public SSH key.
text: >
az vmss create -n MyVmss -g MyResourceGroup --image MyImage
- name: Create a Linux VM scale set with a load balancer and custom DNS servers. Each VM has a public-ip address and a custom domain name.
text: >
az vmss create -n MyVmss -g MyResourceGroup --image centos \\
az vmss create -n MyVmss -g MyResourceGroup --image CentOS85Gen2 \\
--public-ip-per-vm --vm-domain-name myvmss --dns-servers 10.0.0.6 10.0.0.5
- name: 'Create a Linux VM scale set using a cloud-init script for configuration. See: https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init'
text: >
az vmss create -g MyResourceGroup -n MyVmss --image debian --custom-data MyCloudInitScript.yml
az vmss create -g MyResourceGroup -n MyVmss --image Debian11 --custom-data MyCloudInitScript.yml
- name: Create a VMSS from a generalized gallery image version.
text: >
az vmss create -g MyResourceGroup -n MyVmss --image /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/galleries/myGallery/images/myImage/versions/1.0.0
Expand All @@ -2961,7 +2963,7 @@
- name: Create a VMSS from the latest version of a gallery image
text: >
az vmss create -g MyResourceGroup -n MyVmss --image /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/galleries/myGallery/images/myImage
- name: Create a Debian VM scaleset using Key Vault secrets.
- name: Create a Debian11 VM scaleset using Key Vault secrets.
text: >
az keyvault certificate create --vault-name vaultname -n cert1 \\
-p "$(az keyvault certificate get-default-policy)"
Expand All @@ -2973,23 +2975,23 @@
az vmss create -g group-name -n vm-name --admin-username deploy \\
--image debian --secrets "$vm_secrets"
--image Debian11 --secrets "$vm_secrets"
- name: Create a VM scaleset with system assigned identity. The VM will have a 'Contributor' Role with access to a storage account.
text: >
az vmss create -n MyVmss -g MyResourceGroup --image centos --assign-identity --scope /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/MyResourceGroup/myRG/providers/Microsoft.Storage/storageAccounts/storage1 --role Contributor
- name: Create a debian VM scaleset with a user assigned identity.
az vmss create -n MyVmss -g MyResourceGroup --image CentOS85Gen2 --assign-identity --scope /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/MyResourceGroup/myRG/providers/Microsoft.Storage/storageAccounts/storage1 --role Contributor
- name: Create a Debian11 VM scaleset with a user assigned identity.
text: >
az vmss create -n MyVmss -g rg1 --image debian --assign-identity /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/resourcegroups/myRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myID
- name: Create a debian VM scaleset with both system and user assigned identity.
az vmss create -n MyVmss -g rg1 --image Debian11 --assign-identity /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/resourcegroups/myRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myID
- name: Create a Debian11 VM scaleset with both system and user assigned identity.
text: >
az vmss create -n MyVmss -g rg1 --image debian --assign-identity [system] /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/resourcegroups/myRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myID
az vmss create -n MyVmss -g rg1 --image Debian11 --assign-identity [system] /subscriptions/99999999-1bf0-4dda-aec3-cb9272f09590/resourcegroups/myRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myID
- name: Create a single zone VM scaleset in the current resource group's region
supported-profiles: latest
text: >
az vmss create -n MyVmss -g MyResourceGroup --image Centos --zones 1
az vmss create -n MyVmss -g MyResourceGroup --image CentOS85Gen2 --zones 1
- name: Create a VMSS that supports SpotRestore.
text: >
az vmss create -n MyVmss -g MyResourceGroup --location NorthEurope --instance-count 2 --image Centos --priority Spot --eviction-policy Deallocate --single-placement-group --enable-spot-restore True --spot-restore-timeout PT1H
az vmss create -n MyVmss -g MyResourceGroup --location NorthEurope --instance-count 2 --image CentOS85Gen2 --priority Spot --eviction-policy Deallocate --single-placement-group --enable-spot-restore True --spot-restore-timeout PT1H
- name: Create a VMSS from shared gallery image.
text: >
az vmss create -n MyVmss -g MyResourceGroup --image /SharedGalleries/{gallery_unique_name}/Images/{image}/Versions/{version}
Expand Down Expand Up @@ -3804,7 +3806,7 @@
--collection-name "rpcName" --name "rpName"
- name: Create a restore point with --consistency-mode CrashConsistent
text: |-
az vm create -n vm -g rg --image UbuntuLTS --tag EnableCrashConsistentRestorePoint=True
az vm create -n vm -g rg --image Ubuntu2204 --tag EnableCrashConsistentRestorePoint=True
az restore-point collection create --source-id "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM"\
-g rg --collection-name "myRpc"
Expand Down
Loading

0 comments on commit 9bde773

Please sign in to comment.