az storage fs command crashes when run with AZURE_STORAGE_CONNECTION_STRING env variable
Describe the bug
Command Name
az storage fs access show
Errors:
from_connection_string() missing 1 required positional argument: 'conn_str'
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 654, in execute
raise ex
...
cli/command_modules/storage/_client_factory.py, ln 231, in cf_adls_service
return t_adls_service.from_connection_string(connection_string=connection_string)
TypeError: from_connection_string() missing 1 required positional argument: 'conn_str'
To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.
- Put any pre-requisite steps here...
- `export AZURE_STORAGE_CONNECTION_STRING=$(az storage account show-connection-string --subscription XXX --name YYY | jq .connectionString)
az storage fs access show -f {} -p {}
Expected Behavior
Environment Summary
macOS-10.15.3-x86_64-i386-64bit
Python 3.8.3
Installer: HOMEBREW
azure-cli 2.8.0
Extensions:
azure-firewall 0.3.0
aks-preview 0.4.52
azure-devops 0.18.0
resource-graph 1.0.0
storage-preview 0.2.10
Additional Context
add to S173
@yonzhan this is not a feature-request but a bug
stacktrace:
from_connection_string() missing 1 required positional argument: 'conn_str'
Traceback (most recent call last):
File "/usr/local/Cellar/azure-cli/2.8.0/libexec/lib/python3.8/site-packages/knack/cli.py", line 215, in invoke
cmd_result = self.invocation.execute(args)
File "/usr/local/Cellar/azure-cli/2.8.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 654, in execute
raise ex
File "/usr/local/Cellar/azure-cli/2.8.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 718, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/usr/local/Cellar/azure-cli/2.8.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 711, in _run_job
six.reraise(*sys.exc_info())
File "/usr/local/Cellar/azure-cli/2.8.0/libexec/lib/python3.8/site-packages/six.py", line 703, in reraise
raise value
File "/usr/local/Cellar/azure-cli/2.8.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 688, in _run_job
result = cmd_copy(params)
File "/usr/local/Cellar/azure-cli/2.8.0/libexec/lib/python3.8/site-packages/azure/cli/core/commands/__init__.py", line 325, in __call__
return self.handler(*args, **kwargs)
File "/usr/local/Cellar/azure-cli/2.8.0/libexec/lib/python3.8/site-packages/azure/cli/core/__init__.py", line 536, in default_command_handler
client = client_factory(cmd.cli_ctx, command_args) if client_factory else None
File "/usr/local/Cellar/azure-cli/2.8.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/storage/_client_factory.py", line 246, in cf_adls_directory
return cf_adls_file_system(cli_ctx, kwargs).get_directory_client(directory=kwargs.pop('directory_path'))
File "/usr/local/Cellar/azure-cli/2.8.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/storage/_client_factory.py", line 242, in cf_adls_file_system
return cf_adls_service(cli_ctx, kwargs).get_file_system_client(file_system=kwargs.pop('file_system_name'))
File "/usr/local/Cellar/azure-cli/2.8.0/libexec/lib/python3.8/site-packages/azure/cli/command_modules/storage/_client_factory.py", line 231, in cf_adls_service
return t_adls_service.from_connection_string(connection_string=connection_string)
TypeError: from_connection_string() missing 1 required positional argument: 'conn_str'
thanks for feedback. fixed in https://github.com/Azure/azure-cli/pull/13273. please try with latest azure cli.
I'm having the exact same problem with the latest version:
$ az version
{
"azure-cli": "2.11.1",
"azure-cli-core": "2.11.1",
"azure-cli-telemetry": "1.0.6",
"extensions": {}
}
Running this with Python 3.7.3. ~It seems to work on one machine, but not on the other, for some reason~ (this turns out to be because of environment variables that I overlooked). I've tried syncing up package versions, but haven't been able to narrow down the culprit. It happens on a completely fresh environment too. It seems to only have trouble with the connection string, other auth forms are ok.
On a side-note: imho it is very confusing that the cli silently takes env variables as leading over any parameters set in the actual az command. If I set the access key or connection string explicitly in the command, I would expect the cli to use that. Right now (as far as I can tell) the environment variable's value overrules everything