Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inconsistent functionality between Azure CLI and Powershell cmdlet

I tried to create 2 virtual machines with the same parameters but with 2 different ways:

  1. The Powershell cmdlet:

    New-AzVm -ResourceGroupName $rg -Name "Testing1img" -Credential $credential -Image UbuntuLTS
    
  2. Azure CLI from Powershell:

    az vm create `
      --name "Testing2img" `
      --resource-group $rg `
      --admin-username $credential.UserName `
      --admin-password $credential.Password `
      --image "UbuntuLTS"
    

Both create an Ubuntu LTS VM on the same resource group (different name). The problem I have is that they create VMs with slightly different settings.

In the first case it creates:

  • an Ubuntu 16.04 Linux
  • DNS name is being assigned Trial 1

In the second case we have:

  • an Ubuntu 18.04 Linux
  • No Dns name is being configured Trial 2

Why these (even small) differences? Shouldn't they both create the same exact VMs? Someone asking for an UbuntuLTS would expect the latest available image and not 16.04.

like image 494
Efthymios Kalyviotis Avatar asked Sep 28 '26 08:09

Efthymios Kalyviotis


1 Answers

For New-AzVM you can specify the Ubuntu version with... -Image Canonical:UbuntuServer:18.04-LTS:latest

like image 150
Phil Evans Avatar answered Sep 29 '26 21:09

Phil Evans



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!