azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

unable to obtain client

Open PuffTMD opened this issue 7 years ago • 9 comments

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_lrs
  • sa=$(az storage account show-connection-string -g{} -n {} --query "connectionString")
  • az storage container list --connection-string $sa or
  • az 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.

PuffTMD avatar Nov 05 '19 15:11 PuffTMD

@Juliehzl please take a look.

fengzhou-msft avatar Nov 06 '19 05:11 fengzhou-msft

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.

Juliehzl avatar Nov 06 '19 06:11 Juliehzl

yes it is using that $sa which is what returns this error. A different response is provided if no connection-string is provided.

PuffTMD avatar Nov 06 '19 11:11 PuffTMD

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 

Juliehzl avatar Nov 07 '19 12:11 Juliehzl

yeah i get the correct output if i echo it as if i do when i run it manually

PuffTMD avatar Nov 07 '19 15:11 PuffTMD

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"

Juliehzl avatar Nov 08 '19 11:11 Juliehzl

Emailed you earlier today

PuffTMD avatar Nov 08 '19 19:11 PuffTMD

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 tsv returns the connection string without the double quotes. I had to then add in the double quotes when using the connection string.

PuffTMD avatar Nov 11 '19 08:11 PuffTMD

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.😊

Juliehzl avatar Nov 24 '19 13:11 Juliehzl