Skip to content

Instantly share code, notes, and snippets.

@martyncoup
Created April 22, 2024 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martyncoup/fd925700081181d355be032223612118 to your computer and use it in GitHub Desktop.
Save martyncoup/fd925700081181d355be032223612118 to your computer and use it in GitHub Desktop.
Add management of data protection keys
// Add data protection keys
builder.Services.AddDataProtection()
.SetApplicationName("YourAppName")
.SetDefaultKeyLifetime(TimeSpan.FromDays(30))
.PersistKeysToAzureBlobStorage(new Uri(builder.Configuration["DataProtectionKeysUri"]), new DefaultAzureCredential())
.ProtectKeysWithAzureKeyVault(new Uri(builder.Configuration["DataProtectionVaultIdentifierUri"]), new DefaultAzureCredential());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment