Azure / Azure/azure-cli

keyvault network-rule remove expects --ip-address to contain the CIDR mask

Open
#18,167 3 comments 6 reactions 1 assignee Claimed by @evelyn-ys View on GitHub
act-identity-squad KeyVault Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Describe the bug**
When you remove a network access rule from an AKV using Azure CLI using the `--ip-address` option you must include the CIDR mask on the IP address for the change to actually take effect. If you omit the CIDR mask from the IP address, the command succeeds but the line item is not actually removed from the AKV's network access configuration.

example of command that doesnt work:
`az keyvault network-rule remove --name myVerySecureKeyvault --ip-address 20.37.206.1`
The command will complete successfully. If you then inspect the network access configuration on the key vault you will see the IP address is still present in the config.

example of command that does work:
`az keyvault network-rule remove --name myVerySecureKeyvault --ip-address 20.37.206.1/32`
The command will complete successfully. If you then inspect the network access configuration on the key vault you will see the IP address is no longer present in the config.

**To Reproduce**
* create an Azure Key Vault
* set default access to deny
* add the IP address you want to have access and save the config.
* remove the IP address using the CLI commands above to see the difference in behaviour.

**Expected behavior**
* I expected the IP address to be removed from the configuration.

**Environment summary**
Mac OS 11.3.1 via Brew

**Additional context**
The same command in the `az storage` context behaves as expected.

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.