0
0
Azurecloud~5 mins

VM images and marketplace in Azure - Commands & Configuration

Choose your learning style9 modes available
Introduction
When you want to create a virtual machine quickly, you need a ready-made system image. Azure Marketplace offers many pre-built VM images that save time and effort by providing operating systems and software setups ready to use.
When you want to launch a Windows or Linux server without installing the OS yourself.
When you need a VM with specific software already installed, like a database or web server.
When you want to test software on a clean, standard environment quickly.
When you want to use a trusted, secure image from Microsoft or verified partners.
When you want to save time by avoiding manual setup of the operating system and basic tools.
Commands
This command lists all available VM images published by Microsoft Windows Server in the Azure Marketplace. It helps you see which Windows server images you can use.
Terminal
az vm image list --output table --all --publisher MicrosoftWindowsServer
Expected OutputExpected
Offer Publisher Sku Urn WindowsServer MicrosoftWindowsServer 2019-Datacenter MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest WindowsServer MicrosoftWindowsServer 2016-Datacenter MicrosoftWindowsServer:WindowsServer:2016-Datacenter:latest WindowsServer MicrosoftWindowsServer 2012-R2-Datacenter MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest
--output - Formats the output as a readable table.
--all - Shows all versions of images.
This command creates a new virtual machine named example-vm in the example-rg resource group using the Windows Server 2019 Datacenter image from the marketplace. It sets the admin username and password for login.
Terminal
az vm create --resource-group example-rg --name example-vm --image MicrosoftWindowsServer:WindowsServer:2019-Datacenter:latest --admin-username azureuser --admin-password ExamplePass123!
Expected OutputExpected
{ "fqdns": "", "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/example-rg/providers/Microsoft.Compute/virtualMachines/example-vm", "location": "eastus", "name": "example-vm", "powerState": "VM running", "resourceGroup": "example-rg", "zones": null }
--resource-group - Specifies the Azure resource group to create the VM in.
--image - Specifies the VM image to use from the marketplace.
--admin-username - Sets the administrator username for the VM.
--admin-password - Sets the administrator password for the VM.
This command shows details about the created VM, including its status and IP address, to confirm it is running and accessible.
Terminal
az vm show --resource-group example-rg --name example-vm --show-details --output table
Expected OutputExpected
Name ResourceGroup Location ProvisioningState PowerState PublicIps PrivateIps ------------ --------------- ----------- ------------------- ------------- ------------ ------------ example-vm example-rg eastus Succeeded VM running 52.170.12.34 10.0.0.4
--show-details - Includes runtime details like power state and IP addresses.
--output - Formats output as a readable table.
Key Concept

If you remember nothing else from this pattern, remember: Azure Marketplace VM images let you quickly launch ready-to-use virtual machines with pre-installed operating systems and software.

Common Mistakes
Using an incorrect image URN or misspelling the image name.
The VM creation command fails because it cannot find the specified image in the marketplace.
Use 'az vm image list' to find the exact image URN before creating the VM.
Not specifying a strong admin password when creating the VM.
Azure rejects weak passwords for security reasons, causing the VM creation to fail.
Use a password that meets Azure's complexity requirements, including uppercase, lowercase, numbers, and symbols.
Skipping the verification step after VM creation.
You might think the VM is ready, but it could be stopped or have errors.
Always run 'az vm show' with details to confirm the VM is running and accessible.
Summary
Use 'az vm image list' to find available VM images in the Azure Marketplace.
Create a VM with 'az vm create' specifying the image, resource group, and admin credentials.
Verify the VM status and details with 'az vm show' to ensure it is running correctly.