-
Notifications
You must be signed in to change notification settings - Fork 378
Region Discovery Troubleshooting
Jean-Marc Prieur edited this page Oct 9, 2021
·
16 revisions
AAD is adding support for regional STS (ESTS-Regional). Currently only the service to service flow (client_credentials / AcquireTokenForClient) is available via opt-in only to first party apps.
For more details refer: https://aka.ms/msal/estsr/guidance
If you know the region - use it. If you don't know the region, MSAL can attempt auto-discovery. This works for some Azure systems, such as some VMs (through IMDS) and Azure Functions (using environment variables are defined). If the auto-detection fails, the non-regional authority is used.
// if app knows the region, use it as MSAL cannot always reliably detect it depending on the cases
string region = Config.AzureRegion ?? ConfidentialClientApplication.AttemptRegionDiscovery;
var cca = ConfidentialClientApplicationBuilder(client_id)
.WithAzureRegion(region)
.WithCertificate(x509cert)
.Build();
var result = await cca
.AcquireTokenForClient(scopes)
.WithAuthority(AzureCloud.PublicCloud) // The authority here should be tenanted authority in the format "https://login.microsoftonline.com/{TenantId}"
.WithSendX5C(true) // for SNI
.ExecuteAsync();AADSTS700023: Client assertion audience claim does not match Realm issuer. is thrown if an invalid regional authority is used.
- Home
- Why use MSAL.NET
- Is MSAL.NET right for me
- Scenarios
- Register your app with AAD
- Client applications
- Acquiring tokens
- MSAL samples
- Known Issues
- Acquiring a token for the app
- Acquiring a token on behalf of a user in Web APIs
- Acquiring a token by authorization code in Web Apps
- AcquireTokenInteractive
- WAM - the Windows broker
- .NET Core
- Maui Docs
- Custom Browser
- Applying an AAD B2C policy
- Integrated Windows Authentication for domain or AAD joined machines
- Username / Password
- Device Code Flow for devices without a Web browser
- ADFS support
- High Availability
- Regional
- Token cache serialization
- Logging
- Exceptions in MSAL
- Provide your own Httpclient and proxy
- Extensibility Points
- Clearing the cache
- Client Credentials Multi-Tenant guidance
- Performance perspectives
- Differences between ADAL.NET and MSAL.NET Apps
- PowerShell support
- Testing apps that use MSAL
- Experimental Features
- Proof of Possession (PoP) tokens
- Using in Azure functions
- Extract info from WWW-Authenticate headers
- SPA Authorization Code