Hello @HASLEHNER, MYLENE
Thanks for reaching out to us.
The error message you received indicates that the Azure ML SDK was unable to retrieve a token from the included credentials. This can happen if the credentials you are using are invalid or if there is an issue with the authentication process.
To resolve this issue, you can try the following steps**:**
Check that you have the correct credentials for your Azure account. You can do this by logging into the Azure portal and checking the credentials for your account.
If you are using a service principal for authentication, make sure that the service principal has the correct permissions to access the resources you are trying to use.
Check that your environment variables are set correctly. You can set environment variables in the notebook by using the os module. For example, to set the AZURE_CLIENT_ID environment variable, you can use the following command:
import os
os.environ['AZURE_CLIENT_ID'] = ''
Replace with the actual client ID for your Azure account.
If you continue to experience issues, you may want to try using a different authentication method, such as interactive authentication or managed identity.
It's difficult to say exactly which commands in the notebook need to be written to avoid this error without seeing the notebook itself. However, you can try setting the environment variables as described above and see if that resolves the issue.
Let me know how it works. I am happy to help you further.
Regards,
Yutong
-Please kindly accept the answer and vote 'Yes' if you feel helpful to support the community, thanks a lot.
Answer from YutongTie-9091 on learn.microsoft.comHello @HASLEHNER, MYLENE
Thanks for reaching out to us.
The error message you received indicates that the Azure ML SDK was unable to retrieve a token from the included credentials. This can happen if the credentials you are using are invalid or if there is an issue with the authentication process.
To resolve this issue, you can try the following steps**:**
Check that you have the correct credentials for your Azure account. You can do this by logging into the Azure portal and checking the credentials for your account.
If you are using a service principal for authentication, make sure that the service principal has the correct permissions to access the resources you are trying to use.
Check that your environment variables are set correctly. You can set environment variables in the notebook by using the os module. For example, to set the AZURE_CLIENT_ID environment variable, you can use the following command:
import os
os.environ['AZURE_CLIENT_ID'] = ''
Replace with the actual client ID for your Azure account.
If you continue to experience issues, you may want to try using a different authentication method, such as interactive authentication or managed identity.
It's difficult to say exactly which commands in the notebook need to be written to avoid this error without seeing the notebook itself. However, you can try setting the environment variables as described above and see if that resolves the issue.
Let me know how it works. I am happy to help you further.
Regards,
Yutong
-Please kindly accept the answer and vote 'Yes' if you feel helpful to support the community, thanks a lot.
Hi,
Thank you for you answer! I cannot find my client ID. The only thing I find is a
"tenant ID" in the folder Tenant details in Azure Active Directory. Is this the desired ID?
Thanks
This error can also occur if Visual Studio loses it's Azure Service Authentication connection for some reason or your actual AD credentials have changed (for example a password change).
In this case, simply signing in again has fixed this for me:
In Visual Studio, go to Tools > Options. Expand "Azure Service Authentication" > "Account Selection." If you see a "Reenter your credentials" link, click it and sign in again. If not, try a regular sign-out + sign-in via your Visual Studio profile in the top right.

Could you validate that you are setting the following system environment variables?
AZURE_CLIENT_ID - service principal's app id
AZURE_TENANT_ID - id of the principal's Azure Active Directory tenant
AZURE_CLIENT_SECRET - one of the service principal's client secrets
Hi
I have deployed a docker image in my azure app service and I am using below code to connect my key vault:
credential = DefaultAzureCredential() client = SecretClient(vault_url=KV_URI, credential=credential) secret = client.get_secret(secret_name)
But I am getting this error:
ERROR:root:Error fetching secrets from key vault : DefaultAzureCredential 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: SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache. AzureCliCredential: Please run 'az login' to set up an account AzurePowerShellCredential: PowerShell is not installed AzureDeveloperCliCredential: Azure Developer CLI could not be found. Please visit for installation instructions and then,once installed, authenticate to your Azure account using 'azd auth login'.https://aka.ms/azsdk/python/identity/environmentcredential/troubleshoothttps://aka.ms/azure-dev
I have created a user assigned managed identity, assigned that UAMI to my app service, provided 'key vault secret user' access to that UAMI.
Also, the same code and access are working on QA environment but not on UAT so I am unable to find the core problem.
Can anyone please help me with this?
Thanks
I am posting this in the hopes that it helps someone with this frustrating issue.
If you are using Azure App Authentication in your .NET app to remove sensitive credentials from your web.config/app.config files, you may have run into this issue:
You start debugging your app and get the following exception:
[CredentialUnavailableException: DefaultAzureCredential failed to retrieve a token from the included credentials. EnvironmentCredential authentication unavailable. Environment variables are not fully configured. ManagedIdentityCredential authentication unavailable, no managed identity endpoint found. SharedTokenCacheCredential authentication unavailable. Token acquisition failed for user . Ensure that you have authenticated with a developer tool that supports Azure single sign on.]
Before pulling your hair out, try these steps:
-
In Visual Studio, go to Tools -> Options
-
Select "Account Selection" under "Azure Service Authentication"
-
After selecting, you should see an area that says "Choose an account:" with a dropdown list of accounts you've used.
-
(If you don't see "Reenter your credentials", go to Step #5) Right under this box, if you see "Reenter your credentials", click the link and follow the prompts. You should end up back on the same screen when you're done and the message should be gone.
-
Click the dropdown, revealing the menu with a list of accounts and a button "Add an account...".
-
Click "Add an account..."
-
In the next pop-up, select "Use another account", even if you see the account you want to use in the list.
-
Enter the email address & credentials of your account like normal and authenticate.
-
Click "OK" and attempt to debug again.
The issue seems to be related to 2FA when enabled in your Azure tenant. If you do not have 2FA enabled (you should...), you may not have this problem.
I spent countless hours trying to resolve this issue and it seemed completely random when this error would occur (I believe it's when the 2FA token expires and fails to automatically request a new token). I hope this helps someone else and saves a few hours of frustration. :)
PS - If you are on Step #4 and you can see the "Reenter your credentials" link, but when clicking it, nothing happens... go to Step #5 and complete to Step #8. After this, click the "Reenter..." link again and it should work, prompting you for your account information again. Follow these prompts and you're done.




