unable to obtain client
This is autogenerated. Please review and update as needed.
Describe the bug
Command Name
az storage container list
Errors:
Unable to obtain data client. Check your connection parameters.
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
az storage account create -g {} -n {} --access-tier cool --kind StorageV2 -l uksouth --https-only true --sku standard_lrssa=$(az storage account show-connection-string -g{} -n {} --query "connectionString")az storage container list --connection-string $saoraz storage container exists --connection-string $sa -n {}
Expected Behavior
container true or false return not error message.
Environment Summary
Linux-5.0.0-1023-azure-x86_64-with-debian-buster-sid
Python 3.6.5
Shell: bash
azure-cli 2.0.75 *
Extensions:
azure-devops 0.11.0
interactive 0.4.3
application-insights 0.1.1
Additional Context
Error occurs while executing commands from within a .sh script.
@Juliehzl please take a look.
Hi @PuffTMD , you need to use connection string variable sa using az storage container list --connection-string $sa. If you still have problems, please let me know.
yes it is using that $sa which is what returns this error. A different response is provided if no connection-string is provided.
Thanks for your more information. Can you echo $sa in your script? I have tried in my linux machine and it works. My script is written as follows:
sa=$(az storage account show-connection-string -g zuh -n zuhstoragetest1 --query "connectionString")
echo $sa
az storage container list --connection-string $sa
yeah i get the correct output if i echo it as if i do when i run it manually
yeah i get the correct output if i echo it as if i do when i run it manually
Can you share with me your script? You can delete your personal info or you can send to me through e-mail. "zuh At microsoft.com"
Emailed you earlier today
Issue seemed to be related to the double quotes returned
az storage account show-connection-string -g{} -n {} --query "connectionString"returns the connection string with double quotes which are invalid.az storage account show-connection-string -g{} -n{} --query "connectionString" -o tsvreturns the connection string without the double quotes. I had to then add in the double quotes when using the connection string.
Sounds good! In this way, I will close this issue and if you still have problems, feel free to reopen it or create another one.😊