Azure / Azure/azure-cli

--source-vm-id parameter from az lab custom-image create always throw InvalidArgumentValue

Open
#30,232 1 comment 0 reactions 0 assignees View on GitHub
act-codegen-extensibility-squad Auto-Assign bug customer-reported Devtestlab Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

When attempting to create a custom image in Azure DevTest Labs using the Azure CLI, the following error is returned:

```
ERROR: InvalidArgumentValue: --source-vm-id: Invalid format: resource id should be in '/subscriptions/{}/resourcegroups/{}/providers/microsoft.devtestlab/labs/{}/virtualmachines/{}' format.
```

This occurs despite the `--source-vm-id` being provided in the expected format, as shown in the command below. The command does not execute successfully and fails due to an apparent validation issue with the provided source-vm-id format.

### Related command

az lab custom-image create

### Errors

ERROR: InvalidArgumentValue: --source-vm-id: Invalid format: resource id should be in '/subscriptions/{}/resourcegroups/{}/providers/microsoft.devtestlab/labs/{}/virtualmachines/{}' format.

### Issue script & Debug output

```
$ az lab custom-image create --lab-name myLab \
> --name image-1 \
> --os-state NonDeprovisioned \
> --os-type Linux \
> --resource-group myRg \
> --source-vm-id /subscriptions//resourcegroups/myRg/providers/microsoft.devtestlab/labs/MyLab/virtualmachines/tmp-1730362420

WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
ERROR: InvalidArgumentValue: --source-vm-id: Invalid format: resource id should be in '/subscriptions/{}/resourcegroups/{}/providers/microsoft.devtestlab/labs/{}/virtualmachines/{}' format.
```

### Expected behavior

I'm expecting that the custom image is created in the DevTestLab.

### Environment Summary

```
$ az version
{
"azure-cli": "2.65.0",
"azure-cli-core": "2.65.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {
"account": "0.2.5"
}
}

```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.