0

I am trying to authenticate the Azure ML Client through the following code running on Spark cluster:

os.environ["AZURE_ML_CLI_PRIVATE_FEATURES_ENABLED"] = "true"
os.environ["AZURE_SUBSCRIPTION_ID"] = subscription_id
os.environ["AZURE_RESOURCE_GROUP"] = resource_group
os.environ["AZURE_CLIENT_ID"] = client_id
os.environ["AZURE_TENANT_ID"] = tenant_id
os.environ["AZURE_CLIENT_SECRET"] = client_secret

credential = DefaultAzureCredential(managed_identity_client_id=client_id)
credential.get_token("https://management.azure.com/.default", tenant_id = tenant_id )
ml_client = MLClient(credential, subscription_id, resource_group, workspace_name)

The first time, it asks me to log in through the browser.

Resolving access token for scope "https://storage.azure.com/.default" using identity of type "USER". InteractiveBrowserCredential.get_token failed: Failed to open a browser To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code

Then, the second time I run the code, it goes through the authentication without asking to log in from the browser again.

How do you ensure the browser login is not popping up, and it can authenticate transparently?

Thanks

Cengiz
  • 303
  • 2
  • 9

0 Answers0