Solution to Azure Kubernetes Service version not supported exception - Version x.x.x is not supported in this region.

I got this error while deploying a new Azure Kubernetes Cluster.

      "message":"The template deployment 'memealyzerdev3' is not valid according to the validation procedure. The tracking id is 'f9b96b8f-de17-4c81-be8f-e7e0d8253e29'. See inner errors for details.",
            "message":"Provisioning of resource(s) for container service memealyzerdev3aks in resource group memealyzerdev3rg failed. Message: {\n  \"code\": \"AgentPoolK8sVersionNotSupported\",\n  \"message\": \"Version 1.19.3 is not supported in this region. Please use [az aks get-versions] command to get the supported version list in this region. For more information, please check\"\n }. Details: "

The error message recommends using az aks get-versions, but that just dumps a bunch of JSON without much direction.

Here’s the Azure CLI command I used to get the version.

az aks get-versions --location westus2 --query "orchestrators" -o table

This tells the Azure CLI to only output the orchestrators array in table format.

OrchestratorType    OrchestratorVersion    Default    IsPreview
------------------  ---------------------  ---------  -----------
Kubernetes          1.17.13
Kubernetes          1.17.16
Kubernetes          1.18.10
Kubernetes          1.18.14                True
Kubernetes          1.19.6
Kubernetes          1.19.7
Kubernetes          1.20.2                            True

From there you can decide which version you want to use and if you want to use the IsPreview version.