Skip to content

Commit be92654

Browse files
authored
Merge pull request #187734 from zr-msft/zr-aks-escape-secret-chars
[AKS] add special char escape in SP secret
2 parents 494b11c + 8fbd5e6 commit be92654

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

articles/aks/troubleshooting.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ Use the following workarounds for this issue:
186186

187187
This issue is due to the expiration of service principal credentials. [Update the credentials for an AKS cluster.](update-credentials.md)
188188

189+
## I'm getting `"The credentials in ServicePrincipalProfile were invalid."` or `"error:invalid_client AADSTS7000215: Invalid client secret is provided."`
190+
This is caused by special characters in the value of the client secret that have not been escaped properly. Refer to [escape special characters when updating AKS Service Principal credentials.](update-credentials.md#update-aks-cluster-with-new-service-principal-credentials)
191+
189192
## I can't access my cluster API from my automation/dev machine/tooling when using API server authorized IP ranges. How do I fix this problem?
190193

191194
To resolve this issue, ensure `--api-server-authorized-ip-ranges` includes the IP(s) or IP range(s) of automation/dev/tooling systems being used. Refer section 'How to find my IP' in [Secure access to the API server using authorized IP address ranges](api-server-authorized-ip-ranges.md).

articles/aks/update-credentials.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,12 @@ az aks update-credentials \
103103
--name myAKSCluster \
104104
--reset-service-principal \
105105
--service-principal "$SP_ID" \
106-
--client-secret "$SP_SECRET"
106+
--client-secret "${SP_SECRET:Q}"
107107
```
108108

109+
> [!NOTE]
110+
> `${SP_SECRET:Q}` escapes any special characters in `SP_SECRET`, which can cause the command to fail. The above example works for Azure Cloud Shell and zsh terminals. For BASH terminals, use `${SP_SECRET@Q}`.
111+
109112
For small and midsize clusters, it takes a few moments for the service principal credentials to be updated in the AKS.
110113

111114
## Update AKS Cluster with new Azure AD Application credentials

0 commit comments

Comments
 (0)