Neox.Aspire.Hosting.Auth.EntraId 1.0.0-preview.26403.7

This is a prerelease version of Neox.Aspire.Hosting.Auth.EntraId.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Neox.Aspire.Hosting.Auth.EntraId" Version="1.0.0-preview.26403.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Neox.Aspire.Hosting.Auth.EntraId" Version="1.0.0-preview.26403.7" />
                    
Directory.Packages.props
<PackageReference Include="Neox.Aspire.Hosting.Auth.EntraId" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
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"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Neox.Aspire.Hosting.Auth.EntraId@1.0.0-preview.26403.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Neox.Aspire.Hosting.Auth.EntraId&version=1.0.0-preview.26403.7&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Neox.Aspire.Hosting.Auth.EntraId&version=1.0.0-preview.26403.7&prerelease
                    
Install as a Cake Tool

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-authprereq-providers-authprereq-{app}-authplan-{app}-authprovision-{app}-authdeploy-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 consumer requiredResourceAccess
  • {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 apiGET /me via Microsoft Graph
  • Blazor blazor — Microsoft.Identity.Web login + call /me
  • Vite ops — MSAL login + call /me

Spec

See specs/features/auth-providers.md.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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