Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
469cc1c
Azure Local: a new cluster gets the newest Kubernetes the instance of…
shsengar Nov 18, 2026
6862d68
Azure Local: up.ps1 prepares Active Directory itself, after the cluster
shsengar Nov 18, 2026
2604891
Sign archived orders with a key from Key Vault, on Azure and Azure Local
shsengar Nov 18, 2026
50e72bd
compose: write the local signing key to the processor's tmpfs
shsengar Nov 18, 2026
31bec74
Azure Local: say the management machine must use the site's DNS, and …
shsengar Nov 18, 2026
a22a2b3
Azure Local: AD step works from a management machine outside the domain
shsengar Nov 18, 2026
030db82
Azure Local: new clusters get Kubernetes 1.33, not the newest offered
shsengar Nov 19, 2026
a4ad072
Azure Local: make containerd 2 nodes trust the connected registry
shsengar Nov 19, 2026
1d51ff8
Take the containerd 2 workaround back out
shsengar Nov 19, 2026
a66c84b
Azure Local: connected registry on containerd 2 nodes, and its reinstall
shsengar Nov 19, 2026
6e2b4b4
Azure Local: tell users to sign in with the AD account name
shsengar Nov 19, 2026
3bd0e19
README: describe the node configuration by what the nodes run
shsengar Nov 19, 2026
8cc379f
README: drop the node configuration note
shsengar Nov 19, 2026
d3c10d2
Azure Local: simpler registry trust, AD password re-prompt, review fixes
shsengar Nov 19, 2026
ef8ce2f
Azure Local: registry-trust.yaml configures each node once
shsengar Nov 20, 2026
6a1234c
Azure Local: AD step keeps an existing LDAPS certificate and leaves d…
shsengar Nov 20, 2026
416984c
Docs: keep guide changes to corrections
shsengar Nov 23, 2026
68407e0
Fix the review findings on the Azure Local setup
shsengar Nov 25, 2026
970d77f
Trim the review fixes to what the findings need
shsengar Nov 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions recipe-packs/azure-local.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ per-service database passwords. {resource} is the container resource name.
''')
param containerEnvFromSecrets array = []

@description('''
Key Vault secrets mounted as files into one service each, by container resource name:
`{ processor: { 'archive-signing': 'archive-signing' } }` mounts Kubernetes Secret archive-signing at
/var/run/secrets/archive-signing in the processor only. The Key Vault Secret Store extension writes
that Secret from Key Vault while the site is connected; the last copy keeps working offline.
''')
param keyVaultFiles object = {}

@description('OpenTelemetry Collector endpoint given to every container as OTEL_EXPORTER_OTLP_ENDPOINT, with Telemetry__Exporter set to Otlp. Empty sets it to None: no telemetry.')
param otlpEndpoint string = ''

Expand Down Expand Up @@ -259,6 +267,9 @@ var containerPlatformParameters = union(
containerVolumeMounts: concat(identityProviderMounts, siteCaMounts)
containerEnv: concat(identityProviderEnv, telemetryEnv, siteCaEnv, objectStorageEnv)
containerEnvFromSecrets: containerEnvFromSecrets
resourceFiles: toObject(items(keyVaultFiles), service => service.key, service => toObject(items(service.value), file => file.key, file => {
secret: { secretName: file.value }
}))
}
)

Expand Down
15 changes: 15 additions & 0 deletions recipe-packs/azure.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ param serviceCertificateIssuer string = ''
@description('Existing Secret in the application namespace with that issuer\'s CA certificate under `ca.crt`. Every container trusts it as well as the public CAs.')
param serviceCaSecretName string = ''

@description('''
Key Vault secrets mounted as files into one service each, by container resource name:
`{ processor: { 'archive-signing': 'archive-signing' } }` mounts what SecretProviderClass
archive-signing names at /var/run/secrets/archive-signing in the processor only, through the Key
Vault CSI driver, as that service's own identity.
''')
param keyVaultFiles object = {}

// In-cluster CA: .NET and OpenSSL trust every certificate in the SSL_CERT_DIR directories, so callers
// verify the app's own services; the system directory stays listed, so Azure's public endpoints verify too.
var useServiceCa = !empty(serviceCaSecretName)
Expand Down Expand Up @@ -125,6 +133,13 @@ var containerIdentityParameters = {
], useServiceCa ? [
{ name: 'SSL_CERT_DIR', value: '/etc/ssl/certs:/etc/service-ca' }
] : [])
resourceFiles: toObject(items(keyVaultFiles), service => service.key, service => toObject(items(service.value), file => file.key, file => {
csi: {
driver: 'secrets-store.csi.k8s.io'
readOnly: true
volumeAttributes: { secretProviderClass: file.value }
}
}))
}

var routeIngressParameters = {
Expand Down
20 changes: 18 additions & 2 deletions recipes/kubernetes/kubernetes-containers.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ param connectionSecretNames object = {}
@description('Pod labels, by Resource Type, for pods connected to a resource of that type, so the platform\'s network policies can let them in.')
param connectionPodLabels object = {}

@description('''
Files the platform delivers, such as a secret, by container resource name: for each resource, a map of
names to the Kubernetes volume source that holds the files, such as a Key Vault CSI volume
(`{ csi: { driver: 'secrets-store.csi.k8s.io', readOnly: true, volumeAttributes: { secretProviderClass: 'archive-signing' } } }`)
or a Secret (`{ secret: { secretName: 'archive-signing' } }`). Each is mounted read-only at
/var/run/secrets/<name> in that resource's containers only, so the application reads the same file
whichever platform delivered it.
''')
param resourceFiles object = {}

@description('''
cert-manager ClusterIssuer that gives every container declaring a port named `https` a certificate
for its Service's DNS names, so callers in the cluster reach it over TLS and can verify it. The
Expand Down Expand Up @@ -140,8 +150,14 @@ var platformPodSecurityContext = platformOptions.?podSecurityContext ?? podSecur
var platformContainerSecurityContext = platformOptions.?containerSecurityContext ?? containerSecurityContext

// Extra volumes, mounts and environment from the Recipe Pack, added to every pod and container.
var platformVolumes = platformPodVolumes
var platformVolumeMounts = containerVolumeMounts
// LOCAL ADDITION: plus the files the platform delivers to this resource only.
var resourceFileItems = items(resourceFiles[?normalizedName] ?? resourceFiles[?resourceName] ?? {})
var platformVolumes = concat(platformPodVolumes, map(resourceFileItems, file => union(file.value, { name: 'platform-file-${toLower(file.key)}' })))
var platformVolumeMounts = concat(containerVolumeMounts, map(resourceFileItems, file => {
name: 'platform-file-${toLower(file.key)}'
mountPath: '/var/run/secrets/${toLower(file.key)}'
readOnly: true
}))
var platformEnvVars = map(containerEnv, envVar => contains(envVar, 'value')
? union(envVar, { value: replace(string(envVar.value), '{resource}', normalizedName) })
: envVar)
Expand Down
4 changes: 2 additions & 2 deletions resources/key-vault/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Azure Local with [disconnected operations](https://learn.microsoft.com/azure/azu
## What the sample needed to change

1. **Secrets read from Kubernetes Secrets.** On Azure Local the services read their credentials from Kubernetes Secrets. On Azure they need none, because every service signs in with workload identity.
2. **Secrets to copy listed per namespace.** The sample includes a `SecretProviderClass` and a `SecretSync` for one example secret, a partner API key. Nothing is synced by default.
2. **Secrets to copy listed per namespace.** The sample includes a `SecretProviderClass` and a `SecretSync` for one secret, the key its order processor signs archived orders with.
3. **Key Vault access given to the extension, not the app.** A managed identity with the Key Vault Secrets User role is federated with the extension's service account.
4. **Credentials that only matter on site generated on site.** Database passwords and object store keys are created in the cluster and changed with a rotation script, which needs no link to Azure.

Expand Down Expand Up @@ -60,4 +60,4 @@ Secrets without a plugin, such as S3 keys or partner API keys, need their own ro

## Sample

The [Order Management sample](../../samples/OrderManagementApp/README.md) on Azure Local sets up Key Vault and the Secret Store extension for secrets that already live in Azure, and shows how to sync one. Nothing is synced by default. The sample's own passwords and keys are generated on site and changed with a rotation script. On Azure the sample needs no secrets, because every service signs in with workload identity. [Key Vault with the Secret Store extension](./alternatives/secret-store-extension.md#how-the-order-management-sample-does-it) links the code for each change above.
The [Order Management sample](../../samples/OrderManagementApp/README.md) on Azure Local sets up Key Vault and the Secret Store extension for secrets that already live in Azure, and syncs one: the key its order processor signs archived orders with. The sample's own passwords and keys are generated on site and changed with a rotation script. On Azure that signing key is the sample's only secret; every service signs in with workload identity. [Key Vault with the Secret Store extension](./alternatives/secret-store-extension.md#how-the-order-management-sample-does-it) links the code for each change above.
4 changes: 2 additions & 2 deletions resources/key-vault/alternatives/secret-store-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ The older Azure Key Vault Secrets Provider extension for Arc retires on 9 Octobe

## How the Order Management sample does it

On Azure every service signs in with workload identity, backed by managed identities, so there are no secrets to manage. On Azure Local, connected to Azure, the sample sets up the vault and the extension for secrets that already live in Azure; its own credentials are generated on site:
On Azure every service signs in with workload identity, backed by managed identities; the one secret, the key the order processor signs archived orders with, is mounted from Key Vault by the [Key Vault Secrets Provider](https://learn.microsoft.com/azure/aks/csi-secrets-store-driver). On Azure Local, connected to Azure, the sample sets up the vault and the extension for secrets that already live in Azure; its own credentials are generated on site:

| Step | In the sample |
|---|---|
| Workload identity on the cluster | [platform-resources.bicep](../../../samples/OrderManagementApp/infra/azurelocal/platform-resources.bicep) turns on the OIDC issuer and workload identity when the cluster is created, and installs the Certificate Management extension, the cluster's one cert-manager, which the Secret Store extension requires |
| Vault, identity and extension | [key-vault.bicep](../../../samples/OrderManagementApp/infra/azurelocal/key-vault.bicep), deployed by [key-vault.ps1](../../../samples/OrderManagementApp/scripts/infra/azurelocal/key-vault.ps1): Key Vault with RBAC and purge protection, a managed identity with Key Vault Secrets User federated with the `secret-sync` service account, and the extension (hourly poll) |
| Syncing a secret from Azure | [key-vault-sync.yaml](../../../samples/OrderManagementApp/infra/azurelocal/key-vault-sync.yaml) creates the `secret-sync` service account and shows the `SecretProviderClass` and `SecretSync` for a partner API key. Nothing is synced by default. |
| Syncing a secret from Azure | [key-vault-sync.yaml](../../../samples/OrderManagementApp/infra/azurelocal/key-vault-sync.yaml) creates the `secret-sync` service account, and the `SecretProviderClass` and `SecretSync` that copy the order processor's signing key, Key Vault secret `archive-signing-key`, to Kubernetes Secret `archive-signing`. The Recipe Pack mounts it into the processor only. |
| Credentials born on site | Database passwords and object store keys are generated in the cluster by the setup and deploy scripts, and changed with [rotate-credentials.ps1](../../../samples/OrderManagementApp/scripts/infra/azurelocal/rotate-credentials.ps1), which needs no link to Azure |
| Keycloak and the new issuer | Workload identity gives the cluster's tokens a public issuer URL. [realm.json](../../../samples/OrderManagementApp/infra/azurelocal/keycloak/realm.json) sets Keycloak's `issuerDiscoveryUrl` to `https://kubernetes.default.svc`, so Keycloak reads the signing keys from the API server, not from Azure. Check that the `jwks_uri` in `kubectl get --raw /.well-known/openid-configuration` is on site. |

Expand Down
27 changes: 17 additions & 10 deletions samples/OrderManagementApp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ All commands run from this folder, `samples/OrderManagementApp`.
workers of 4 vCPUs and 16 GB each (8 GB with `Availability` `standard`), plus about 120 GB of
storage (80 GB with `standard`).
- A management machine on the site network, not an Azure Local node, with the same tools as for
Azure except azd. Microsoft recommends managing AKS on Azure Local from such a
Azure except azd. It must use the site's DNS, so it resolves the Active Directory domain.
Microsoft recommends managing AKS on Azure Local from such a
[client machine](https://learn.microsoft.com/azure/aks-hybrid-edge/local/aks-create-clusters-cli#install-the-azure-cli-extension)
rather than from the nodes.
- Free addresses on the site network for the AKS cluster: its control plane, a pool for the nodes and a
small range for the load balancer.
- The site's Active Directory, with the app's groups and a bind account for Keycloak. See
- The site's Active Directory, and a domain administrator: `up.ps1` asks for one to add the app's
groups and a bind account for Keycloak, over PowerShell remoting from the management machine. See
[Connect your Active Directory](./docs/authentication.md#connect-your-active-directory).
- Contributor and User Access Administrator on the subscription, and the right to create groups in
Entra ID (or an existing group for the cluster's administrators).
Expand Down Expand Up @@ -138,8 +140,8 @@ corporate tenant does), set it before `azd up`:
azd env set SERVICE_MANAGEMENT_REFERENCE <service tree ID>
```

`azd up` creates AKS, a container registry and managed identities, installs Radius and an HTTPS
ingress, registers the app in Entra ID, then builds and deploys the app; the Recipes create Service
`azd up` creates AKS, a container registry, managed identities and a Key Vault, installs Radius and
an HTTPS ingress, registers the app in Entra ID, then builds and deploys the app; the Recipes create Service
Bus, Blob Storage, Azure SQL and PostgreSQL. It prints the app's address. Your account gets the app
roles to place orders and restock, so you can sign in straight away.

Expand Down Expand Up @@ -177,8 +179,9 @@ says where to find each value. Then run:
```

It checks the site, creates the AKS cluster and everything the app needs on it, and deploys the app.
Open the address it prints and sign in with an AD account in one of the app's groups. The first
time, on a machine outside the domain, trust the site CA with the command it printed.
Open the address it prints and sign in with the account name, not `name@domain`, of an AD user in
one of the app's groups, such as the sample user `oms-demo`. The first time, on a machine outside
the domain, trust the site CA with the command it printed.

To deploy a new version later, run `./scripts/deploy.ps1 -Target AzureLocal`.

Expand Down Expand Up @@ -219,18 +222,22 @@ For production, you would also need:

**Locally:** `docker compose down`.

**Azure:** `azd down`. It deletes the resource group, including what the Recipes created in it, and
the app registrations.
**Azure:** `azd down --purge`. It deletes the resource group, including what the Recipes created in
it, and the app registrations; `--purge` deletes the Key Vault for good, so a later `azd up` can
create it again.

**Azure Local:** delete the resource group the scripts created (`ResourceGroup` in the settings,
`bcd-azurelocal` by default), which holds the AKS cluster, the registry and the logical network:
`bcd-azurelocal` by default), which holds the AKS cluster, the registry, the Key Vault and the
logical network:

```powershell
az group delete --name bcd-azurelocal
```

The AKS cluster's Entra admin group and the objects `ad-setup.ps1` added to Active Directory stay;
remove them by hand if you no longer need them.
remove them by hand if you no longer need them. To deploy again, use another `ResourceGroup`, since
a deleted Key Vault keeps its name for 90 days, and set `ActiveDirectory.ResetBindPassword` to
`true` for that run, so Keycloak's bind account gets a password the new cluster has.

## Understand how it works

Expand Down
2 changes: 1 addition & 1 deletion samples/OrderManagementApp/azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ hooks:
./scripts/infra/azure/provision-infra.ps1 -SkipTemplate `
-SubscriptionId $env:AZURE_SUBSCRIPTION_ID -Location $env:AZURE_LOCATION `
-ResourceGroup $env:resourceGroupName -ClusterName $env:clusterName -KubeContext $env:clusterName `
-RegistryName $env:registryName -WorkspaceName $env:AZURE_ENV_NAME
-RegistryName $env:registryName -KeyVaultName $env:keyVaultName -WorkspaceName $env:AZURE_ENV_NAME

$ingressArgs = @{ KubeContext = $env:clusterName; DnsLabel = $label }
if ($env:PRIVATE_CA -eq 'true') { $ingressArgs.PrivateCa = $true }
Expand Down
6 changes: 6 additions & 0 deletions samples/OrderManagementApp/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ services:
OTEL_SERVICE_NAME: processor
SQL_USERNAME: processor
SQL_PASSWORD: ${LOCAL_PASSWORD:?Set LOCAL_PASSWORD, see compose.yaml}
# The key it signs archived orders with. Azure and Azure Local mount it from Key Vault at
# /var/run/secrets/archive-signing/key; here it's written to the container's tmpfs at start,
# since Compose can't add a file to a read-only container.
ArchiveSigning__KeyPath: /tmp/archive-signing-key
LOCAL_ARCHIVE_SIGNING_KEY: local-archive-signing-key-${LOCAL_PASSWORD:?Set LOCAL_PASSWORD, see compose.yaml}
entrypoint: ["bash", "-c", "printf '%s' \"$$LOCAL_ARCHIVE_SIGNING_KEY\" > /tmp/archive-signing-key && exec dotnet OrderManagement.Processor.dll"]
depends_on:
dbsetup: { condition: service_completed_successfully }
rabbitmq-setup: { condition: service_completed_successfully }
Expand Down
19 changes: 11 additions & 8 deletions samples/OrderManagementApp/docs/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,23 @@ needs:
| `oms-inventory-admins` | `Inventory.Manage` and `Orders.Read` |
| `oms-operators` | `Operations.Monitor`: the site's Grafana (dashboards, logs, traces) |
| `oms-identity-admins` | Administration of the app's Keycloak realm, `oms`, and nothing else |
- A bind account for Keycloak, `svc-keycloak`, that can only read the users and groups in the OU.
- A bind account for Keycloak, `svc-keycloak`, that Keycloak reads the OU's users and groups with.
Like any domain account it can read the directory, but it can sign in only at the domain
controllers.
- LDAPS on the domain controller, which needs a server certificate from a certificate authority.

[ad-setup.ps1](../scripts/infra/azurelocal/ad-setup.ps1) creates all of this and hands the bind
account and the CA certificate to the cluster. Run it from the management machine as a
domain administrator, once the cluster exists:
account and the CA certificate to the cluster. `up.ps1` runs it right after it creates the cluster,
and asks for a domain administrator's credentials. To change the directory later, run it yourself
from the management machine as a domain administrator:

```powershell
./scripts/infra/azurelocal/ad-setup.ps1 -ComputerName <domain controller> -DomainName <domain> `
-KubeContext <cluster context>
```

If your directory already has these, put the bind account in `Keycloak.AdBindUpn` and the CA's
certificate file in `Keycloak.AdCaCertificatePath` ([settings](./azure-local-settings.md#active-directory));
the first `up.ps1` run asks for the bind password and keeps it in the cluster. To change the bind
password, run `ad-setup.ps1 -ResetBindPassword`, then `keycloak.ps1`. To use an OU other than `OMS`,
pass `keycloak.ps1 -AdOuName`.
If your directory already has these, run `up.ps1 -Skip ActiveDirectory`, and put the bind account in
`Keycloak.AdBindUpn` and the CA's certificate file in `Keycloak.AdCaCertificatePath`
([settings](./azure-local-settings.md#active-directory)): the first run asks for the bind password
and keeps it in the cluster. To change the bind password, run `ad-setup.ps1 -ResetBindPassword`, then
`keycloak.ps1`. To use an OU other than `OMS`, set `Keycloak.AdOuName`.
7 changes: 5 additions & 2 deletions samples/OrderManagementApp/docs/azure-local-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ free, and the three ranges must not overlap.
|---|---|
| `Keycloak.AdServer` | Your domain controller's full name, for example `dc01.contoso.local`. It must match the name on its LDAPS certificate. |
| `Keycloak.AdDomain` | Your Active Directory domain, for example `contoso.local` |
| `Keycloak.AdBindUpn` | The read-only account Keycloak reads the directory with, for example `svc-keycloak@contoso.local`. The first run asks for its password and keeps it in the cluster; it never goes in this file. |
| `Keycloak.AdCaCertificatePath` | The certificate (PEM) of the CA that issued your domain controller's LDAPS certificate. It's public; on a domain-joined machine export it with `certutil -ca.cert ca.cer` and convert it with `certutil -encode ca.cer ca.crt`. |
| `Keycloak.AdBindUpn` | Only if you prepared the directory yourself (`up.ps1 -Skip ActiveDirectory`): the read-only account Keycloak reads the directory with, for example `svc-keycloak@contoso.local`. The first run asks for its password and keeps it in the cluster; it never goes in this file. |
| `Keycloak.AdCaCertificatePath` | Only with `-Skip ActiveDirectory`: the certificate (PEM) of the CA that issued your domain controller's LDAPS certificate. It's public; on a domain-joined machine export it with `certutil -ca.cert ca.cer` and convert it with `certutil -encode ca.cer ca.crt`. |

Otherwise leave the last two empty: the ActiveDirectory step creates the account and hands the CA to
the cluster.

## Check before you deploy

Expand Down
Loading