Azure / Azure/azure-cli

`az storage account or-policy create` broken at 2.24.0

Open
#18,292 5 comments 0 reactions 1 assignee Claimed by @Juliehzl View on GitHub
act-codegen-extensibility-squad Service Attention 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 or-policy create
```
**Errors:**

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

```
RESOURCE_GROUP=resourceGroup
SOURCE_ACCOUNT=yoursourceaccounthere
DEST_ACCOUNT=yourdestaccounthere

az group create --location uksouth --name ${RESOURCE_GROUP}

az storage account create \
--name ${SOURCE_ACCOUNT} \
--resource-group ${RESOURCE_GROUP}

az storage account create \
--name ${DEST_ACCOUNT} \
--resource-group ${RESOURCE_GROUP}

az storage account blob-service-properties update \
--resource-group ${RESOURCE_GROUP} \
--account-name ${SOURCE_ACCOUNT} \
--enable-versioning \
--enable-change-feed

az storage account blob-service-properties update \
--resource-group ${RESOURCE_GROUP} \
--account-name ${DEST_ACCOUNT} \
--enable-versioning

az storage account or-policy create \
--account-name ${DEST_ACCOUNT} \
--resource-group ${RESOURCE_GROUP} \
--source-account ${SOURCE_ACCOUNT} \
--source-container source-container \
--destination-container dest-container
```
## Expected Behavior

As at 2.24.0, this creates the wrong thing, as can be seen by inspecting the result:
```
az storage account or-policy list \
--account-name ${DEST_ACCOUNT} \
--query '[0].sourceAccount'
"/subscriptions//resourceGroups/${RESOURCE_GROUP}/providers/Microsoft.Storage/storageAccounts/${SOURCE_ACCOUNT}"
```
The expected result is just `"${SOURCE_ACCOUNT}"`.

In the portal, the result is that the created rule shows up under "other accounts", and points at the non-existent source account with the over-specified name.

## Environment Summary
```
Linux-5.4.72-microsoft-standard-WSL2-x86_64-with-glibc2.29
Python 3.8.5
Installer: PIP

azure-cli 2.24.0

Extensions:
image-copy-extension 0.2.8

```
## Additional Context

This worked at release 2.23.0

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.