Neox.Aspire.Hosting.Auth.EntraId
1.0.0-preview.26403.7
dotnet add package Neox.Aspire.Hosting.Auth.EntraId --version 1.0.0-preview.26403.7
NuGet\Install-Package Neox.Aspire.Hosting.Auth.EntraId -Version 1.0.0-preview.26403.7
<PackageReference Include="Neox.Aspire.Hosting.Auth.EntraId" Version="1.0.0-preview.26403.7" />
<PackageVersion Include="Neox.Aspire.Hosting.Auth.EntraId" Version="1.0.0-preview.26403.7" />
<PackageReference Include="Neox.Aspire.Hosting.Auth.EntraId" />
paket add Neox.Aspire.Hosting.Auth.EntraId --version 1.0.0-preview.26403.7
#r "nuget: Neox.Aspire.Hosting.Auth.EntraId, 1.0.0-preview.26403.7"
#:package Neox.Aspire.Hosting.Auth.EntraId@1.0.0-preview.26403.7
#addin nuget:?package=Neox.Aspire.Hosting.Auth.EntraId&version=1.0.0-preview.26403.7&prerelease
#tool nuget:?package=Neox.Aspire.Hosting.Auth.EntraId&version=1.0.0-preview.26403.7&prerelease
Neox.Aspire.Hosting.Auth.EntraId
Aspire hosting helpers (AuthOps) that provision Entra ID app registrations via Microsoft Graph and inject workload credentials as Microsoft.Identity.Web environment variables (AzureAd__*).
Depends on Neox.Aspire.Hosting.Auth.Abstractions.
Quick start
var entra = builder.AddAuthProvider("auth-provider-entra")
.Entra(); // creates parameter auth-provider-entra-tenant-id (Choice of accessible tenants)
var web = entra.AddAppRegistration("web", "MyApp-Local")
.WithClientSecret() // opt-in: emit AzureAd__ClientSecret + UI create when app exists
.WithLocalhostRedirectUri(AuthApplicationType.Web, 7281, "/signin-oidc") // scheme: Https default; use Both for http+https
.WithSupportedAccounts(SupportedAccountsType.SingleTenant);
builder.AddProject<Projects.Api>("api")
.WithAuth(web); // also WaitFor(web) until the Auth app is Healthy
Then run aspire do / aspire deploy. Pipeline steps: prereq-auth-provider-entra-auth → prereq-providers-auth → prereq-{app}-auth → plan-{app}-auth → provision-{app}-auth → deploy-auth on each EntraAuthAppRegistrationResource. In-model WithApiPermission makes the consumer Auth app WaitFor the exposer (well-known Graph permissions do not).
Client secret (WithClientSecret)
// Default: auto parameter {provider}-{app}-client-secret under child {app}-clientsecret
web.WithClientSecret();
// Optional override (may include a default value)
var secret = builder.AddParameter("web-client-secret", secret: true);
web.WithClientSecret(secret);
Adds dashboard child resource {app}-clientsecret (e.g. appregistration-api-clientsecret) under the Auth app.
| Context | Behavior |
|---|---|
| Pipeline / CI | Resolves the secret parameter in memory for env when already provided (Parameters__* / deployment state). Does not call Graph addPassword. |
| AppHost run (dashboard) | When {app}-clientsecret is Waiting (parent Healthy, secret empty): notification as soon as InteractionService is available → prompt for secret name + lifetime (6 / 12 / 24 months) → Graph addPassword (EndDateTime) → persist one-shot value into AppHost secrets. Command Create client secret on {app}-clientsecret re-triggers the same path. |
Dashboard status (local run)
In Aspire run mode, Entra AuthOps resources start as Waiting, then publish Running + Healthy/Unhealthy from Microsoft Graph probes:
- Scopes / app roles / API permissions (
{app}-apiperm-{value}) — present on the Graph app (and Waiting while the parent app registration is not Healthy); API permissions check consumerrequiredResourceAccess {app}-clientsecret— Waiting until parent Healthy and secret set; Healthy when secret is in AppHost (not part of parent worst-wins)- App registrations — ClientId set and app exists; children (scopes, roles, API permissions) aggregated with worst-wins (Unhealthy > Waiting > Healthy)
- Provider — TenantId set; aggregates app registrations
auth-ops— aggregates Entra providers
Each Entra app registration exposes a dashboard command Provision app registration (provision-auth) that runs the same plan + provision path as the pipeline, then refreshes status.
Environment variables (Microsoft.Identity.Web)
| Env | Notes |
|---|---|
AzureAd__Instance |
https://login.microsoftonline.com/ (omit with IncludeInstance = false) |
AzureAd__TenantId |
from tenant parameter |
AzureAd__ClientId |
from app ClientId parameter |
AzureAd__ClientSecret |
when WithClientSecret is used, or IncludeClientSecret = true |
SPA escape hatch:
.WithAuth(spa, env =>
{
env.IncludeInstance = false;
env.Map(AuthOutput.TenantId, "VITE_ENTRA_TENANT_ID");
env.Map(AuthOutput.ClientId, "VITE_ENTRA_CLIENT_ID");
});
Sample AppHost
Under tests/auth-providers/sample-apphost/:
- WebAPI
api—GET /mevia Microsoft Graph - Blazor
blazor— Microsoft.Identity.Web login + call/me - Vite
ops— MSAL login + call/me
Spec
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Aspire.Hosting (>= 13.4.6)
- Aspire.Hosting.Azure (>= 13.4.6)
- Azure.Identity (>= 1.21.0)
- Azure.ResourceManager (>= 1.14.0)
- Microsoft.Graph (>= 6.2.0)
- Neox.Aspire.Hosting.Auth.Abstractions (>= 1.0.0-preview.26403.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview.26403.7 | 69 | 8/3/2026 |
| 1.0.0-preview.26402.6 | 67 | 8/2/2026 |
| 1.0.0-preview.26402.5 | 66 | 8/2/2026 |