Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.99k forks source link

az storage container create returns no error #25868

Open dvob opened 1 year ago

dvob commented 1 year ago

Describe the bug

There are the following problems with the az storage container commands like create or delete:

  1. If they fail the return code is zero
  2. There is no error message returned but only a JSON with created/deleted set to false (see below).

Command Name az storage container create --auth-mode login --account-name $storage_account_name -n mycontainer

Errors:

{
  "created": false
}

To Reproduce:

storage_account_name=satest1234
az group create -n sa-test -l westeurope
az storage account create -g sa-test -n $storage_account_name --allow-blob-public-access false --min-tls-version TLS1_2
az storage container create --auth-mode login --account-name $storage_account_name -n mycontainer

# expect error with an error message that container already exists
az storage container create --auth-mode login --account-name $storage_account_name -n mycontainer

# expected non zero exit code
echo $?

Expected Behavior

Environment Summary

Python 3.10.10
Installer: DEB

azure-cli 2.46.0

Additional Context

yonzhan commented 1 year ago

@evelyn-ys for awareness