Orchardcore azure key vault

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore azure key vault is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for loading Orchard Core app configuration and secrets from Azure Key Vault. Covers the AddOrchardCoreAzureKeyVault configuration extension for IHostBuilder, IWebHostBuilder and ConfigurationManager, DefaultAzureCredential and custom TokenCredential authentication, the OrchardCore KeyVault Azu

How to use this skill

Skill file

Orchard Core Azure Key Vault - Prompt Templates

Load Configuration From Azure Key Vault

You are an Orchard Core expert. Wire Azure Key Vault as a configuration source so secrets such as connection strings and API keys are pulled from Key Vault instead of appsettings.

Guidelines

Package Reference (web project)

<ItemGroup>
  <PackageReference Include="OrchardCore.Configuration.KeyVault" Version="3.*" />
</ItemGroup>

Registering Key Vault in Program.cs

Using the minimal hosting model with ConfigurationManager:

var builder = WebApplication.CreateBuilder(args);

builder.Configuration.AddOrchardCoreAzureKeyVault();

builder.Services
    .AddOrchardCms();

var app = builder.Build();

app.UseOrchardCore();

app.Run();

Using the generic host builder:

Host.CreateDefaultBuilder(args)
    .AddOrchardCoreAzureKeyVault()
    .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>());

Passing a custom credential (for example a specific user-assigned managed identity):

var credential = new ManagedIdentityCredential("<client-id>");

builder.Configuration.AddOrchardCoreAzureKeyVault(credential);

Configuration Section

{
  "OrchardCore": {
    "KeyVault": {
      "Azure": {
        "KeyVaultName": "my-vault",
        "VaultURI": "",
        "ReloadInterval": "60"
      }
    }
  }
}

Environment variable form: OrchardCore__KeyVault__Azure__KeyVaultName=my-vault.

Secret Name Translation

Key Vault secret names cannot contain : or _. Orchard Core maps them back to configuration keys:

| Key Vault secret name | Resolved configuration key |

|---|---|

| OrchardCore--Shells--Database--ConnectionString | OrchardCore:Shells:Database:ConnectionString |

| OrchardCore--Media--Azure--ConnectionString | OrchardCore:Media:Azure:ConnectionString |

| OrchardCore--DataProtection--Azure--ConnectionString | OrchardCore:DataProtection:Azure:ConnectionString |

| OrchardCore--Redis--Configuration | OrchardCore:Redis:Configuration |

| OrchardCore--Email--Smtp--Password | OrchardCore:Email:Smtp:Password |

| OrchardCore--SignalR--Azure--ConnectionString | OrchardCore:SignalR:Azure:ConnectionString |

| ConnectionStrings--Default | ConnectionStrings:Default |

Orchard Core 4.0 configuration sections are grouped by service without the

OrchardCore_ prefix, so most secret names no longer need the triple dash. Use

--- only for keys that really contain _.

Rules applied by AzureKeyVaultSecretManager:

Common Uses

Configuration Provider vs. the Secrets Module Store

Orchard Core 4.0 also ships OrchardCore.Secrets.AzureKeyVault, a tenant

feature that makes Key Vault a store of the Secrets module (store name

AzureKeyVault, configured under OrchardCore:Secrets:AzureKeyVault with a

host-registered keyed SecretClient). The two are independent:

| | OrchardCore.Configuration.KeyVault | OrchardCore.Secrets.AzureKeyVault |

|---|---|---|

| Kind | Host configuration provider | Tenant feature (store of OrchardCore.Secrets) |

| Consumers | Any configuration key | Settings that reference a secret by *SecretName, and ISecretManager |

| Entry names | --/--- encoded configuration keys | Prefix, tenant, and name with a hash, plus ownership tags |

| Managed in | Azure only | Orchard admin (Tools → Security → Secrets) |

Credentials supplied through configuration (including this provider), such as

OrchardCore--Email--Smtp--Password, still work in 4.0 but log a

LegacySecretConfiguration warning (event 8100) for the integrations that

support secrets. To retire them, create the secret in the Secrets module (in the

AzureKeyVault or Database store), select it in the integration's settings,

then delete the configuration entry. See orchardcore-secrets.

Notes

Upgrading from 3.x

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.