Share via

DefaultAzureCredential failed to retrieve a token from the included credentials.

AdityaSa 801 Reputation points
2022-12-15T03:53:59.927+00:00

Hi, While trying authentication in AzureML SDK v2 the DefaultAzureCredential failed to retrieve a token from the included credentials. Attempted credentials: EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured.

Azure Machine Learning

Answer accepted by question author
  1. Ramr-msft 17,836 Reputation points
    2022-12-15T05:50:38.317+00:00

    @AdityaSa Thanks for the question. Hers is the Troubleshooting guide for Default Azure credential errors.

    from azure.core.exceptions import ClientAuthenticationError
    from azure.identity import DefaultAzureCredential
    from azure.keyvault.secrets import SecretClient

    # Create a secret client using the DefaultAzureCredential  
    client = SecretClient("https://myvault.vault.azure.net/", DefaultAzureCredential())  
    try:  
        secret = client.get_secret("secret1")  
    except ClientAuthenticationError as ex:  
        print(ex.message)  
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.