Development edition · 16 November 2026. Commands using repository paths, Make targets or sample projects require access to the Quinzee source checkout. No public installer is available. Examples use disposable local environments.
8. Keep application secrets in Key Vault
Key Vault separates secret retrieval from ordinary application settings. A secret has a name and one or more versions. Setting an existing name creates a new version; reading without a version selects the current one.
The local service supports secrets. Key Vault cryptographic keys and certificates are separate Azure products/APIs and are not emulated here.
Step 1: store and retrieve the database password
The deployment created the vault. Replace Program.cs and run it:
using Azure.Security.KeyVault.Secrets;
var book = BookContext.Load();
var outputs = book.Outputs();
var vault = new SecretClient(new Uri(outputs["vaultEndpoint"]), book.Credential);
var created = await vault.SetSecretAsync("database-password", book.Settings.DatabasePassword);
var current = await vault.GetSecretAsync("database-password");
if (current.Value.Value != book.Settings.DatabasePassword)
throw new InvalidOperationException("Secret round trip failed");
Console.WriteLine($"Stored secret version: {created.Value.Properties.Version}");
await foreach (var properties in vault.GetPropertiesOfSecretsAsync())
Console.WriteLine(properties.Name);
The sample validates the value without printing it. The SDK follows Key Vault's bearer challenge and obtains the vault-specific token. Do not replace its certificate checks or disable challenge-resource verification.
Reading a fixed version is useful when a configuration references a particular
credential: await vault.GetSecretAsync("database-password", version). Setting
another version does not change an existing PostgreSQL or MySQL password; the
local database service does not implement administrator credential rotation.
Step 2: try deletion and recovery on a separate secret
This exercise uses disposable-example, leaving the database password intact.
Replace Program.cs with:
using Azure.Security.KeyVault.Secrets;
var book = BookContext.Load();
var vault = new SecretClient(new Uri(book.Outputs()["vaultEndpoint"]), book.Credential);
await vault.SetSecretAsync("disposable-example", "synthetic-example-value");
var deletion = await vault.StartDeleteSecretAsync("disposable-example");
await deletion.WaitForCompletionAsync();
var recovery = await vault.StartRecoverDeletedSecretAsync("disposable-example");
await recovery.WaitForCompletionAsync();
var recovered = await vault.GetSecretAsync("disposable-example");
Console.WriteLine($"Recovered: {recovered.Value.Name}");
A soft-deleted secret can be recovered. Purging it removes that recovery path. Deleting the vault or its resource group is a separate permanent deletion of the local vault and its data; there is no soft-deleted-vault recovery facility.
Step 3: design with the local boundary in mind
Secret values can be up to 25 KB, and the emulator keeps up to 500 versions per
secret. Disabled versions are refused. Version attributes and tags are supported;
secret nbf/exp metadata is stored rather than enforced as an access timer.
Local state is private to the operating user but is not an encrypted vault at rest. Use development credentials. RBAC/access-policy properties are not per-principal permission enforcement here. The current data plane retains the bootstrap/administrator access model and refuses new scoped identities until that service has a scoped policy integration. Test production permission assignments against Azure separately.