Azure / Azure/azure-cli

`az storage account network-rule add` clobbers ipRules with concurrent operations

Open
#29,800 4 comments 1 reaction 2 assignees Claimed by @calvinhzy View on GitHub
act-codegen-extensibility-squad Auto-Assign Azure CLI Team customer-reported question Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

It seems that running two or more commands of `az storage account network-rule add -n mystorage --ip-address x.x.x.x` concurrently will overwrite each other's changes - i.e. it's not actually safely adding to whatever is there. It should probably be using ETags, or at least providing the possibility to use them by providing some sort of `--if-match` argument.

My Storage Account access logs show that there were two changes 2 seconds apart, the first one added an IP address and the second one immediately overwrote the lastly added IP address with another one.

My use case is running Azure DevOps pipelines, where multiple runs are triggered at the same time and they each run on different agents, needing access to the same Storage Account.

### Related command

```
az storage account network-rule add -n mystorage --ip-address x.x.x.x
```

### Errors

![image](https://github.com/user-attachments/assets/bf631373-94a6-4dcd-9727-136bdc047b1b)
![image](https://github.com/user-attachments/assets/a0f44774-26c6-42fa-9cc2-d5e49b717c9e)

### Issue script & Debug output

-

### Expected behavior

Adding IP addresses to Storage Account IP Rules should always add, never replace existing ones.

### Environment Summary

azure-cli 2.63.0

core 2.63.0
telemetry 1.1.0

Dependencies:
msal 1.30.0
azure-mgmt-resource 23.1.1

Python location '/opt/az/bin/python3'
Extensions directory '/home//.azure/cliextensions'

Python (Linux) 3.11.8 (main, Jul 31 2024, 03:39:39) [GCC 11.4.0]

Legal docs and information: aka.ms/AzureCliLegal

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