Skip to content

az lab vm delete command not working azure pipelines #30446

@ianoflynnautomation

Description

@ianoflynnautomation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botAuto-ResolveAuto resolve by botDevtestlabaz labService AttentionThis issue is responsible by Azure service team.Similar-IssuebugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions