Azure / Azure/azure-cli

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

Open
#22,158 3 comments 1 reaction 2 assignees Claimed by @cxznmhdcxz View on GitHub
act-observability-squad Auto-Assign Compute feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**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**
```bash
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**

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.