-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Describe the bug
We provision VM's in DevTestLabs for testing purposes and delete the VM's once tests are ran.
Recently the command 'az lab vm delete' is not working when ran from an azure pipelines task. This seems to be an issue when using AzureCLI@2 task and also, we tried running from a PowerShell task which resulted in same error.
However, when we run the command from a cloud shell in portal it works fine.
This was working fine for the past year. Only the last month we are seeing this issue.
Related command
az lab vm delete
Errors
When I add the --yes -y flag the VM's get the deleted but the error is still thrown.
Without --yes -y the VM's are NOT deleted.
when running to following:
az lab vm delete `
--name $($vmName) `
--resource-group $(DevTestLabs.ResourceGroupName) `
--lab-name $(DevTestLabs.LabName) `
--yes -y `
--debug
##[error]Delete VM failed: DEBUG: cli.knack.cli: Command arguments: ['lab', 'vm', 'delete', '--name', 'vm1', '--resource-group', 'rg-devtestlabs', '--lab-name', 'DevTestLab', '--yes', '-y', '--debug']
DEBUG: cli.knack.cli: Command arguments: ['lab', 'vm', 'delete', '--name', 'vm1', '--resource-group', 'rg-devtestlabs', '--lab-name', 'DevTestLab', '--yes', '-y', '--debug']
Without --debug
##[error]Delete VM failed: WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
when running to following:
az lab vm delete `
--name $($vmName) `
--resource-group $(DevTestLabs.ResourceGroupName) `
--lab-name $(DevTestLabs.LabName) `
##[error]Delete VM failed: ERROR: Operation cancelled.
ERROR: Operation cancelled.
Issue script & Debug output
az lab vm delete --name $($vmName)
--resource-group $(DevTestLabs.ResourceGroupName) --lab-name $(DevTestLabs.LabName)
Expected behavior
vms in DevTestLab should be deleted successfully
Environment Summary
azure-cli 2.66.0
core 2.66.0
telemetry 1.1.0
Extensions:
azure-devops 1.0.1
Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1
Python location '/opt/az/bin/python3'
Extensions directory '/opt/az/azcliextensions'
Python (Linux) 3.12.7 (main, Oct 30 2024, 03:56:40) [GCC 11.4.0]
Additional context
No response