Skip to content

Commit 0f85690

Browse files
authored
Merge pull request #1991 from lunarwhite/az
Revise ACME Azure DNS-01 authentication docs for accuracy
2 parents 616997d + c68f211 commit 0f85690

File tree

3 files changed

+39
-40
lines changed
  • content/docs
  • public/docs/tutorials/getting-started-aks-letsencrypt

3 files changed

+39
-40
lines changed

content/docs/configuration/acme/dns01/azuredns.md

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ If you have an Azure AKS cluster you can use the following command:
2929
az aks update \
3030
--name ${CLUSTER} \
3131
--enable-oidc-issuer \
32-
--enable-workload-identity # ℹ️ This option is currently only available when using the aks-preview extension.
32+
--enable-workload-identity
3333
```
3434

3535
> ℹ️ You can [install the Azure workload identity extension on other managed and self-managed clusters](https://azure.github.io/azure-workload-identity/docs/installation.html) if you are not using Azure AKS.
@@ -38,18 +38,15 @@ az aks update \
3838
>
3939
### Reconfigure cert-manager
4040

41-
Label the cert-manager controller Pod and ServiceAccount for the attention of the Azure Workload Identity webhook,
41+
Label the cert-manager controller Pod for the attention of the Azure Workload Identity webhook,
4242
which will result in the cert-manager controller Pod having an extra volume containing a Kubernetes ServiceAccount token which it will use to authenticate with Azure.
4343

44-
If you installed cert-manager using Helm, the labels can be configured using Helm values:
44+
If you installed cert-manager using Helm, the label can be configured using Helm values:
4545

4646
```yaml
4747
# values.yaml
4848
podLabels:
4949
azure.workload.identity/use: "true"
50-
serviceAccount:
51-
labels:
52-
azure.workload.identity/use: "true"
5350
```
5451
5552
If successful, the cert-manager Pod will have some new environment variables set,
@@ -92,16 +89,17 @@ Choose a managed identity name and create the Managed Identity:
9289

9390
```bash
9491
export IDENTITY_NAME=cert-manager
95-
az identity create --name "${IDENTITY_NAME}"
92+
export IDENTITY_RESOURCE_GROUP=<your-resource-group> # ❗ Replace with your Azure resource group
93+
az identity create --name "${IDENTITY_NAME}" --resource-group "${IDENTITY_RESOURCE_GROUP}"
9694
```
9795

9896
Grant it permission to modify the DNS zone records:
9997

10098
```bash
101-
export IDENTITY_CLIENT_ID=$(az identity show --name "${IDENTITY_NAME}" --query 'clientId' -o tsv)
99+
export IDENTITY_CLIENT_ID=$(az identity show --name "${IDENTITY_NAME}" --resource-group "${IDENTITY_RESOURCE_GROUP}" --query 'clientId' -o tsv)
102100
az role assignment create \
103101
--role "DNS Zone Contributor" \
104-
--assignee IDENTITY_CLIENT_ID \
102+
--assignee $IDENTITY_CLIENT_ID \
105103
--scope $(az network dns zone show --name $DOMAIN_NAME -o tsv --query id)
106104
```
107105

@@ -125,6 +123,7 @@ export SERVICE_ACCOUNT_ISSUER=$(az aks show --resource-group $AZURE_DEFAULTS_GRO
125123
az identity federated-credential create \
126124
--name "cert-manager" \
127125
--identity-name "${IDENTITY_NAME}" \
126+
--resource-group "${IDENTITY_RESOURCE_GROUP}" \
128127
--issuer "${SERVICE_ACCOUNT_ISSUER}" \
129128
--subject "system:serviceaccount:${SERVICE_ACCOUNT_NAMESPACE}:${SERVICE_ACCOUNT_NAME}"
130129
```
@@ -159,9 +158,14 @@ spec:
159158
subscriptionID: $AZURE_SUBSCRIPTION_ID
160159
environment: AzurePublicCloud
161160
managedIdentity:
161+
# client ID of the managed identity; overrides AZURE_CLIENT_ID from the environment
162162
clientID: $IDENTITY_CLIENT_ID
163+
# # optional: tenant ID of the managed identity; overrides AZURE_TENANT_ID from the environment.
164+
# tenantID: $IDENTITY_TENANT_ID
163165
```
164166

167+
> ℹ️ `managedIdentity.clientID` and `managedIdentity.tenantID` override the values that the Azure Workload Identity webhook injects via environment variables (`AZURE_CLIENT_ID` and `AZURE_TENANT_ID`).
168+
165169
The following variables need to be filled in.
166170

167171
```bash
@@ -186,7 +190,7 @@ ClusterIssuer resources are cluster scoped (not namespaced) and only platform ad
186190
If you are using this authentication mechanism and ambient credentials are not enabled, you will see this error:
187191

188192
```bash
189-
error instantiating azuredns challenge solver: ClientID is not set but neither --cluster-issuer-ambient-credentials nor --issuer-ambient-credentials are set.
193+
error instantiating azuredns challenge solver: ClientID was omitted without providing one of `--cluster-issuer-ambient-credentials` or `--issuer-ambient-credentials`. These are necessary to enable Azure Managed Identities
190194
```
191195

192196
> ⚠️ It is possible (but not recommended) to enable this authentication mechanism for `Issuer` resources, by setting the `--issuer-ambient-credentials` flag on the cert-manager controller to true.
@@ -322,12 +326,11 @@ spec:
322326
This authentication mechanism is what cert-manager considers 'ambient credentials'. Use of ambient credentials is disabled by default for cert-manager `Issuer`s. This to ensure unprivileged users who have permission to create issuers cannot issue certificates using any credentials cert-manager incidentally has access to. To enable this authentication mechanism for `Issuer`s, you will need to set `--issuer-ambient-credentials` flag on cert-manager controller to true. (There is a corresponding `--cluster-issuer-ambient-credentials` flag which is set to `true` by default).
323327

324328
If you are using this authentication mechanism and ambient credentials are not enabled, you will see this error:
329+
325330
```bash
326-
error instantiating azuredns challenge solver: ClientID is not set but neither --cluster-issuer-ambient-credentials nor --issuer-ambient-credentials are set.
331+
error instantiating azuredns challenge solver: ClientID was omitted without providing one of `--cluster-issuer-ambient-credentials` or `--issuer-ambient-credentials`. These are necessary to enable Azure Managed Identities
327332
```
328333

329-
These are necessary to enable Azure Managed Identities.
330-
331334
## Managed Identity Using AKS Kubelet Identity
332335

333336
When creating an AKS cluster in Azure there is the option to use a managed identity that is assigned to the kubelet. This identity is assigned to the underlying node pool in the AKS cluster and can then be used by the cert-manager pods to authenticate to Azure Active Directory.
@@ -420,19 +423,18 @@ To create the service principal you can use the following script (requires
420423
`azure-cli` and `jq`):
421424

422425
```bash
423-
# Choose a name for the service principal that contacts azure DNS to present
424-
# the challenge.
425-
$ AZURE_CERT_MANAGER_NEW_SP_NAME=NEW_SERVICE_PRINCIPAL_NAME
426+
# Choose a name for the service principal that contacts azure DNS to present the challenge.
427+
AZURE_CERT_MANAGER_NEW_SP_NAME=NEW_SERVICE_PRINCIPAL_NAME
426428
# This is the name of the resource group that you have your dns zone in.
427-
$ AZURE_DNS_ZONE_RESOURCE_GROUP=AZURE_DNS_ZONE_RESOURCE_GROUP
429+
AZURE_DNS_ZONE_RESOURCE_GROUP=AZURE_DNS_ZONE_RESOURCE_GROUP
428430
# The DNS zone name. It should be something like domain.com or sub.domain.com.
429-
$ AZURE_DNS_ZONE=AZURE_DNS_ZONE
431+
AZURE_DNS_ZONE=AZURE_DNS_ZONE
430432

431-
$ DNS_SP=$(az ad sp create-for-rbac --name $AZURE_CERT_MANAGER_NEW_SP_NAME --output json)
432-
$ AZURE_CERT_MANAGER_SP_APP_ID=$(echo $DNS_SP | jq -r '.appId')
433-
$ AZURE_CERT_MANAGER_SP_PASSWORD=$(echo $DNS_SP | jq -r '.password')
434-
$ AZURE_TENANT_ID=$(echo $DNS_SP | jq -r '.tenant')
435-
$ AZURE_SUBSCRIPTION_ID=$(az account show --output json | jq -r '.id')
433+
DNS_SP=$(az ad sp create-for-rbac --name $AZURE_CERT_MANAGER_NEW_SP_NAME --output json)
434+
AZURE_CERT_MANAGER_SP_APP_ID=$(echo $DNS_SP | jq -r '.appId')
435+
AZURE_CERT_MANAGER_SP_PASSWORD=$(echo $DNS_SP | jq -r '.password')
436+
AZURE_TENANT_ID=$(echo $DNS_SP | jq -r '.tenant')
437+
AZURE_SUBSCRIPTION_ID=$(az account show --output json | jq -r '.id')
436438
```
437439

438440
For security purposes, it is appropriate to utilize RBAC to ensure that you
@@ -444,37 +446,37 @@ so that it can read/write the \_acme\_challenge TXT records to the zone.
444446
Lower the Permissions of the service principal.
445447

446448
```bash
447-
$ az role assignment delete --assignee $AZURE_CERT_MANAGER_SP_APP_ID --role Contributor
449+
az role assignment delete --assignee $AZURE_CERT_MANAGER_SP_APP_ID --role Contributor
448450
```
449451

450452
Give Access to DNS Zone.
451453

452454
```bash
453-
$ DNS_ID=$(az network dns zone show --name $AZURE_DNS_ZONE --resource-group $AZURE_DNS_ZONE_RESOURCE_GROUP --query "id" --output tsv)
454-
$ az role assignment create --assignee $AZURE_CERT_MANAGER_SP_APP_ID --role "DNS Zone Contributor" --scope $DNS_ID
455+
DNS_ID=$(az network dns zone show --name $AZURE_DNS_ZONE --resource-group $AZURE_DNS_ZONE_RESOURCE_GROUP --query "id" --output tsv)
456+
az role assignment create --assignee $AZURE_CERT_MANAGER_SP_APP_ID --role "DNS Zone Contributor" --scope $DNS_ID
455457
```
456458

457459
Check Permissions. As the result of the following command, we would like to see just one object in the permissions array with "DNS Zone Contributor" role.
458460

459461
```bash
460-
$ az role assignment list --all --assignee $AZURE_CERT_MANAGER_SP_APP_ID
462+
az role assignment list --all --assignee $AZURE_CERT_MANAGER_SP_APP_ID
461463
```
462464

463465
A secret containing service principal password should be created on Kubernetes to facilitate presenting the challenge to Azure DNS. You can create the secret with the following command:
464466

465467
```bash
466-
$ kubectl create secret generic azuredns-config --from-literal=client-secret=$AZURE_CERT_MANAGER_SP_PASSWORD
468+
kubectl create secret generic azuredns-config --from-literal=client-secret=$AZURE_CERT_MANAGER_SP_PASSWORD
467469
```
468470

469471
Get the variables for configuring the issuer.
470472

471473
```bash
472-
$ echo "AZURE_CERT_MANAGER_SP_APP_ID: $AZURE_CERT_MANAGER_SP_APP_ID"
473-
$ echo "AZURE_CERT_MANAGER_SP_PASSWORD: $AZURE_CERT_MANAGER_SP_PASSWORD"
474-
$ echo "AZURE_SUBSCRIPTION_ID: $AZURE_SUBSCRIPTION_ID"
475-
$ echo "AZURE_TENANT_ID: $AZURE_TENANT_ID"
476-
$ echo "AZURE_DNS_ZONE: $AZURE_DNS_ZONE"
477-
$ echo "AZURE_DNS_ZONE_RESOURCE_GROUP: $AZURE_DNS_ZONE_RESOURCE_GROUP"
474+
echo "AZURE_CERT_MANAGER_SP_APP_ID: $AZURE_CERT_MANAGER_SP_APP_ID"
475+
echo "AZURE_CERT_MANAGER_SP_PASSWORD: $AZURE_CERT_MANAGER_SP_PASSWORD"
476+
echo "AZURE_SUBSCRIPTION_ID: $AZURE_SUBSCRIPTION_ID"
477+
echo "AZURE_TENANT_ID: $AZURE_TENANT_ID"
478+
echo "AZURE_DNS_ZONE: $AZURE_DNS_ZONE"
479+
echo "AZURE_DNS_ZONE_RESOURCE_GROUP: $AZURE_DNS_ZONE_RESOURCE_GROUP"
478480
```
479481

480482
To configure the issuer, substitute the capital cased variables with the values

content/docs/tutorials/getting-started-aks-letsencrypt/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: |
66
using the DNS-01 protocol and Azure DNS with workload identity federation.
77
---
88

9-
*Last Verified: 11 January 2024*
9+
*Last Verified: 28 February 2026*
1010

1111
In this tutorial you will learn how to deploy and configure cert-manager on Azure Kubernetes Service (AKS)
1212
and how to deploy an HTTPS web server and make it available on the Internet.
@@ -358,10 +358,10 @@ az aks update \
358358
359359
## Reconfigure cert-manager
360360

361-
We will label the cert-manager controller Pod and ServiceAccount for the attention of the Azure Workload Identity webhook,
361+
We will label the cert-manager controller Pod for the attention of the Azure Workload Identity webhook,
362362
which will result in the cert-manager controller Pod having an extra volume containing a Kubernetes ServiceAccount token which it will use to authenticate with Azure.
363363

364-
The labels can be configured using the Helm values file below:
364+
The label can be configured using the Helm values file below:
365365

366366
```yaml file=../../../../public/docs/tutorials/getting-started-aks-letsencrypt/values.yaml
367367
```
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
# values.yaml
22
podLabels:
33
azure.workload.identity/use: "true"
4-
serviceAccount:
5-
labels:
6-
azure.workload.identity/use: "true"

0 commit comments

Comments
 (0)