Skip to content

az vm delete does not delete IP/NSG together with nic when using --nic-delete-option delete #22158

@jepio

Description

@jepio

Describe the bug
When executing az vm create with the --nic-delete-option delete and --os-disk-delete-option delete, an az vm delete will remove NIC and OS-disk but not the public IP and NSG associated with the NIC.

To Reproduce

g=group$RANDOM
n=vm$RANDOM
az group create -g $g -l eastus
az vm create -g $g -n $n --image ... --nic-delete-option delete --os-disk-delete-option delete
az vm delete -g $g -n $n
az resource list -g $g -o table
# NSG and public IP resources left behind

Expected behavior
Expected resources associated with NIC to be deleted along with it.

Environment summary
apt-get, from packages.microsoft.com.

azure-cli 2.35.0
Ubuntu 21.10

Additional context

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions