I am following (previous and) this tutorial: https://learn.microsoft.com/en-us/training/modules/connect-an-app-to-azure-storage/9-initialize-the-storage-account-model?pivots=javascript to connect an application to the Azure Storage account.
At step 8, when I verify the creation of the container by running the given Azure CLI command and replacing with my storage account:
az storage container list
--account-name <name>
I get the following output:
There are no credentials provided in your command and environment, we will query for account key for your storage account.
It is recommended to provide --connection-string, --account-key or --sas-token in your command as credentials.
You also can add `--auth-mode login` in your command to use Azure Active Directory (Azure AD) for authorization if your login account is assigned required RBAC roles.
For more information about RBAC roles in storage, visit https://learn.microsoft.com/azure/storage/common/storage-auth-aad-rbac-cli.
In addition, setting the corresponding environment variables can avoid inputting credentials in your command. Please use --help to get more information about environment variable usage.
[]
which I am not sure whether the container is listed as [] at the end of the above output.
Comments and suggestions are welcome. Thanks!
2
Answers
This error you are getting is because of an auth issue.
So, there are three solution one is that you run the following command before the running the
az storage container list
--auth-mode
option in theaz storage container list
this is written in the error prompt itself which you have given.command:
this will prompt you for login credentials once provided the output should look like this
you can get your key from the portal under access keys
The output of the command should look like this here I have two containers name photos and test.
I tried to reproduce in my environment and I got same error:
The above error show that in your storage account you didn’t create any containers and files.
I have created one container and add files.
I tried the same command now i got an output successfully.
If you need to remove warnings you can use this command
--only-show-errors
Reference:
az storage container | Microsoft Learn