Zemires.Aspire.Hosting.Zitadel
13.6.0-preview.2
dotnet add package Zemires.Aspire.Hosting.Zitadel --version 13.6.0-preview.2
NuGet\Install-Package Zemires.Aspire.Hosting.Zitadel -Version 13.6.0-preview.2
<PackageReference Include="Zemires.Aspire.Hosting.Zitadel" Version="13.6.0-preview.2" />
<PackageVersion Include="Zemires.Aspire.Hosting.Zitadel" Version="13.6.0-preview.2" />
<PackageReference Include="Zemires.Aspire.Hosting.Zitadel" />
paket add Zemires.Aspire.Hosting.Zitadel --version 13.6.0-preview.2
#r "nuget: Zemires.Aspire.Hosting.Zitadel, 13.6.0-preview.2"
#:package Zemires.Aspire.Hosting.Zitadel@13.6.0-preview.2
#addin nuget:?package=Zemires.Aspire.Hosting.Zitadel&version=13.6.0-preview.2&prerelease
#tool nuget:?package=Zemires.Aspire.Hosting.Zitadel&version=13.6.0-preview.2&prerelease
Zemires.Aspire.Hosting.Zitadel
An Aspire hosting integration for the Zitadel identity provider. Attach a Postgres database (container or Azure Postgres), add the login v2 UI and initialize a Zitadel project to consume directly from web apps and APIs.
Install the package
In your AppHost project:
dotnet add package Zemires.Aspire.Hosting.Zitadel
Example usage
var builder = DistributedApplication.CreateBuilder(args);
var database = builder.AddPostgres("postgres").AddDatabase("zitadel-db", "zitadel");
var zitadel = builder.AddZitadel("zitadel", port: 8501)
.WithExternalHttpEndpoints()
.WithDatabase(database)
.WithOrganizationName("ASPIRE")
.WithMachineUser()
.WithLoginClientKey();
// Optional: login v2 UI. Without it, login v1 is used.
zitadel.AddZitadelLoginClient("zitadel-login", port: 8503)
.WithExternalHttpEndpoints();
var project = zitadel.AddProject("zitadel-project", "Aspire")
.WithInitialization(async (options, resource) => { /* create apps, roles, ... via the Zitadel API client options */ });
builder.Build().Run();
Initialization outputs
Values created by an initialization callback (e.g. the client id and secret of an OIDC application) are passed to other resources as outputs. Declare them with GetOutput / GetSecretOutput and set them in the callback with context.SetOutput. They are resolved lazily: a consumer evaluated before the initialization has completed waits for the value (still use WaitFor(project), so a failed initialization stops the consumer).
var project = zitadel.AddProject("zitadel-project", "Aspire")
.WithInitialization(async context =>
{
// create the app with Clients.ManagementService(context.Options) ...
context.SetOutput("client-id", app.ClientId);
context.SetOutput("client-secret", app.ClientSecret);
});
builder.AddProject<Projects.WebApp>("webapp")
.WithEnvironment("Oidc__Authority", zitadel.Resource.PrimaryEndpoint)
.WithEnvironment("Oidc__ClientId", project.GetOutput("client-id"))
.WithEnvironment("Oidc__ClientSecret", project.GetSecretOutput("client-secret"))
.WaitFor(project);
- Values set with
SetOutputare persisted in the AppHost user secrets asParameters:{resource}-{output}(e.g.Parameters:zitadel-project-client-secret). On the next start,context.GetOutputValueAsync(name)returns the known value, and outputs not set again by the callback fall back to it — useful for secrets Zitadel only returns on creation. - The same configuration key can be set manually (user secrets, appsettings, environment) to provide a value.
WithOutput(name, parameter)binds an output to a parameter, e.g. for an existing application;SetOutputdoes not change it then.- If a callback throws or an output stays unset, the project goes to
FailedToStartand the output fails instead of resolving to an empty value.
WithMachineUser() and WithLoginClientKey() write the machine user key and login client PAT to .zitadel/{name}-keys in the AppHost directory; add .zitadel/ to .gitignore.
To call the Zitadel API from a service with the machine user, use zitadel.AddApiConnectionString() (connection string resource zitadel-api holding Endpoint=...;ServiceAccountKey=<base64 key>) and AddZitadelApi("zitadel-api") from Zemires.Aspire.Zitadel.
Further options: WithExternalDomain, WithCertificate, WithHostPort, WithOtlpExporter, WithInitialization. Initialization callbacks receive ready-to-use Zitadel API client options (authenticated as the machine user).
See https://zitadel.com/docs/guides/overview.
Feedback & contributing
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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.6.1)
- Aspire.Hosting.PostgreSQL (>= 13.6.1)
- AspNetCore.HealthChecks.NpgSql (>= 9.0.0)
- MessagePack (>= 2.5.307)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.13)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.13)
- Microsoft.Extensions.Hosting (>= 10.0.13)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Http (>= 10.0.13)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.20.0)
- OpenTelemetry.Extensions.Hosting (>= 1.20.0)
- System.IO.Hashing (>= 10.0.13)
- Zitadel (>= 7.0.44)
-
net8.0
- Aspire.Hosting (>= 13.6.1)
- Aspire.Hosting.PostgreSQL (>= 13.6.1)
- AspNetCore.HealthChecks.NpgSql (>= 9.0.0)
- MessagePack (>= 2.5.307)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.13)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.13)
- Microsoft.Extensions.Hosting (>= 10.0.13)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Http (>= 10.0.13)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.20.0)
- OpenTelemetry.Extensions.Hosting (>= 1.20.0)
- System.IO.Hashing (>= 10.0.13)
- Zitadel (>= 7.0.44)
-
net9.0
- Aspire.Hosting (>= 13.6.1)
- Aspire.Hosting.PostgreSQL (>= 13.6.1)
- AspNetCore.HealthChecks.NpgSql (>= 9.0.0)
- MessagePack (>= 2.5.307)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.13)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.13)
- Microsoft.Extensions.Hosting (>= 10.0.13)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Http (>= 10.0.13)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.20.0)
- OpenTelemetry.Extensions.Hosting (>= 1.20.0)
- System.IO.Hashing (>= 10.0.13)
- Zitadel (>= 7.0.44)
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 |
|---|---|---|
| 13.6.0-preview.2 | 44 | 10/16/2026 |
| 13.6.0-preview.1 | 41 | 10/13/2026 |