Azure / Azure/azure-cli

az storage container create returns no error

Open
#25,868 1 comment 1 reaction 1 assignee Assigned to @evelyn-ys View on GitHub
act-codegen-extensibility-squad Auto-Assign Azure CLI Team customer-reported feature-request Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## 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:
```bash
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
* The commands should return a error message if they fail.
* The return code of az should be non zero if the action fails.

## Environment Summary
```
Python 3.10.10
Installer: DEB

azure-cli 2.46.0
```
## Additional Context

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.