duendesoftware/duende-skills/identityserver4-migration
Claude Code and agent skill by duendesoftware/duende-skills
- community
Checking that the SKILL.md file is still in the repository.
Migrating from IdentityServer4 to Duende IdentityServer v8. Covers NuGet package replacement, namespace changes, API surface changes, EF Core database schema migrations, .NET target framework upgrade, license configuration, signing key migration, data protection, and UI template updates.
Install
npx vskill@latest install duendesoftware/duende-skills/identityserver4-migrationSKILL.md
The same SKILL.md was published earlier as duendesoftware/duende-skills/identityserver4-migration.
Migrating from IdentityServer4 to Duende IdentityServer
Scope: IdentityServer4 only. This skill covers migrating from IdentityServer4 (v3.x and v4.x) to Duende IdentityServer. It does not cover migrating from IdentityServer3 (the older Thinktecture/IdentityServer3NuGet package that ran on OWIN/Katana and .NET Framework). IdentityServer3 is a fundamentally different product with a different API surface, configuration model, and hosting stack. If you are on IdentityServer3, you must first port to IdentityServer4 on ASP.NET Core before using this guide.
When to Use This Skill
- Planning a migration from IdentityServer4 to Duende IdentityServer — running the migration analysis tool
- Upgrading a project from IdentityServer4 (v3.x or v4.x) to Duende IdentityServer v8
- Replacing IdentityServer4 NuGet packages with Duende equivalents
- Updating
IdentityServer4.*namespaces toDuende.IdentityServer.* - Migrating EF Core database schemas from IdentityServer4 to Duende IdentityServer
- Upgrading the .NET target framework from
netcoreapp3.1ornet5.0to a current LTS version - Resolving breaking API changes between IdentityServer4 and Duende IdentityServer
- Converting
Startup.cs/Program.cshosting patterns from Generic Host to minimal hosting - Configuring the Duende IdentityServer license key after migration
- Determining the right Duende license edition based on client inventory (interactive vs. non-interactive)
- Preserving the issuer URI to maintain token and client trust continuity
- Migrating signing keys from IdentityServer4 developer signing credential to Duende automatic key management
- Verifying third-party authentication scheme compatibility with the new .NET version
- Updating UI templates (login, logout, consent) from IdentityServer4 Quickstart UI to Duende templates
Core Principles
Migration has two stages if starting from v3.x. IdentityServer4 v3 → v4 introduced breaking changes in the ApiResource/ApiScope relationship (parent-child to many-to-many). If you are on v3, first migrate to v4 semantics, then migrate from v4 to Duende. If you are already on IdentityServer4 v4.x, you can go directly to Duende.
Duende IdentityServer is the direct successor to IdentityServer4. The API surface is intentionally similar — most code changes are namespace and package renames. Behavioral changes are minimal, but the database schema has new tables and columns for features like automatic key management, server-side sessions, DPoP, and PAR.
The .NET target framework must be upgraded alongside the IdentityServer migration. IdentityServer4 ran on netcoreapp3.1 or net5.0. Duende IdentityServer v8 requires net10.0. You must follow Microsoft's ASP.NET Core migration guides for each major version jump.
Database migrations require careful handling to avoid data loss. The v3 → v4 schema change renames tables and restructures relationships. A naive EF Core migration will drop and recreate tables, losing data. Use the provided delta SQL scripts or manually craft migrations that preserve data.
Licensing is required for production use. Duende IdentityServer requires a valid license key for production. Without one, it runs in community/trial mode and logs a warning on startup.
Docs: https://docs.duendesoftware.com/identityserver/upgrades
Migration Path Overview
If already on IdentityServer4 v4.x, skip directly to Stage 2.
Step 0: Run the Migration Analysis Tool (Recommended)
Before making any code changes, run the Migration Analysis Tool against your running IdentityServer4 instance. This tool inspects your live configuration and produces a report with specific recommendations.
The tool is a single file, `MigrationAnalysisController.cs`, that you drop into your existing IdentityServer4 project. It does not require additional NuGet packages.
What the tool inspects
| Data Point | Why It Matters | |
|---|---|---|
| .NET runtime version | Flags if you need to upgrade to .NET 10 | |
| IdentityServer4 version | Determines if Stage 1 (v3 → v4) is needed before proceeding | |
| Client inventory | Counts interactive (authorization code) vs. non-interactive (client credentials) clients — this determines which Duende license edition you need | |
| Issuer URI | Reports the configured IssuerUri — must be preserved in Duende to avoid breaking existing tokens and client trust relationships | |
| Signing credential store type | Identifies custom signing stores that may need compatibility updates | |
| Signing credential key ID | Records the current key ID for signing key migration planning | |
| Data protection application name | Flags missing or path-based discriminators that will break after .NET upgrade | |
| Data protection repository type | Warns if keys are stored ephemerally (lost on restart) instead of a persistent store | |
| Authentication schemes | Lists all registered authentication handlers — third-party handlers (non-Microsoft, non-IdentityServer4) may need version updates for the new ASP.NET Core version |
Usage
- Download
MigrationAnalysisController.csand add it to your IdentityServer4 project - Update the authorization check in the
Index()method — the default placeholder checks for username"scott"which you must replace with your own authorization logic - Build, run, and navigate to
/MigrationAnalysiswhile authenticated - Review the report and use it to plan your migration
The tool loads clients from in-memory configuration or EF Core stores automatically. If you use a custom client store, you will need to modify the constructor to wire up your client retrieval.
Note: Duende also offers a free IdentityServer4 upgrade assessment to walk through your upgrade path.
Stage 1: IdentityServer4 v3.x → v4.x
Skip this section if you are already on IdentityServer4 v4.x.
Step 1.1: Update NuGet Packages to v4
Step 1.2: Register API Scopes Separately
In v3, ApiScope was a child of ApiResource. In v4, scopes are independent top-level objects with a many-to-many relationship to API resources. You must register them separately:
Step 1.3: Fix Breaking API Changes (v3 → v4)
HttpContext.SignInAsync signature change:
AuthorizationRequest property changes:
Consent response changes:
Grant management method renames:
External provider callback consolidation:
Step 1.4: Migrate the Database (v3 → v4)
PersistedGrantDbContext — Standard EF migration:
New columns added: ConsumedTime, Description, SessionId on PersistedGrants and DeviceCodes.
ConfigurationDbContext — Requires custom SQL to preserve data:
The v3 → v4 schema change renames tables:
ApiClaims→ApiResourceClaimsApiProperties→ApiResourcePropertiesApiSecrets→ApiResourceSecretsIdentityClaims→IdentityResourceClaimsIdentityProperties→IdentityResourceProperties
And restructures the ApiScopes relationship (scopes become independent, linked via ApiResourceScopes join table).
Do not rely on auto-generated EF migrations for this step — they will drop and recreate tables, losing data. Instead:
- Create the migration scaffold:
``bash dotnet ef migrations add Config_v4 -c ConfigurationDbContext -o Migrations/ConfigurationDb ``
- Embed a custom delta SQL script that migrates data before dropping old tables:
```sql -- Move data from old tables to new tables INSERT INTO ApiResourceClaims (Id, [Type], ApiResourceId) SELECT Id, [Type], ApiResourceId FROM ApiClaims;
INSERT INTO ApiResourceProperties (Id, [Key], [Value], ApiResourceId) SELECT Id, [Key], [Value], ApiResourceId FROM ApiProperties;
INSERT INTO ApiResourceSecrets (Id, [Description], [Value], [Expiration], [Type], [Created], ApiResourceId) SELECT Id, [Description], [Value], [Expiration], [Type], [Created], ApiResourceId FROM ApiSecrets;
INSERT INTO IdentityResourceClaims (Id, [Type], IdentityResourceId) SELECT Id, [Type], IdentityResourceId FROM IdentityClaims;
INSERT INTO IdentityResourceProperties (Id, [Key], [Value], IdentityResourceId) SELECT Id, [Key], [Value], IdentityResourceId FROM IdentityProperties;
-- Migrate scope-resource relationship to join table INSERT INTO ApiResourceScopes ([Scope], [ApiResourceId]) SELECT [Name], [ApiResourceId] FROM ApiScopes;
-- Remove old foreign key column from ApiScopes -- (handled by EF migration after data is moved) ```
- Modify the generated migration to execute the SQL script before the destructive operations.
- Apply:
dotnet ef database update -c ConfigurationDbContext
Reference implementation: UpgradeSample-IdentityServer4-v3
Stage 2: IdentityServer4 v4.x → Duende IdentityServer v8.x
Step 2.1: Update .NET Target Framework
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 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/identityserver4-migration/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/identityserver4-migration)