Skip to content

az storage container create fails when providing storage container metadata #16979

@chadburrus

Description

@chadburrus

Describe the bug

When attempting to use az storage container create with the --metadata flag, the command fails with a 'list' object has no attribute 'items' exception.

Running the command without the --metadata flag succeeds with no issues.

Command Name
az storage container create

Errors:

'list' object has no attribute 'items'
Traceback (most recent call last):
python3.8/site-packages/knack/cli.py, ln 215, in invoke
    cmd_result = self.invocation.execute(args)
cli/core/commands/__init__.py, ln 659, in execute
    raise ex
cli/core/commands/__init__.py, ln 722, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
...
storage/v2018_11_09/blob/baseblobservice.py, ln 681, in create_container
    _add_metadata_headers(metadata, request)
storage/v2018_11_09/common/_serialization.py, ln 81, in _add_metadata_headers
    for name, value in metadata.items():
AttributeError: 'list' object has no attribute 'items'

To Reproduce:

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

I started with the script on https://docs.microsoft.com/en-us/azure/developer/terraform/store-state-in-azure-storage#configure-storage-account, and have been adding things such as resource tags. The script worked fine until I tried to add metadata to the storage container.

  • az storage container create --name {} --account-name {} --account-key {} --metadata {}

Expected Behavior

The storage container should be created with the appropriate metadata.

Environment Summary

macOS-11.2.1-x86_64-i386-64bit
Python 3.8.7
Installer: HOMEBREW

azure-cli 2.17.1 *

Additional Context

The resource group and storage account are fairly new (<1 hour). However, I get the same error whether I'm creating the resource group and storage account or they already exist when I try to create the storage container.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions