azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

Authentication fails using mlflow

Open TimonDaniels opened this issue 3 years ago • 13 comments

Hi,

I'm really new to azureml and I am trying to run some experiments using a remote compute cluster. I want to use mlflow to download files and check on jobs like so:

mlflow.set_tracking_uri(tracking_uri)
mlflow.set_experiment(experiment_name='my_experiment')

on this page they mention it will use "Interactive Authentication and hence no further action is required". But I always get the following error without any interactive authentication:

ChainedTokenCredential failed to retrieve a token from the included credentials.
Attempted credentials:
	EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
Visit https://aka.ms/azsdk/python/identity/environmentcredential/troubleshoot to troubleshoot.this issue.
	ManagedIdentityCredential: ManagedIdentityCredential authentication unavailable, no response from the IMDS endpoint.
	SharedTokenCacheCredential: Azure Active Directory error '(invalid_grant) AADSTS700082: The refresh token has expired due to inactivity. The token was issued on 2022-05-03T08:25:15.3234957Z and was inactive for 90.00:00:00.
Trace ID: 28dd8b29-7acc-486e-ac2c-df6ebfda4800
Correlation ID: 3fcc2282-4e5a-4fee-b08c-50b59d253ca9
Timestamp: 2023-03-24 14:29:54Z'

I am not really sure what to do. I tried setting the environment variables like below, by registering the mlflow_uri I found in the workspace to azureAD and creating a client secret but this gave me a error:403.

os.environ["AZURE_TENANT_ID"] = "<AZURE_TENANT_ID>"
os.environ["AZURE_CLIENT_ID"] = "<AZURE_CLIENT_ID>"
os.environ["AZURE_CLIENT_SECRET"] = "<AZURE_CLIENT_SECRET>"

can't figure out what I'm doing wrong. Any suggestions?

TimonDaniels avatar Mar 24 '23 14:03 TimonDaniels

Hi @TimonDaniels, thank you for opening an issue! The 403 error that you're seeing when attempting environment variable authentication means that the variables are being picked up, but authentication with the provided information failed.

I'm not sure what mlflow attempts to authenticate with so I unfortunately can't provide much more help, but I'll tag some folks from ML who can get back to you as soon as possible. cc @azureml-github

laiapat avatar Mar 24 '23 17:03 laiapat

Hi @TimonDaniels, thank you for opening an issue! The 403 error that you're seeing when attempting environment variable authentication means that the variables are being picked up, but authentication with the provided information failed.

I'm not sure what mlflow attempts to authenticate with so I unfortunately can't provide much more help, but I'll tag some folks from ML who can get back to you as soon as possible. cc @azureml-github

Thanks!

TimonDaniels avatar Mar 25 '23 17:03 TimonDaniels

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azureml-github, @Azure/azure-ml-sdk.

Issue Details

Hi,

I'm really new to azureml and I am trying to run some experiments using a remote compute cluster. I want to use mlflow to download files and check on jobs like so:

mlflow.set_tracking_uri(tracking_uri)
mlflow.set_experiment(experiment_name='my_experiment')

on this page they mention it will use "Interactive Authentication and hence no further action is required". But I always get the following error without any interactive authentication:

ChainedTokenCredential failed to retrieve a token from the included credentials.
Attempted credentials:
	EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured.
Visit https://aka.ms/azsdk/python/identity/environmentcredential/troubleshoot to troubleshoot.this issue.
	ManagedIdentityCredential: ManagedIdentityCredential authentication unavailable, no response from the IMDS endpoint.
	SharedTokenCacheCredential: Azure Active Directory error '(invalid_grant) AADSTS700082: The refresh token has expired due to inactivity. The token was issued on 2022-05-03T08:25:15.3234957Z and was inactive for 90.00:00:00.
Trace ID: 28dd8b29-7acc-486e-ac2c-df6ebfda4800
Correlation ID: 3fcc2282-4e5a-4fee-b08c-50b59d253ca9
Timestamp: 2023-03-24 14:29:54Z'

I am not really sure what to do. I tried setting the environment variables like below, by registering the mlflow_uri I found in the workspace to azureAD and creating a client secret but this gave me a error:403.

os.environ["AZURE_TENANT_ID"] = "<AZURE_TENANT_ID>"
os.environ["AZURE_CLIENT_ID"] = "<AZURE_CLIENT_ID>"
os.environ["AZURE_CLIENT_SECRET"] = "<AZURE_CLIENT_SECRET>"

can't figure out what I'm doing wrong. Any suggestions?

Author: TimonDaniels
Assignees: luigiw
Labels:

question, Machine Learning, Service Attention, customer-reported, needs-team-attention

Milestone: -

ghost avatar Apr 03 '23 19:04 ghost

I"m experiencing the identical issue trying to connect a local notebook session to mlflow server. I tried to find where to setup the tenant id/client key/secret and couldn't find how to do that without registering an app service which seemed wrong. Can provide more details if needed but essentially identical behaviour as @TimonDaniels and would like to get this up and running ASAP.

tieandrews avatar Apr 19 '23 07:04 tieandrews

I have the same problem, according to the information here it should work with Interactive or even AzureCli credentials, but the list of credentials attempted in the ChainedTokenCredential does not match the list here...

This works when running from an Azure ML compute but fails from my local laptop.

hugobettmach avatar May 26 '23 10:05 hugobettmach

Is there any update on this?

lnkirkham-datasparq avatar May 07 '24 17:05 lnkirkham-datasparq

Sorry for the delay in addressing this one. I will assign this issue to our MLFlow issue owner and they will investigate.

diondrapeck avatar May 13 '24 17:05 diondrapeck

We're looking into this and will get back to you as soon as possible.

kingernupur avatar May 17 '24 17:05 kingernupur

Any update on this?

hsuominen avatar Aug 02 '24 05:08 hsuominen

Sorry, its causing delay but we are working on it and will get back to you as soon as possible.

pdhotems avatar Aug 12 '24 02:08 pdhotems

I tried to reproduce the problem but unable to do so. I was able to connect to the workspace. I would suggest few solutions given below to connect to azure ml studio.

  • Try other login methods like -Use ml client and run command az login and then run the code. Installing ml client
  • When you create workspace make sure you have right authorization - link
  • Use latest version of mlflow and azureml-mlflow

I ran following code in order to create experiment on azure ml studio.

import mlflow
mlflow.set_tracking_uri("Get this URL from ml studio")
experiment_name = 'experiment_with_mlflow2'
mlflow.set_experiment(experiment_name)
mlflow.create_experiment(experiment_name)

If this does not help please elaborate the steps, code you are running.

pdhotems avatar Aug 12 '24 12:08 pdhotems

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

pdhotems avatar Aug 20 '24 05:08 pdhotems

Closing the issue due to no response

pdhotems avatar Aug 26 '24 10:08 pdhotems