Azure / Azure/azure-cli

Not able to create a container in Storage Account.

Open
#28,664 4 comments 0 reactions 2 assignees Claimed by @calvinhzy View on GitHub
act-codegen-extensibility-squad Auto-Assign Azure CLI Team customer-reported question Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Not able to create Blob Storage Container

When am trying to create a container in Storage Account using the az storage container create command, am facing the following error

```
"stderr": "WARNING: Command group 'az storage' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus", "stderr_lines": ["WARNING: Command group 'az storage' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus"], "stdout": "{\n \"created\": false\n}", "stdout_lines": ["{", " \"created\": false", "}"]}
```

I have went through the documentation and was not able to find an alternative command to it.

### Related command

```bash
az storage container create --name "{{ terraform_container_name }}" --public-access blob --account-name "{{ sa_name }}" --account-key {{ storage_account_key }}
```

### Errors

"stderr": "WARNING: Command group 'az storage' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus", "stderr_lines": ["WARNING: Command group 'az storage' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus"], "stdout": "{\n \"created\": false\n}", "stdout_lines": ["{", " \"created\": false", "}"]}

### Issue script & Debug output

cli.knack.cli: Command arguments: ['storage', 'container', 'create', '--name', '{{ blob_name}} ', '--public-access', 'blob', '--account-name', '{{ sa_name }}', '--account-key', '{{ storage_account_key }}', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [, , ]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'storage': ['azext_storage_preview', 'azure.cli.command_modules.storage']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: storage 0.113 59 273
cli.azure.cli.core: Total (1) 0.113 59 273
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.knack.cli: Event: CommandLoader.OnLoadCommandTable []
cli.azure.cli.core: storage-preview 0.010 16 52 /Users/strange2x/.azure/cliextensions/storage-preview
cli.azure.cli.core: Total (1) 0.010 16 52
cli.azure.cli.core: Loaded 65 groups, 295 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : storage container create
cli.azure.cli.core: Command table: storage container create
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate []
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/Users/strange2x/.azure/commands/2024-03-30.08-55-34.storage_container_create.11648.log'.
az_command_data_logger: command args: storage container create --name {} --public-access {} --account-name {} --account-key {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [.add_subscription_parameter at 0x103f19620>]
cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.58.0/libexec/lib/python3.11/site-packages/azure/cli/core/profiles/_shared.py", line 660, in _get_attr
op = getattr(op, part)
^^^^^^^^^^^^^^^^^
AttributeError: module 'azure.mgmt.storage.v2023_01_01.models' has no attribute 'ActiveDirectoryPropertiesAccountType'

cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.58.0/libexec/lib/python3.11/site-packages/azure/cli/core/profiles/_shared.py", line 660, in _get_attr
op = getattr(op, part)
^^^^^^^^^^^^^^^^^
AttributeError: module 'azure.mgmt.storage.v2023_01_01.models' has no attribute 'ListKeyExpand'

cli.azure.cli.core.profiles._shared: Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.58.0/libexec/lib/python3.11/site-packages/azure/cli/core/profiles/_shared.py", line 660, in _get_attr
op = getattr(op, part)
^^^^^^^^^^^^^^^^^
AttributeError: module 'azure.mgmt.storage.v2023_01_01.models' has no attribute 'CorsRuleAllowedMethodsItem'

cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [.add_ids_arguments at 0x103f3f880>, .add_cache_arguments at 0x103f3f9c0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [, , .parse_ids_arguments at 0x103f3f920>]
Command group 'az storage' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
cli.azure.cli.command_modules.storage._validators: Try to get storage auth_mode value from environment variables or config file.
cli.azure.cli.command_modules.storage._validators: Try to get storage sas_token value from environment variables or config file.
urllib3.connectionpool: Starting new HTTPS connection (1): {{sa_name}}.blob.core.windows.net:443
urllib3.connectionpool: https://akstestinfrasa.blob.core.windows.net:443 "PUT /{{sa_name}}?restype=container HTTP/1.1" 409 248
cli.knack.cli: Event: CommandInvoker.OnTransformResult [, ]
cli.knack.cli: Event: CommandInvoker.OnFilterResult []
{
"created": false
}
cli.knack.cli: Event: Cli.SuccessfulExecute []
cli.knack.cli: Event: Cli.PostExecute []
az_command_data_logger: exit code: 0
cli.__main__: Command ran in 0.761 seconds (init: 0.109, invoke: 0.652)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 3679 in cache
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/homebrew/Cellar/azure-cli/2.58.0/libexec/bin/python /opt/homebrew/Cellar/azure-cli/2.58.0/libexec/lib/python3.11/site-packages/azure/cli/telemetry/__init__.py /Users/strange2x/.azure"
telemetry.process: Return from creating process
telemetry.main: Finish creating telemetry upload process.

### Expected behavior

Create a blob container in the provided storage account when running the command

### Environment Summary

azure-cli 2.58.0

core 2.58.0
telemetry 1.1.0

Extensions:
storage-preview 1.0.0b1

Dependencies:
msal 1.26.0
azure-mgmt-resource 23.1.0b2

Python location '/opt/homebrew/Cellar/azure-cli/2.58.0/libexec/bin/python'
Extensions directory '/Users/strange2x/.azure/cliextensions'

Python (Darwin) 3.11.8 (main, Feb 6 2024, 21:21:21) [Clang 15.0.0 (clang-1500.1.0.2.5)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

### Additional context

Trying to automate create a resource group, setting up a storage account and then storage blob container which needs to be used for openTofu for state storage

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.