Azure / Azure/azure-cli-extensions

Enable MSI Auth for az storage azcopy --auth-mode login

Open
#3,863 1 comment 0 reactions 1 assignee Claimed by @evelyn-ys View on GitHub
feature-request Storage
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

- If the issue is to do with Azure CLI 2.0 in-particular, create an issue here at [Azure/azure-cli](https://github.com/Azure/azure-cli/issues)

### Extension name (the extension in question)

azcopy

### Description of issue (in as much detail as possible)

-----

When using a MSI for --auth-mode login to do `az storage azcopy` commands, I get an error that MSI auth not yet supported.

ERROR: MSI auth not yet supported.
Traceback (most recent call last):
File "/azp/_work/_temp/.azclitask/cliextensions/storage-preview/azext_storage_preview/azcopy/util.py", line 81, in blob_client_auth_for_azcopy
token_info = _unserialize_non_msi_token_payload(token_info)
File "/azp/_work/_temp/.azclitask/cliextensions/storage-preview/azext_storage_preview/azcopy/util.py", line 108, in _unserialize_non_msi_token_payload
'refresh_token': token_info['refreshToken'],
KeyError: 'refreshToken'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 657, in execute
raise ex
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 720, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 712, in _run_job
return cmd_copy.exception_handler(ex)
File "/azp/_work/_temp/.azclitask/cliextensions/storage-preview/azext_storage_preview/__init__.py", line 252, in new_handler
handler(ex)
File "/azp/_work/_temp/.azclitask/cliextensions/storage-preview/azext_storage_preview/__init__.py", line 194, in handler
raise ex
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 691, in _run_job
result = cmd_copy(params)

File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
return self.handler(*args, **kwargs)
File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/azp/_work/_temp/.azclitask/cliextensions/storage-preview/azext_storage_preview/operations/azcopy.py", line 24, in storage_blob_download
azcopy = _azcopy_blob_client(cmd, client)
File "/azp/_work/_temp/.azclitask/cliextensions/storage-preview/azext_storage_preview/operations/azcopy.py", line 65, in _azcopy_blob_client
return AzCopy(creds=blob_client_auth_for_azcopy(cmd, client))
File "/azp/_work/_temp/.azclitask/cliextensions/storage-preview/azext_storage_preview/azcopy/util.py", line 83, in blob_client_auth_for_azcopy
raise Exception('MSI auth not yet supported.')
Exception: MSI auth not yet supported.
To open an issue, please run: 'az feedback'
Namespace(_argument_validators=[, ], _cmd=, _command_package='storage', _command_validator=None, _log_verbosity_debug=False, _log_verbosity_only_show_errors=False, _log_verbosity_verbose=False, _output_format='json', _parser=AzCliCommandParser(prog='az storage azcopy blob download', usage=None, description='', formatter_class=, conflict_handler='error', add_help=True), _subcommand='download', _subscription=None, account_key=None, account_name='acctname', cmd=, command='storage azcopy blob download', connection_string=None, destination='/azp/_work/1/s/dest', func=, recursive=True, sas_token=None, source=' https://accountname.blob.core.windows.net/container/file.csv', token_credential=) `

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.