duendesoftware/duende-skills/identityserver-duende-storage
Claude Code and agent skill by duendesoftware/duende-skills
- community
Checking that the SKILL.md file is still in the repository.
Duende Storage (preview) persistence provider for IdentityServer: AddStorage with SQL Server/PostgreSQL/Oracle/SQLite, AddConfigurationStorage/AddOperationalStorage, multiple storage instances, configuration admin APIs (IClientAdmin etc.), data extension schemas, schema migration/CLI, purge options, sharing with User Management, and migrating from Entity Framework Core.
Install
npx vskill@latest install duendesoftware/duende-skills/identityserver-duende-storageSKILL.md
The same SKILL.md was published earlier as duendesoftware/duende-skills/identityserver-duende-storage.
Duende Storage (Preview)
When to Use This Skill
- Choosing Duende Storage vs Entity Framework Core vs in-memory vs custom stores
- Registering
AddStorage(...),AddConfigurationStorage(),AddOperationalStorage() - Creating/updating clients, scopes, resources and dynamic providers through admin service APIs
- Adding schema-validated custom properties (data extension schemas) to clients/resources/providers
- Routing configuration / operational / User Management data to separate databases (storage instances)
- Deploying/migrating the Duende Storage schema (including the Duende CLI)
- Planning a migration from EF Core stores
Core Principles
- Preview: packages (
--prerelease), APIs, schemas and behavior may change before GA. Introduced with IdentityServer 8.1 previews. - Opt-in, does not replace EF Core. The EF Core provider (classic tables) stays fully supported. Adopt Duende Storage only for what it adds: supported admin APIs, schema-validated custom properties, consistent querying + optimistic concurrency across databases, storage pools (for Spaces), shared persistence across Duende products (e.g. User Management).
- `AddStorage(...)` only selects a database provider for an instance. It does not store anything by itself. Call
AddConfigurationStorage()andAddOperationalStorage()to route data categories to it. - Store interfaces (
IClientStore,IResourceStore, …) are unchanged: the runtime keeps using the same abstractions. - Docs: https://docs.duendesoftware.com/identityserver/data/providers/duende-storage/
Packages
| Database | Package | Registration | |
|---|---|---|---|
| SQL Server | Duende.Storage.MsSql | AddMsSql | |
| PostgreSQL | Duende.Storage.PostgreSql | AddPostgreSql | |
| Oracle | Duende.Storage.Oracle | AddOracle | |
| SQLite | Duende.Storage.Sqlite | AddSqlite (AddSqliteInMemory for tests) |
Registration
AddConfigurationStorage()registersIClientStore,IResourceStore,IIdentityProviderStore,ISamlServiceProviderStore,ICorsPolicyServiceand the configuration admin APIs.AddOperationalStorage()registersIPersistedGrantStore,IDeviceFlowStore,IPushedAuthorizationRequestStore,IServerSideSessionStore,ISigningKeyStore,ISamlSigninStateStore,ISamlLogoutSessionStore. Still callAddServerSideSessions()separately to enable server-side sessions.- Override a single store by registering it after:
.AddConfigurationStorage().AddOperationalStorage().AddInMemoryClients(clients)replaces only the client store. - SQL Server/PostgreSQL/Oracle use provider-native connection factory / data source registrations (e.g.
NpgsqlDataSource,CreateSqlConnection). Keep credentials in a secret store.
Purge
A background purge service runs against every registered storage instance: enabled by default, hourly, BatchSize 100, fuzzed start. Configure StoragePurgeOptions (PurgeInterval, BatchSize, EnablePurge = false when an external job owns cleanup) via builder.Services.Configure<StoragePurgeOptions>(...) before AddOperationalStorage().
Schema Deployment
IStorageInstanceSchema.MigrateAsynccreates/upgrades the common schema; needs DDL permissions. Fine in development; in production run it as a controlled deployment step so the runtime identity can have narrower permissions. Run only one migration process at a time; after migrating it verifies the DB matches the expected schema.Duende.Cli(preview):dotnet tool install --global Duende.Cli --prerelease, thenduende storage migrate --provider mssql --dry-runthen without--dry-run. Connection string viaDUENDE_STORAGE_CONNECTION_STRING. Providers:mssql,postgresql,sqlite(add--schemafor non-default SQL Server/PostgreSQL schema). It downloads/cachesDuende.Storage.CliPluginfrom NuGet on first use. Oracle is not supported by the CLI: useIStorageInstanceSchema.BuildMigrationScriptand have a DBA apply the SQL.- Never hide a missing connection string or continue after a migration failure.
Multiple Storage Instances
A data category (configuration, operational, dynamic-schemas, user-management) maps to a storage instance (StorageInstanceId) via IStorageInstanceRouter. Unmapped categories fall back to StorageInstanceId.Default.
| Method | Category | |
|---|---|---|
AddConfigurationStorage(...) | configuration | |
AddOperationalStorage(...) | operational | |
AddDynamicSchemas(...) | dynamic-schemas | |
AddUserManagement(...) | user-management |
Rules:
- Each category maps to one instance per application; mapping it twice to different instances (even from different products) throws
InvalidOperationException. Selecting a second provider for the same instance also throws. IStorageInstanceSchema.MigrateAsynconly migrates the default instance; useIStorageInstanceSchemaFactory.GetStorageInstanceSchema(id, ct)for named instances. The CLI migrates one connection string at a time, so run it per instance.- Outbox processing and purge are registered once and discover every instance automatically.
- With Spaces, every category resolves to its mapped instance first, then to the space's pool within that instance.
Configuration Admin APIs
AddConfigurationStorage() registers .NET service APIs (not HTTP endpoints). You expose them behind your own authenticated/authorized/audited admin app, CLI or deployment process.
| Service | Manages | |
|---|---|---|
IClientAdmin | Clients incl. secrets | |
IApiScopeAdmin | API scopes | |
IApiResourceAdmin | API resources, scope relationships, API secrets | |
IIdentityResourceAdmin | Identity resources | |
IIdentityProviderAdmin | Dynamic identity providers | |
ISamlServiceProviderAdmin | SAML service providers |
Create referenced scopes before the resources/clients that use them.
Other model types: ApiScopeConfiguration (Name, DisplayName), ApiResourceConfiguration (Scopes), IdentityResourceConfiguration (UserClaims), IdentityProviderConfiguration (Scheme, Type, Properties), SamlServiceProviderConfiguration (EntityId, AssertionConsumerServiceUrls of SamlIndexedEndpointConfiguration).
- Results: create/update/delete return
SaveResult<TId>(checkIsSuccess;Id,Version,Errors); get returnsGetResult<T>(Found,Item,Version). - Optimistic concurrency:
UpdateAsync(id, item, expectedVersion, ct)requires the version from the preceding get/create. Handle validation, duplicate-name, not-found, version-conflict errors. QueryAsync(QueryRequest.Create<ApiScopeFilter, ApiScopeSortField>(new ApiScopeFilter { Name = "inventory" }), ct)— filters can be contains matches, so compare business identifiers exactly; page via continuation tokens onQueryResult<T>.DeleteAsync(id, ct).- Client and API secrets are hashed on write (plaintext in, never returned). Dynamic identity provider properties (e.g. `ClientSecret`) are stored recoverably — not hashed, not field-encrypted. Use encrypted connections, encryption at rest, restricted DB access and protected backups. Do not grant direct read access to the configuration store as a substitute for an authorized admin API — go through the admin API (e.g.
IIdentityProviderAdmin) with proper authorization. - Register the matching dynamic provider type (
AddOidcDynamicProvider()/AddSamlDynamicProvider()) for IdPs you create.
Data Extension Schemas
Add typed custom properties (ExtendedProperties) to clients, API resources, API scopes, identity resources, dynamic IdPs and SAML SPs without DB schema changes.
No SQL migrations are needed when adding or changing extension schemas or attributes: values are stored as generic attribute-value data, so only the schema definition changes. Values that are unknown to the schema or of the wrong type are rejected on write.
| Schema store | Choose when | |
|---|---|---|
In-memory: AddInMemoryDataExtensionSchemas([...]) | Schemas live in code, change via deployment, identical on all nodes (safer default) | |
Storage-backed: AddDynamicSchemas() (ISchemaStore + ISchemaAdmin) | Admin system changes schemas at runtime |
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/identityserver-duende-storage/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/duendesoftware/duende-skills/identityserver-duende-storage)