Skip to content

AZ ML CLI login issue with MSI #2461

@tommivikkula

Description

@tommivikkula
  • If the issue is to do with Azure CLI 2.0 in-particular, create an issue here at Azure/azure-cli

Extension name (the extension in question)

azure-cli-ml

Description of issue (in as much detail as possible)

I'm trying to run a azure ml cli command using MSI identity the following way in a Azure VM (during a CICD pipeline run):

az login --identity ...
az ml datastore attach-blob -a ... \
                                  -c ... \
                                  -n ... \
                                  -w ... \
                                  -g ... \
				--storage-account-subscription-id ... \
				--storage-account-resource-group ...

And getting this error:

msrestazure.azure_active_directory : MSI: Token retrieved
cli.azure.cli.core.util : AuthenticationException:
	Message: Could not retrieve user token. Please run 'az login'
	InnerException 'MSIAuthentication' object has no attribute '_token_retriever'
	ErrorResponse 
{
    "error": {
        "code": "UserError",
        "inner_error": {
            "code": "Authentication"
        },
        "message": "Could not retrieve user token. Please run 'az login'"
    }
}
AuthenticationException:
	Message: Could not retrieve user token. Please run 'az login'
	InnerException 'MSIAuthentication' object has no attribute '_token_retriever'
	ErrorResponse 
{
    "error": {
        "code": "UserError",
        "inner_error": {
            "code": "Authentication"
        },
        "message": "Could not retrieve user token. Please run 'az login'"
    }
}
az_command_data_logger : exit code: 1

I get this similar error in other Azure ML CLI commands like az ml computetarget create amlcompute ...

Versions used:

azure-cli                      2.12.0
azure-cli-ml                   1.14.0

However this was reproduceable at least with azure-cli 2.11.3 and 2.10.1

az login is working fine. This I know because ordinary Azure CLI commands are ran successfully during the same AZDO pipeline run in the same VM. Commands like this:

# This is working fine
az storage container list --auth-mode login ...

I also ran the same az ml datastore attach-blob commands locally using az login with my own user credentials (and same az-cli, az-ml-cli versions). These commands worked fine. This leads me to believe this issue concerns az ml cli and when using msi authentication


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions