Zemires.Aspire.Hosting.Zitadel 13.6.0-preview.2

This is a prerelease version of Zemires.Aspire.Hosting.Zitadel.
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
                    
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="Zemires.Aspire.Hosting.Zitadel" Version="13.6.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zemires.Aspire.Hosting.Zitadel" Version="13.6.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="Zemires.Aspire.Hosting.Zitadel" />
                    
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 Zemires.Aspire.Hosting.Zitadel --version 13.6.0-preview.2
                    
#r "nuget: Zemires.Aspire.Hosting.Zitadel, 13.6.0-preview.2"
                    
#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 Zemires.Aspire.Hosting.Zitadel@13.6.0-preview.2
                    
#: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=Zemires.Aspire.Hosting.Zitadel&version=13.6.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Zemires.Aspire.Hosting.Zitadel&version=13.6.0-preview.2&prerelease
                    
Install as a Cake Tool

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 SetOutput are persisted in the AppHost user secrets as Parameters:{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; SetOutput does not change it then.
  • If a callback throws or an output stays unset, the project goes to FailedToStart and 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

https://github.com/zemires/zemires-aspire

Product 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. 
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
13.6.0-preview.2 44 10/16/2026
13.6.0-preview.1 41 10/13/2026