The following steps for updating code apply across all the confidential client scenarios:
- Add the MSAL.NET namespace in your source code:
using Microsoft.Identity.Client;
. - Instead of instantiating
AuthenticationContext
, useConfidentialClientApplicationBuilder.Create
to instantiateIConfidentialClientApplication
. - Instead of the
resourceId
string, MSAL.NET uses scopes. Because applications that use ADAL.NET are preauthorized, you can always use the following scopes:new string[] { $"{resourceId}/.default" }
. - Replace the call to
AuthenticationContext.AcquireTokenAsync
with a call toIConfidentialClientApplication.AcquireTokenXXX
, where XXX depends on your scenario.