Azure / Azure/azure-cli

NSG rule delete shouldn't be prevented by a delete lock

Open
#16,958 5 comments 0 reactions 1 assignee Assigned to @kairu-ms View on GitHub
act-quality-productivity-squad feature-request Network Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### **This is autogenerated. Please review and update as needed.**

## Describe the bug

**Command Name**
`az network nsg rule delete`

**Errors:**
```
(ScopeLocked) The scope '/subscriptions//resourceGroups//providers/Microsoft.Network/networkSecurityGroups/node-nsg/securityRules/Test_Port_Range' cannot perform delete operation because following scope(s) are locked: '/subscriptions//resourceGroups/'. Please remove the lock and try again.
```

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- In a Resource Group create a Network Security Group
- Create a "Delete" lock on the Resource Group using the portal
- Create a rule in the NSG
- Try to delete the rule with: `az network nsg rule delete -g {} --nsg-name {} -n {}`

## Expected Behavior

The rule should be deleted as it is configuration.

It can be deleted ~~in the portal, or~~ using Remove-AzNetworkSecurityRuleConfig, though this latter option has been erroneously logged as a bug: https://github.com/Azure/azure-powershell/issues/8365

Note that rules can be successfully deleted from Load Balancers and App Gateways in the same resource group (with the delete lock).

## Environment Summary
```
Windows-10-10.0.19041-SP0
Python 3.6.8
Installer: MSI

azure-cli 2.18.0 *

Extensions:
azure-devops 0.18.0

```
## 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.