Azure / Azure/azure-cli

`az storage account network-rule add` is exiting too early?

Open
#18,415 17 comments 0 reactions 3 assignees Claimed by @calvinhzy View on GitHub
act-codegen-extensibility-squad feature-request Service Attention Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Describe the bug
Hi,
I would like to create a storage account with a network rule to allow only an ip address:

```
RG=zz
SA=ewq${RANDOM}qwe
CNT=test
LOCATION=westeurope

az group create \
--name "$RG" \
--location "$LOCATION"

az storage account create \
--name "$SA" \
--resource-group "$RG" \
--access-tier Hot \
--sku Standard_LRS \
--default-action Deny \
--https-only true \
--min-tls-version TLS1_2

az storage account network-rule add \
--account-name "$SA" \
--resource-group "$RG" \
--ip-address "$(curl -s ifconfig.me)"

# sleep 15

az storage container create \
--name "$CNT" \
--account-name "$SA"
```

**Errors:**
```
Client-Request-ID=629bdd78-c8f5-11eb-a95a-00155dee1d3d Retry policy did not allow for a retry: Server-Timestamp=Wed, 09 Jun 2021 07:36:19 GMT, Server-Request-ID=61861b58-501e-004d-1902-5d8ebb000000, HTTP status code=403, Exception=This request is not authorized to perform this operation. ErrorCode: AuthorizationFailureAuthorizationFailureThis request is not authorized to perform this operation.RequestId:61861b58-501e-004d-1902-5d8ebb000000Time:2021-06-09T07:36:19.1222232Z.

The request may be blocked by network rules of storage account. Please check network rule set using 'az storage account show -n accountname --query networkRuleSet'.
If you want to change the default action to apply when no rule matches, please use 'az storage account update'.
```

If I uncomment `sleep 15` it does work.

## Expected Behavior
No error reported

## Environment Summary
```
Linux-5.4.72-microsoft-standard-WSL2-x86_64-with-glibc2.33
Python 3.9.5
Installer:

azure-cli 2.24.2

Extensions:
blueprint 0.3.0
```

Thanks

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.