entra-id-aspire-authentication

Integrates Microsoft Entra ID authentication into .NET Aspire apps via Microsoft.Identity.Web.

785|271|Updated Feb 18, 2020
One-click install
npx skills add https://github.com/AzureAD/microsoft-identity-web --skill entra-id-aspire-authentication
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: entra-id-aspire-authentication
Source: https://github.com/AzureAD/microsoft-identity-web/tree/main/.github/skills/entra-id-aspire-authentication
Command: npx skills add https://github.com/AzureAD/microsoft-identity-web --skill entra-id-aspire-authentication

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you add Microsoft Entra ID (Azure AD) authentication to .NET Aspire applications, enabling secure sign-in and API access using Microsoft.Identity.Web, OpenID Connect, and token acquisition.

Core Features & Use Cases

  • Integrate Azure AD authentication into Aspire APIs and Web/Blazor apps using AddMicrosoftIdentityWebApp and AddMicrosoftIdentityWebApi.
  • Enable token acquisition for downstream API calls and support for incremental consent and Conditional Access in Blazor Server scenarios.
  • Align with a two-phase workflow: Phase 1 wires authentication code into the app with placeholder values; Phase 2 provisions real Entra ID app registrations and updates configuration via the ente-id-aspire-provisioning process.

Quick Start

Phase 1: Add authentication code with placeholder values so the Aspire app builds but does not run. Phase 2: Use ente-id-aspire-provisioning to create Entra ID app registrations and update appsettings.json with real Client IDs and a client secret.

Frequently Asked Questions about entra-id-aspire-authentication

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add Entra ID authentication to a .NET Aspire application?

Add Entra ID authentication to Aspire apps using Microsoft.Identity.Web by integrating AddMicrosoftIdentityWebApp for web apps or AddMicrosoftIdentityWebApi for APIs. Start with placeholder client IDs and secrets in Phase 1, then provision real Entra ID app registrations in Phase 2 using the ente-id-aspire-provisioning process.

Does Microsoft.Identity.Web support OpenID Connect sign-in in Aspire?

Yes, Microsoft.Identity.Web supports OpenID Connect sign-in for Aspire applications. It handles the complete authentication flow and enables token acquisition for downstream API calls, supporting incremental consent and Conditional Access in Blazor Server scenarios.

What's the workflow for setting up Azure AD authentication in Aspire apps?

Follow a two-phase workflow: Phase 1 wires authentication code into your Aspire app with placeholder values so it builds. Phase 2 uses ente-id-aspire-provisioning to create Entra ID app registrations and updates appsettings.json with real client IDs and secrets.

Can I use Entra ID for both API and web app authentication in the same Aspire project?

Yes, Microsoft.Identity.Web lets you integrate Entra ID into both Aspire APIs and web or Blazor apps within the same project. Use AddMicrosoftIdentityWebApi for APIs and AddMicrosoftIdentityWebApp for web applications.

How do I acquire tokens for downstream API calls in Entra ID-protected Aspire apps?

Microsoft.Identity.Web handles token acquisition for downstream API calls in Aspire applications. It manages the token lifecycle and integrates with Blazor Server to support incremental consent and Conditional Access policies.

What configuration do I need before deploying Entra ID authentication to Aspire?

Before deployment, complete Phase 2 provisioning: create Entra ID app registrations via ente-id-aspire-provisioning and populate appsettings.json with your client ID and client secret. The app builds in Phase 1 with placeholders but requires real values to run.