3

I'm trying to figure out how login works for Azure CLI. I've already logged in with:

az login

and everything seems to work perfectly, but when I try to run any other commands, e.g.:

az storage blob list --container-name my_container

it reports:

Missing credentials to access storage service.

I'm quite confused with how the credentials and logins work for Azure. Since the access token is already granted through the login, shouldn't all other commands just work without further need of authentication? If not, what's the point of login?

0

1 Answer 1

3

Your az storage blob list --container-name my_container cmdlet is incomplete, when you run the command in the Azure shell, it throws the error message below. I understand missing credentials message might cause confusion though, because this is not necessarily required, but if you look at the number 3 in the list, you can see that you need to supply a storage account name for the given container.

Missing credentials to access storage service. The following variations are accepted:

  1. account name and key (--account-name and --account-key options or set AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_KEY environment variables)
  2. account name and SAS token (--sas-token option used with either the --account-name option or AZURE_STORAGE_ACCOUNT environment variable)
  3. account name (--account-name option or AZURE_STORAGE_ACCOUNT environment variable; this will make calls to query for a storage account key using login credentials)
  4. connection string (--connection-string option or set AZURE_STORAGE_CONNECTION_STRING environment variable); some shells will require quoting to preserve literal character interpretation.

Try the following, with your appriopriate container name, and storage account name:

az storage blob list --container-name CONTAINER_NAME --account-name STORAGE_ACCOUNT_NAME

1
  • Thanks. Providing a storage account name doesn't work. I tried with "az storage account list" - it returns an empty list while I can see all my storage accounts fine with Azure Storage Explorer. Any idea why?
    – peidaqi
    Commented Nov 7, 2019 at 17:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .