<p>I am looking for a programmatic way to get available Kubernetes versions in a given Azure region using .NET SDKs. Something similar to the following Azure CLI command:</p>
<pre class="lang-sh prettyprint-override"><code>az aks get-versions --location eastus --output table
</code></pre>
<p>I am currently using <code>Microsoft.Azure.Management.ContainerService.Fluent.ContainerServiceManagementClient</code> class to create clusters and get details of existing cluster. But that does not seem to expose any way to get available Kubernetes versions in a region.</p>

<p>You can use <a href="https://learn.microsoft.com/en-us/rest/api/aks/managedclusters/get" rel="nofollow noreferrer"><strong><code>REST API</code></strong></a></p>
<pre><code>public static async Task&lt;string&gt; GetAksVersions(string token, string subscriptionId, string location)
    {
        var aksVersionsUri = $&quot;https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/orchestrators?api-version=2017-09-30&amp;resource-type=managedClusters&quot;;
        var json = await ExecuteGetOnAzureApi(aksVersionsUri, token);
        return json;
    }
</code></pre>
