Azure / Azure/azureml-examples
"ManagedIdentityCredential: Unexpected content type "text/html"" error during AzureMachineLearningFileSystem function call
- Dominant language
- Jupyter Notebook
- Stars
- 2k
- Forks
- 1.7k
- Avg merge
- 18h 18m
- Merged PRs (30d)
- 2
Description
### Operating System
Linux
### Version Information
Python version 3.8.17
azure-ai-ml package version 1.8.0
azureml-fsspec version 1.1.1
### Steps to reproduce
1. Initialize a AzureMachineLearningFileSystem object with an AML datastore URI, no other arguments.
2. Call a function of the filesystem object, such as .ls().
### Expected behavior
The AMLFS object uses DefaultAzureCredential to authenticate to AML successfully with the AzureCLICredential, after making attempts with other credentials in its list of credentials to try, including ManagedIdentityCredential.
### Actual behavior
The AMLFS object fails to authenticate with an EnvironmentCredential, then it attempts to authenticate with a ManagedIdentityCredential, and fails with the error: Unexpected content type "text/html". Authentication attempts cease and execution fails.
### Addition information
With this same setup, any time I use DefaultAzureCredential, I have to include the arg "exclude_managed_identity_credential=True", otherwise this same failure with the ManagedIdentityCredential will cause an error. This works for things like MLClient, where one can give it a credential to use when instantiating. To use an MLClient, for example, I could create a DefaultAzureCredential with "exclude_managed_identity_credential=True", then pass that credential into MLClient when initializing it. If I don't do this, I will get the same error when trying to do anything with the MLClient that required authentication. I'm also on USGovCloud.
It would be great if I could pass a credential to AzureMachineLearningFileSystem to use, or if I could tell it to skip the ManagedIdentityCredential attempt while authenticating. Is there a way to exert control over its authentication this way?
I submitted at ticket to the wrong place earlier today: https://github.com/Azure/azure-sdk-for-python/issues/34936
Contributor guide
Assessment
This issue has not been assessed yet.