Skip to content

Commit 7c26dae

Browse files
Update troubleshoot-aks-control-plane-authentication-external-identity-providers.md
1 parent a5303d7 commit 7c26dae

1 file changed

Lines changed: 44 additions & 42 deletions

File tree

support/azure/azure-kubernetes/security/troubleshoot-aks-control-plane-authentication-external-identity-providers.md

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ This article helps you troubleshoot authentication issues when accessing the Azu
2020

2121
## Prerequisites
2222

23-
- Azure CLI version 2.61.0 or later. To find the version run `az --version` . If you need to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
24-
- A tool to connect to the Kubernetes cluster, such as the `kubectl` tool. To install `kubectl` using the Azure CLI, run the [az aks install-cli](/cli/azure/aks#az-aks-install-cli) command.
23+
- Azure CLI version 2.61.0 or later. To determine the version, run `az --version`. If you need to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
24+
- A tool to connect to the Kubernetes cluster, like the `kubectl` tool. To install `kubectl` using Azure CLI, run the [az aks install-cli](/cli/azure/aks#az-aks-install-cli) command.
2525
- The JSON Web Token (JWT) authenticator configuration file used for your AKS cluster.
2626
- Access to [jwt.ms][jwt-ms] or a similar JWT token decoder tool for debugging tokens.
2727

2828
## Troubleshooting checklist
2929

3030
### Step 1: Verify identity provider configuration
3131

32-
Ensure your identity provider is correctly configured and accessible:
32+
Ensure your identity provider is correctly configured and accessible. Use the following steps.
3333

3434
::: zone pivot="github"
3535

36-
1. Verify your GitHub repository has Actions enabled.
36+
1. Verify your GitHub repository has **Actions** enabled.
3737
2. Confirm the OpenID Connect (OIDC) provider settings are correctly configured in your workflow.
3838
3. Ensure the audience claim in your workflow matches the authenticator configuration.
3939

@@ -47,9 +47,9 @@ Verify the OAuth 2.0 client ID and client secret are correct.
4747

4848
### Step 2: Validate the issuer URL
4949

50-
The issuer URL must be accessible from the AKS cluster nodes:
50+
The issuer URL must be accessible from the AKS cluster nodes. Use the following steps.
5151

52-
1. Verify DNS resolution for the issuer URL:
52+
1. Verify DNS resolution for the issuer URL.
5353

5454
::: zone pivot="github"
5555

@@ -67,7 +67,7 @@ The issuer URL must be accessible from the AKS cluster nodes:
6767

6868
::: zone-end
6969

70-
2. Test network connectivity from a cluster node:
70+
2. Test network connectivity from a cluster node.
7171

7272
::: zone pivot="github"
7373

@@ -89,11 +89,11 @@ The issuer URL must be accessible from the AKS cluster nodes:
8989

9090
### Step 3: Inspect the JWT authenticator configuration
9191

92-
Review your JWT authenticator configuration for common issues:
92+
Review your JWT authenticator configuration for common issues. Use the following steps.
9393

9494
1. Verify the issuer URL exactly matches the `iss` claim in your tokens.
9595
2. Check that the audience claim in the configuration matches the `aud` claim in your tokens.
96-
3. Ensure CEL (Common Expression Language) expressions in claim mappings are syntactically correct.
96+
3. Ensure Common Expression Language (CEL) expressions in claim mappings are syntactically correct.
9797
4. Confirm that all username and group mappings include the `aks:jwt:` prefix.
9898

9999
Example configuration:
@@ -175,11 +175,11 @@ Example configuration:
175175

176176
### Step 4: Decode and verify JWT tokens
177177

178-
To verify claims obtain and inspect the JWT token:
178+
Verify claims and obtain and inspect the JWT token. Use the following steps.
179179

180180
::: zone pivot="github"
181181

182-
1. For GitHub Actions OIDC, tokens are typically obtained within a workflow. You can obtain a token for testing using:
182+
1. For GitHub Actions OIDC, tokens are typically obtained within a workflow. Obtain a token.
183183

184184
```bash
185185
# This is typically done within a GitHub Actions workflow
@@ -192,7 +192,7 @@ To verify claims obtain and inspect the JWT token:
192192

193193
::: zone pivot="google-identity"
194194

195-
1. Get a token from Google Identity:
195+
1. Get a token from Google Identity.
196196

197197
```bash
198198
kubectl oidc-login get-token \
@@ -203,19 +203,20 @@ To verify claims obtain and inspect the JWT token:
203203

204204
::: zone-end
205205

206-
2. Decode the token at [jwt.ms][jwt-ms] and verify:
207-
- The `iss` claim matches your issuer URL exactly
208-
- The `aud` claim matches your configured audience
209-
- The token isn't expired (`exp` claim)
210-
- Required claims for username and groups are present
211-
- Claims match the format expected by your CEL expressions
206+
2. Decode the token at [jwt.ms][jwt-ms] and verify the following:
207+
208+
- The `iss` claim matches your issuer URL exactly.
209+
- The `aud` claim matches your configured audience.
210+
- The token isn't expired (`exp` claim).
211+
- Required claims for username and groups are present.
212+
- Claims match the format expected by your CEL expressions.
212213

213214
### Step 5: Check AKS API server logs
214215

215-
Review the AKS API server logs for authentication errors:
216+
Review the AKS API server logs for authentication errors. Use the following steps.
216217

217-
1. Use diagnostic settings to [enable resource logs][aks-resource-logs] for your AKS cluster. Choose 'Kubernetes API Server' when creating the diagnostic setting.
218-
2. Check logs in Azure Monitor or Log Analytics for authentication failures.
218+
1. Use diagnostic settings to [enable resource logs][aks-resource-logs] for your AKS cluster. Choose **Kubernetes API Server** when creating the diagnostic setting.
219+
2. Check logs in Azure Monitor or Azure Log Analytics for authentication failures.
219220
3. Look for error messages related to JWT validation or claim mapping.
220221

221222
## Common issues and solutions
@@ -226,9 +227,9 @@ Review the AKS API server logs for authentication errors:
226227

227228
The audience claim in the token doesn't match the configured audience in the JWT authenticator.
228229

229-
#### Solution: Update the authenticator configuration
230+
### Solution: Update the authenticator configuration
230231

231-
Verify the audience claim in your token and update the JWT authenticator configuration:
232+
Verify the audience claim in your token and update the JWT authenticator configuration.
232233

233234
```azurecli-interactive
234235
az aks jwtauthenticator update \
@@ -242,15 +243,15 @@ az aks jwtauthenticator update \
242243

243244
The issuer URL in the configuration doesn't exactly match the `iss` claim in the token.
244245

245-
#### Solution: Correct the issuer URL
246+
### Solution: Correct the issuer URL
246247

247248
Update the issuer URL in your JWT authenticator configuration file to match the exact issuer in your tokens, including the protocol (https://) and any trailing slashes.
248249

249250
**Cause 3: Identity provider misconfiguration**
250251

251252
The OAuth client or OIDC provider settings are incorrect.
252253

253-
#### Solution: Verify identity provider settings
254+
### Solution: Verify identity provider settings
254255

255256
::: zone pivot="github"
256257

@@ -273,13 +274,13 @@ The OAuth client or OIDC provider settings are incorrect.
273274

274275
CEL expressions might have syntax errors or return unexpected data types.
275276

276-
#### Solution: Validate CEL expressions
277+
### Solution: Validate CEL expressions
277278

278279
1. Review the CEL expressions in your configuration.
279280
2. Test expressions using a CEL evaluator to ensure they return strings for username and arrays of strings for groups.
280281
3. Update the configuration with corrected expressions:
281282

282-
Example of a valid CEL expression for extracting groups:
283+
The following is an example of a valid CEL expression for extracting groups:
283284

284285
```json
285286
{
@@ -296,15 +297,15 @@ CEL expressions might have syntax errors or return unexpected data types.
296297

297298
Network security groups, firewalls, or Domain Name System (DNS) issues prevent the cluster from accessing the identity provider.
298299

299-
#### Solution 1: Verify DNS resolution
300+
### Solution 1: Verify DNS resolution
300301

301-
1. Connect to a cluster node using `kubectl debug`:
302+
1. Connect to a cluster node using `kubectl debug`.
302303

303304
```bash
304305
kubectl debug node/<node-name> -it --image=mcr.microsoft.com/azurelinux/base/core:3.0
305306
```
306307

307-
2. Test DNS resolution:
308+
2. Test DNS resolution.
308309

309310
::: zone pivot="github"
310311

@@ -322,19 +323,19 @@ Network security groups, firewalls, or Domain Name System (DNS) issues prevent t
322323

323324
::: zone-end
324325

325-
#### Solution 2: Update network security rules
326+
### Solution 2: Update network security rules
326327

327-
1. Review network security group (NSG) rules associated with your AKS cluster.
328+
1. Review network security group rules associated with your AKS cluster.
328329
2. Ensure outbound HTTPS (port 443) traffic is allowed to your identity provider's domain.
329330
3. If using Azure Firewall, add application rules for the identity provider URLs.
330331

331-
### Issue 4: Missing aks:jwt: prefix in username or groups
332+
### Issue 4: Missing `aks:jwt:` prefix in username or groups
332333

333334
**Cause: Claim mappings don't include the required prefix**
334335

335336
All usernames and groups must be prefixed with `aks:jwt:` to prevent conflicts with other authentication methods.
336337

337-
#### Solution: Add the required prefix
338+
### Solution: Add the required prefix
338339

339340
Update your JWT authenticator configuration to include the `aks:jwt:` prefix. For example:
340341

@@ -419,7 +420,7 @@ Create a file named `jwt-config.json` with the following configuration:
419420

420421
::: zone-end
421422

422-
Then update the authenticator:
423+
Then update the authenticator.
423424

424425
```azurecli-interactive
425426
az aks jwtauthenticator update \
@@ -436,13 +437,14 @@ az aks jwtauthenticator update \
436437
To get more detailed information about authentication failures:
437438

438439
1. Enable diagnostic settings on your AKS cluster.
439-
2. Configure Log Analytics workspace to capture 'Kubernetes API Server' logs.
440-
3. Check API server logs for any JWT authenticator related issue such as incorrect claim mappings leading to validation errors.
440+
2. Configure the Log Analytics workspace to capture `Kubernetes API Server` logs.
441+
3. Check API server logs for any JWT authenticator-related issue like incorrect claim mappings leading to validation errors.
442+
443+
### Resources
441444

442-
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]
445+
- [jwt-ms]: https://jwt.ms
446+
- [aks-resource-logs](/azure/aks/monitor-aks-reference#supported-resource-logs-for-microsoftcontainerservicemanagedclusters)
443447

444-
<!-- LINKS - external -->
445-
[jwt-ms]: https://jwt.ms
448+
[!INCLUDE [Azure Help Support](~/includes/azure-help-support.md)]
446449

447-
<!-- LINKS - internal -->
448-
[aks-resource-logs](/azure/aks/monitor-aks-reference#supported-resource-logs-for-microsoftcontainerservicemanagedclusters)
450+
[!INCLUDE [Third-party contact disclaimer](~/includes/third-party-contact-disclaimer.md)]

0 commit comments

Comments
 (0)