Unable to create a VM using Azure-Client in DevTestLabs. There is a bug in Azure-Cli.

Haja Mohideen 0 Reputation points
2025-03-21T12:21:42.96+00:00

Hello,

There is a bug in DevTestLabs Azure Client. I'm unable to create a VM.

This is the command.

az lab vm create --resource-group JUMBO-JACK --lab-name JACK --name 'MyTestVm' --image "ZXEE" --image-type custom --size 'Standard_D4s_v3'

--

Error...

azure/cli/command_modules/lab/validators.py", line 305, in _use_custom_image

    os_type = custom_images[0]['vhd']['os_type']

              ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^

KeyError: 'os_type'

Azure DevTest Labs
Azure DevTest Labs
An Azure service that is used for provisioning development and test environments.
287 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Luis Arias 8,516 Reputation points
    2025-03-21T16:29:20.8533333+00:00

    Hello Haja,

    The issue you're facing looks that is related to a missing os_type field in the custom image metadata for ZXEE. This information is crucial for Azure CLI to proceed with the command. To check and confirm whether your custom image has the necessary os_type.

    Check If the os_type isn't there, you'll need to update the image metadata via the Azure portal or recreate the image to include it. To verify run:

    az lab custom-image list --resource-group JUMBO-JACK --lab-name JACK -o yamlc
    

    The output have to show something like below image with the ostype, in your case probably isn't currectly filled in.

    User's image

    Since the DevTest Labs command group is in preview, it’s a good idea to ensure your Azure CLI is updated. Run this command to upgrade your CLI:

    az upgrade
    

    References:

    If the information helped address your question, please Accept the answer.

    Luis

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.