Azure / azure-cli

Azure Command-Line Interface
MIT License
4.02k stars 3k forks source link

az storage account or-policy create silently fails on canada-central #17346

Open blinkyblink opened 3 years ago

blinkyblink commented 3 years ago

Describe the bug

Command Name az storage account or-policy create

Errors: No error is given. The failure is silent.

To Reproduce:

The command starts executing and ends after a few seconds without printing any information. Looking at destaccount shows that no object replication policy was created.

Expected Behavior

Performing the same actions on Canada East instead of Canada Central succeeds and prints a JSON object with the created policy information.

Environment Summary

Linux-5.8.0-45-generic-x86_64-with-glibc2.29
Python 3.8.5
Installer: PIP

azure-cli 2.20.0

Additional Context

yonzhan commented 3 years ago

storage

Juliehzl commented 3 years ago

Hi @blinkyblink , have you tested other regions? In my test case, eastus2 seems work to me. Here is our test workflow https://github.com/Azure/azure-cli/blob/4b46041ac7e92fcd06b7f2321b35a29530bfa0bc/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_account_scenarios.py#L1438-L1551.

ghost commented 3 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

Issue Details
## Describe the bug **Command Name** `az storage account or-policy create` **Errors:** No error is given. The failure is silent. ## To Reproduce: - Create a resource group in the Canada Central region: `example-rg` - Create two StorageV2 accounts in the Canada Central region: `sourceaccount` and `destaccount` - Create a blob storage container in both accounts: `sourcecont` and `destcont` - `az storage account or-policy create --resource-group example-rg --account-name destaccount --source-account sourceaccount --destination-account destaccount --source-container sourcecont --destination-container destcont --min-creation-time "2021-02-01T00:00:00Z"` The command starts executing and ends after a few seconds without printing any information. Looking at `destaccount` shows that no object replication policy was created. ## Expected Behavior Performing the same actions on Canada East instead of Canada Central succeeds and prints a JSON object with the created policy information. ## Environment Summary ``` Linux-5.8.0-45-generic-x86_64-with-glibc2.29 Python 3.8.5 Installer: PIP azure-cli 2.20.0 ``` ## Additional Context
Author: blinkyblink
Assignees: Juliehzl
Labels: `OKR3.2 Candidate`, `Service Attention`, `Storage`, `feature-request`
Milestone: S185
blinkyblink commented 3 years ago

I mentioned in the original description that it works on canada east.

Creating a policy through the portal works on canada central though... just not the CLI

blinkyblink commented 3 years ago

I just did a little bit more investigation. It appears that this command fails when using Standard_ZRS for the destination storage account SKU in canadacentral. Here is a script I used to test.

#!/bin/bash

set -x

RG_NAME=blinkyblink-dev-cc
LOCATION=canadacentral
SRC_ACC_NAME=sourceacc2691632
SRC_ACC_SKU=Standard_ZRS
DST_ACC_NAME=destacc2691623
DST_ACC_SKU=Standard_ZRS

az storage account create --resource-group $RG_NAME --name $SRC_ACC_NAME --kind StorageV2 --sku $SRC_ACC_SKU --location $LOCATION
az storage account create --resource-group $RG_NAME --name $DST_ACC_NAME --kind StorageV2 --sku $DST_ACC_SKU --location $LOCATION

az storage container create --resource-group $RG_NAME --account-name $SRC_ACC_NAME --name test
az storage container create --resource-group $RG_NAME --account-name $DST_ACC_NAME --name test

az storage account blob-service-properties update --resource-group $RG_NAME --account-name $SRC_ACC_NAME --enable-versioning true --enable-change-feed true
az storage account blob-service-properties update --resource-group $RG_NAME --account-name $DST_ACC_NAME --enable-versioning true

az storage account or-policy create --resource-group $RG_NAME --account-name $DST_ACC_NAME --source-account $SRC_ACC_NAME --destination-account $DST_ACC_NAME \
    --source-container test --destination-container test --min-creation-time "2021-02-01T00:00:00Z"
Here are combinations of variables that I ran this with and whether or not it failed. LOCATION SRC_ACC_SKU DST_ACC_SKU Pass / Fail
canadaeast Standard_LRS Standard_LRS Pass
canadacentral Standard_LRS Standard_LRS Pass
canadacentral Standard_ZRS Standard_LRS Pass
canadacentral Standard_ZRS Standard_ZRS Fail
canadacentral Standard_LRS Standard_ZRS Fail
eastus Standard_ZRS Standard_ZRS Pass

The reason for originally passing in canadaeast is that there are no availability zones so I was force to use the Standard_LRS SKU.

There's definitely something weird going on though since this fails in canadaeast but not useast.

blinkyblink commented 3 years ago

I created an Azure support request since it appears this issue happens through the portal as well.

However, I am keeping this issue open as the failing command fails silently which makes it look like the command succeeded.