How do you secure a .NET app using Azure AD?
- Use Microsoft.Identity.Web for ASP.NET Core.
- Configure authentication in Program.cs:
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationS
cheme)
.AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureA
d"));
app.UseAuthentication();
app.UseAuthorization();
- Tokens from Azure AD validate API requests.