3

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.

1
  • I run them directly from MS Terminal (Azure Cloud Shell). I think both are at the latest. The pwsh is at 7.0.3 and the cli at 2.13.0. Commented Oct 26, 2020 at 20:26

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.