[Bug] Certificate - Not able to retrieve token for user to call downstream graph api #219
Closed
2 of 8 tasks
Labels
Milestone
Which Version of Microsoft Identity Web are you using ?
Note that to get help, you need to run the latest version.
Microsoft.Identity.Web 0.1.5-preview
Where is the issue?
Is this a new or existing app?
a. The app is in production, and I have upgraded to a new version of Microsoft Identity Web.
Our existing Appservice (Asp.net core application) uses MSI to connect to keyvault.
When we call upon TokenAquisition to GetAcccessTokenforUserAsync, we get a failure
Repro
Expected behavior
Get an access token for user to call graph.
Actual behavior
Exception is thrown
DefaultAzureCredential authentication failed.
Additional context/ Logs / Screenshots
Stack Trace
Prior to using this nuget package. I had modified the library and used it like below.
The storageFlags are used since we don't have a user profile (available in appservice), and we store the token privately on the running app.
Taken from the Azure Appservice documentation
If you are deploying an ASP.NET Core application to be used with IIS, you will need to make sure to load the user profile otherwise you will get a cryptography exception. If you are using Azure WebApps, you can add the app setting WEBSITE_LOAD_USER_PROFILE with value 1 to load the user profile. A certificate that has a private key requires user profile and, by default, an Azure WebApp doesn’t create the user profile. This is only supported for Standard App Service plans and above
We create a clientConfidentialApplication with the provided cert above and acquire token as below
This had worked well for us. We are now looking to leverage the capabilities provided by Microsoft.Identity.Web. Any guidance on the above will be appreciated
The text was updated successfully, but these errors were encountered: