Azure / Azure/azure-cli

storage: show-connection-string incorrect for Edge Zone storage accounts

Open
#18,413 7 comments 0 reactions 1 assignee Claimed by @Juliehzl View on GitHub
act-codegen-extensibility-squad feature-request Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Describe the bug

**Command Name**
`az storage account show-connection-string`

**Errors:**
The `EndpointSuffix` in the connection string returned by the CLI is wrong: the storage account I'm querying is deployed in an Edge Zone and should have an `EndpointSuffix` ending in `azure.net`, but I'm getting the standard suffix for public Azure (`core.windows.net`).

```sh
$ az storage account show-connection-string -n mystackstorage | jq .
{
"connectionString": "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=mystackstorage;AccountKey="
}
```

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

- Create a storage account called `mystackstorage` in an Edge Zone
- `az storage account show-connection-string -n mystackstorage`

## Expected Behavior

I expected to see the same `EndpointSuffix` that I'd get by copy-pasting from the Keys section of the Azure Portal.

I traced the problem as far as https://github.com/Azure/azure-cli/blob/dev/src/azure-cli/azure/cli/command_modules/storage/operations/account.py#L224, where we set `endpoint_suffix` to the cloud's standard storage endpoint suffix. In my case, I'm using the Azure public cloud, so this is always the static value set in https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/cloud.py#L320. It looks to me like we should be getting the endpoint suffix from a network request instead.

## Environment Summary
```
Linux-5.4.72-microsoft-standard-WSL2-x86_64-with-debian-bullseye-sid
Python 3.6.10
Installer: DEB

azure-cli 2.24.1 *

Extensions:
account 0.2.1

```
## Additional Context

I work at Microsoft on Edge Zones. Reproducing this bug requires permission to deploy to an edge zone - please reach out internally if you need to be added to the allowlist.

/cc @adepue @DwayneNeed @shriramnat @ChrisDickensMSFT

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.