Skip to content

Commit c00253a

Browse files
committed
chore(docs): Document Azure Workload Identity
Signed-off-by: Hayden Roszell <[email protected]>
1 parent d229b82 commit c00253a

File tree

1 file changed

+87
-6
lines changed

1 file changed

+87
-6
lines changed

docsource/content.md

Lines changed: 87 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ Before starting, ensure that the following requirements are met:
1818
- [Supported cert-manager release](https://cert-manager.io/docs/releases/) installed in your cluster. Please see the [cert-manager installation](https://cert-manager.io/docs/installation/) for details.
1919
- [Supported version of Helm](https://helm.sh/docs/topics/version_skew/) for your Kubernetes version
2020

21-
# Badges
22-
23-
<a href="https://github.com/keyfactor/command-cert-manager-issuer/releases/latest"><img src="https://img.shields.io/github/v/release/keyfactor/command-cert-manager-issuer?style=flat-square" alt="Latest Release"></a>
24-
<a href="https://goreportcard.com/report/github.com/keyfactor/command-cert-manager-issuer"><img src="https://goreportcard.com/badge/github.com/keyfactor/command-cert-manager-issuer" alt="Go Report Card"></a>
25-
<a href="https://img.shields.io/badge/License-Apache%202.0-blue.svg"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License Apache 2.0"></a>
26-
2721
# Getting Started
2822

2923
## Configuring Command
@@ -142,6 +136,93 @@ kubectl -n command-issuer-system create secret generic command-secret \
142136
143137
> Audience and Scopes are optional
144138
139+
## Managed Identity Using Azure Entra ID Workload Identity (AKS)
140+
141+
Azure Entra ID workload identity in Azure Kubernetes Service (AKS) allows Command Issuer to exchange a Kubernetes ServiceAccount Token for an Azure Entra ID access token, which is then used to authenticate to Command.
142+
143+
1. Reconfigure the AKS cluster to enable workload identity federation.
144+
145+
```shell
146+
az aks update \
147+
--name ${CLUSTER} \
148+
--enable-oidc-issuer \
149+
--enable-workload-identity
150+
```
151+
152+
> The [Azure Workload Identity extension can be installed on non-AKS or self-managed clusters](https://azure.github.io/azure-workload-identity/docs/installation.html) if you're not using AKS.
153+
>
154+
> Refer to the [AKS documentation](https://learn.microsoft.com/en-us/azure/aks/workload-identity-deploy-cluster) for more information on the `--enable-workload-identity` feature.
155+
156+
2. Reconfigure or deploy Command Issuer with extra labels for the Azure Workload Identity webhook, which will result in the Command Issuer controller Pod having an extra volume containing a Kubernetes ServiceAccount token which it will exchange for a token from Azure.
157+
158+
```shell
159+
helm install command-cert-manager-issuer command-issuer/command-cert-manager-issuer \
160+
--namespace command-issuer-system \
161+
--create-namespace \
162+
--set "fullnameOverride=$chart_name" \
163+
--set-string "podLabels.azure\.workload\.identity/use=true" \
164+
--set-string "serviceAccount.labels.azure\.workload\.identity/use=true"
165+
# --set-string "serviceAccount.annotations.azure\.workload\.identity/client-id=<managed identity client ID>" # May be necessary, but is usually not.
166+
```
167+
168+
If successful, the Command Issuer Pod will have new environment variables and the Azure WI ServiceAccount token as a projected volume:
169+
170+
```shell
171+
kubectl -n command-issuer-system describe pod
172+
```
173+
174+
```shell
175+
Containers:
176+
command-cert-manager-issuer:
177+
...
178+
Environment:
179+
AZURE_CLIENT_ID: <GUID>
180+
AZURE_TENANT_ID: <GUID>
181+
AZURE_FEDERATED_TOKEN_FILE: /var/run/secrets/azure/tokens/azure-identity-token
182+
AZURE_AUTHORITY_HOST: https://login.microsoftonline.com/
183+
Mounts:
184+
/var/run/secrets/azure/tokens from azure-identity-token (ro)
185+
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-6rmzz (ro)
186+
...
187+
Volumes:
188+
...
189+
azure-identity-token:
190+
Type: Projected (a volume that contains injected data from multiple sources)
191+
TokenExpirationSeconds: 3600
192+
```
193+
194+
> Refer to [Azure Workload Identity docs](https://azure.github.io/azure-workload-identity/docs/installation/mutating-admission-webhook.html) more information on the role of the Mutating Admission Webhook.
195+
196+
3. Create a User Assigned Managed Identity in Azure.
197+
198+
```shell
199+
export IDENTITY_NAME=command-issuer
200+
az identity create --name "${IDENTITY_NAME}"
201+
```
202+
203+
> Read more about [the `az identity` command](https://learn.microsoft.com/en-us/cli/azure/identity?view=azure-cli-latest).
204+
205+
4. Associate a Federated Identity Credential (FIC) with the User Assigned Managed Identity. The FIC allows Command Issuer to act on behalf of the Managed Identity by telling Azure to expect:
206+
- The `iss` claim of the ServiceAccount token to match the cluster's OIDC Issuer. Azure will also use the Issuer URL to download the JWT signing certificate.
207+
- The `sub` claim of the ServiceAccount token to match the ServiceAccount's name and namespace.
208+
209+
```shell
210+
export SERVICE_ACCOUNT_NAME=command-cert-manager-issuer # This is the default Kubernetes ServiceAccount used by the Command Issuer controller.
211+
export SERVICE_ACCOUNT_NAMESPACE=command-issuer-system # This is the default namespace for Command Issuer used in this doc.
212+
export SERVICE_ACCOUNT_ISSUER=$(az aks show --resource-group $AZURE_DEFAULTS_GROUP --name $CLUSTER --query "oidcIssuerProfile.issuerUrl" -o tsv)
213+
az identity federated-credential create \
214+
--name "command-issuer" \
215+
--identity-name "${IDENTITY_NAME}" \
216+
--issuer "${SERVICE_ACCOUNT_ISSUER}" \
217+
--subject "system:serviceaccount:${SERVICE_ACCOUNT_NAMESPACE}:${SERVICE_ACCOUNT_NAME}"
218+
```
219+
220+
> Read more about [Workload Identity federation](https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation) in the Entra ID documentation.
221+
>
222+
> Read more about [the `az identity federated-credential` command](https://learn.microsoft.com/en-us/cli/azure/identity/federated-credential?view=azure-cli-latest).
223+
224+
5. Add Microsoft Entra ID as an [Identity Provider in Command](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/IdentityProviders.htm?Highlight=identity%20provider), and [add the Managed Identity's Client ID as an `oid` claim to the Security Role](https://software.keyfactor.com/Core-OnPrem/Current/Content/ReferenceGuide/SecurityOverview.htm?Highlight=Security%20Roles) created/identified earlier.
225+
145226
# CA Bundle
146227
147228
If the Command API is configured to use a self-signed certificate or with a certificate whose issuer isn't widely trusted, the CA certificate must be provided as a Kubernetes secret.

0 commit comments

Comments
 (0)