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

Authentication Error while running MLflow with Docker and AML tracking `InteractiveBrowserCredential.get_token failed: Failed to open a browser`

Open fschlz opened this issue 2 years ago • 6 comments

  • Package Name: azureml-mlflow
  • Package Version: 1.55.0
  • Operating System: macOS Sonoma
  • Python Version: 3.10

Describe the bug I'm trying to track my model runs via AzureML using its the MLflow tracking URI, but unfortunately I get this error:

InteractiveBrowserCredential.get_token failed: Failed to open a browser

When I then ctrl+C out of the mlflow run I get this traceback:

^CTo sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXXX to authenticate.
Traceback (most recent call last):
  File "/app/mlflow_template_repo/train.py", line 51, in <module>
    with mlflow.start_run():
  File "/app/.venv/lib/python3.10/site-packages/mlflow/tracking/fluent.py", line 322, in start_run
    active_run_obj = client.get_run(existing_run_id)
  File "/app/.venv/lib/python3.10/site-packages/mlflow/tracking/client.py", line 186, in get_run
    return self._tracking_client.get_run(run_id)
  File "/app/.venv/lib/python3.10/site-packages/mlflow/tracking/_tracking_service/client.py", line 76, in get_run
    return self.store.get_run(run_id)
  File "/app/.venv/lib/python3.10/site-packages/mlflow/store/tracking/rest_store.py", line 144, in get_run
    response_proto = self._call_endpoint(GetRun, req_body)
  File "/app/.venv/lib/python3.10/site-packages/mlflow/store/tracking/rest_store.py", line 60, in _call_endpoint
    return call_endpoint(self.get_host_creds(), endpoint, method, json_body, response_proto)
  File "/app/.venv/lib/python3.10/site-packages/azureml/mlflow/_store/azureml_reststore.py", line 68, in get_host_credentials
    auth_header = self.service_context.auth.get_token(
  File "/app/.venv/lib/python3.10/site-packages/azure/identity/_credentials/chained.py", line 94, in get_token
    token = credential.get_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
  File "/app/.venv/lib/python3.10/site-packages/azure/identity/_internal/interactive.py", line 169, in get_token
    result = self._request_token(*scopes, claims=claims, tenant_id=tenant_id, enable_cae=enable_cae, **kwargs)
  File "/app/.venv/lib/python3.10/site-packages/azure/identity/_internal/decorators.py", line 79, in wrapper
    return fn(*args, **kwargs)
  File "/app/.venv/lib/python3.10/site-packages/azure/identity/_credentials/device_code.py", line 111, in _request_token
    result = app.acquire_token_by_device_flow(flow, claims_challenge=kwargs.get("claims"))
  File "/app/.venv/lib/python3.10/site-packages/msal/application.py", line 2138, in acquire_token_by_device_flow
    response = _clean_up(self.client.obtain_token_by_device_flow(
  File "/app/.venv/lib/python3.10/site-packages/msal/oauth2cli/oauth2.py", line 389, in obtain_token_by_device_flow
    time.sleep(1)  # Shorten each round, to make exit more responsive
KeyboardInterrupt

Notice that the To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXX to authenticate. only got printed to the console after I killed the process.

To Reproduce

Steps to reproduce the behavior:

  1. Using this example https://github.com/mlflow/mlflow/blob/master/examples/docker/README.rst
  2. Set the MLFLOW_TRACKING_URI environment variable in the terminal
  3. call mlflow run . -P alpha=0.3

Expected behavior

I would assume that this should be printed earlier. But, since I am running the training in a container, this might be pat of the issue as there is no browser installed. I also reckon that there's something off with the azureml-mlflow package (@azureml-github) because of the hidden devicelogin print out.

Related issue: https://github.com/Azure/azure-sdk-for-python/issues/28000

fschlz avatar Apr 11 '24 12:04 fschlz

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

github-actions[bot] avatar Apr 11 '24 15:04 github-actions[bot]

Thank you for bringing this to our attention. I'll assign this to the MLFlow team so that they can investigate and continue the discussion.

diondrapeck avatar May 22 '24 16:05 diondrapeck

Thanks for bringing this up. We are currently working on it, and we will get back to as soon as possible.

pdhotems avatar Jun 03 '24 04:06 pdhotems

Could you please share if MLFLOW_TRACKING_URI is localhost or ml studio workspace URL?

pdhotems avatar Jun 19 '24 12:06 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 Jun 28 '24 10:06 pdhotems

Closing the issue due to no response

pdhotems avatar Jul 17 '24 09:07 pdhotems