-
Notifications
You must be signed in to change notification settings - Fork 3.4k
az vm create --image --specialized seems broken #28428
Copy link
Copy link
Open
Labels
Azure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamComputeaz vm/vmss/image/disk/snapshotaz vm/vmss/image/disk/snapshotact-observability-squadquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone
Metadata
Metadata
Assignees
Labels
Azure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamComputeaz vm/vmss/image/disk/snapshotaz vm/vmss/image/disk/snapshotact-observability-squadquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Describe the bug
az vm create --specializedconsistently prompts for a password when using an image via a full resource path in the form/subscriptions/<guid>/resourceGroups/<resource_group>/providers/Microsoft.Compute/galleries/<gallery>/images/<name>/versions/<version>.Related command
az vm create --specialized --image /subscriptions/<guid>/resourceGroups/<resource_group>/providers/Microsoft.Compute/galleries/<gallery>/images/<name>/versions/<version>Errors
If stdin is open,
az vm createprompts withAdmin Password:from _prompt_for_password(). When stdin is closed, it prompts this error message:ERROR: Please specify password in non-interactive mode.Issue script & Debug output
The logic to ask for a password is shortcut by the check at:
azure-cli/src/azure-cli/azure/cli/command_modules/vm/_validators.py
Line 1100 in f443ab1
(current dev branch commit)
which skips the password prompt not if the VM is specialized but if the storage_profile is one of ManagedSpecializedOSDisk or SASpecializedOSDisk.
The storage_profile when --image is provided is determined at
azure-cli/src/azure-cli/azure/cli/command_modules/vm/_validators.py
Line 393 in f443ab1
This is based on the detection of the image argument at
azure-cli/src/azure-cli/azure/cli/command_modules/vm/_validators.py
Line 246 in f443ab1
The determination for a valid resource id is https://github.com/Azure/msrestazure-for-python/blob/HEAD/msrestazure/tools.py#L185. The problem is that
Expected behavior
Using
--specializedshould completely disable the password prompt. Otherwise, the VM creation process fails withParameter 'osProfile' is not allowed.(which is correct).Using an image_id with a specialized image should work.
storage_profile is set to StorageProfile.ManagedSpecializedOSDisk when --attach-os-disk is provided. I had confirmed this to work when creating a disk from a snapshot.
Environment Summary
macOS, az CLI v2.57.0
Additional context
Did this ever work?