在Azure AKS创建托管Kubernetes集群时遇"Incorrect padding"错误
I’ve run into this exact "Incorrect padding" error a few times when working with Azure CLI in PowerShell, so let’s walk through the most likely fixes to get your AKS cluster up and running:
Clear and re-authenticate your Azure CLI session
More often than not, this error stems from corrupted cached credentials or authentication tokens. Reset your session with these commands:az account clear az loginAfter logging back in with your Azure credentials, retry the
az aks createcommand. This replaces any damaged tokens with fresh, valid ones.Update Azure CLI to the latest version
Outdated CLI versions can have compatibility quirks with PowerShell’s environment. Bring it up to date using:az upgradeFollow the prompts to finish the upgrade, then restart PowerShell before trying to create the cluster again.
Check for proxy or network interference
If you’re on a corporate network with a proxy, it can sometimes mangle authentication data. Verify your Azure CLI proxy settings withaz configure --listto ensure they’re correctly set. If possible, temporarily disable the proxy (if allowed) to test if that resolves the padding error.Double-check resource group validity
Even though you can see the resource group in the Azure portal, confirm it’s properly recognized by the CLI with:az group list --query "[?name=='cb_aks_spike']"If the resource group details appear, the name isn’t the issue—skip ahead to the other fixes.
After trying these steps, your az aks create --resource-group cb_aks_spike --name cbakscluster command should execute without the padding error.
内容的提问来源于stack exchange,提问作者Matthew Groves

