Azure / Azure/azure-powershell

[Feature]: Add a parameter set to `Get-AzVMImage` that simplifies retrieving popular images and their URN alias, similar to the `az vm image list` command.

Open
#25,597 0 comments 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

### Description of the new feature

Using the `Get-AzVMImage` command in Azure PowerShell is more complicated compared to the Azure CLI, as it requires executing four separate commands:

- `Get-AzVMImagePublisher`
- `Get-AzVMImageOffer`
- `Get-AzVMImageSku`
- `Get-AzVMImage`

Additionally, Azure PowerShell does not provide a straightforward method to determine URN aliases, which can be easily retrieved with the Azure CLI using the `az vm image list` command:

```powershell
(az vm image list | ConvertFrom-Json).urnAlias
```

```Output
CentOS85Gen2
Debian11
FlatcarLinuxFreeGen2
OpenSuseLeap154Gen2
RHELRaw8LVMGen2
SuseSles15SP3
Ubuntu2204
Win2022Datacenter
Win2022AzureEditionCore
Win2019Datacenter
Win2016Datacenter
Win2012R2Datacenter
Win2012Datacenter
```

### Proposed implementation details (optional)

Add a parameter set to `Get-AzVMImage` that simplifies retrieving popular images and their URN alias, similar to the `az vm image list` command.

```powershell
Get-AzVMImage -List
```

```Output

publisher offer urnAlias sku architecture version urn
--------- ----- -------- --- ------------ ------- ---
OpenLogic CentOS CentOS85Gen2 8_5-gen2 x64 latest OpenLogic:CentOS:8_5-gen2:latest
Debian debian-11 Debian11 11-backports-gen2 x64 latest Debian:debian-11:11-backports-gen2:latest
kinvolk flatcar-container-linux-free FlatcarLinuxFreeGen2 stable-gen2 x64 latest kinvolk:flatcar-container-linux-free:stable...
SUSE openSUSE-leap-15-4 OpenSuseLeap154Gen2 gen2 x64 latest SUSE:openSUSE-leap-15-4:gen2:latest
RedHat RHEL RHELRaw8LVMGen2 8-lvm-gen2 x64 latest RedHat:RHEL:8-lvm-gen2:latest
SUSE sles-15-sp3 SuseSles15SP3 gen2 x64 latest SUSE:sles-15-sp3:gen2:latest
Canonical 0001-com-ubuntu-server-jammy Ubuntu2204 22_04-lts-gen2 x64 latest Canonical:0001-com-ubuntu-server-jammy:22_0...
MicrosoftWindowsServer WindowsServer Win2022Datacenter 2022-datacenter-g2 x64 latest MicrosoftWindowsServer:WindowsServer:2022-d...
MicrosoftWindowsServer WindowsServer Win2022AzureEditionCore 2022-datacenter-azure-edition-core x64 latest MicrosoftWindowsServer:WindowsServer:2022-d...
MicrosoftWindowsServer WindowsServer Win2019Datacenter 2019-datacenter-gensecond x64 latest MicrosoftWindowsServer:WindowsServer:2019-d...
MicrosoftWindowsServer WindowsServer Win2016Datacenter 2016-datacenter-gensecond x64 latest MicrosoftWindowsServer:WindowsServer:2016-d...
MicrosoftWindowsServer WindowsServer Win2012R2Datacenter 2012-R2-Datacenter x64 latest MicrosoftWindowsServer:WindowsServer:2012-R...
MicrosoftWindowsServer WindowsServer Win2012Datacenter 2012-Datacenter x64 latest MicrosoftWindowsServer:WindowsServer:2012-D...
```

Adding the **List** parameter lets users quickly retrieve a list of popular images and their corresponding URN alias, simplifying the process and making it more comparable to the `az vm image list` command.

Contributor guide

Open the contributing guide

Research direction

Start with the existing Get-AzVMImage command and compare its four-command workflow with the az vm image list behavior described in the issue. Done means a List parameter returns the popular images shown, including their publisher, offer, URN alias, SKU, architecture, version, and URN.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
cli, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.