<p>I have an AKS cluster and it's private. I want to access it from my local and i added necessary commands for kubeconfig. Now, i can list pods with invoke command. But i want to access directly like kubectl get pods command. (i dont want do alias)</p>
<pre><code>az aks command invoke \
  --resource-group rg-network-spokes \
  --name aks_dev_cluster \
  --command &quot;kubectl get pods -A&quot;
</code></pre>

The Engineer
<p>If your aks cluster is private, it means its controle plane is not exposed on internet and therefore you can not use kubectl to interact with the API without being into the same vnet as your cluster</p>
<p><a href="https://i.stack.imgur.com/W5Fsl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W5Fsl.png" alt="enter image description here" /></a></p>
<p>You have a few <a href="https://learn.microsoft.com/en-us/azure/aks/private-clusters#options-for-connecting-to-the-private-cluster" rel="nofollow noreferrer">options</a> to do so, such as :</p>
<ul>
<li>Create a VM in the same VNET as your cluster and install kubectl client</li>
<li>Create a VPN to connect your computer on the aks's network</li>
</ul>
<p>If you are starting with Azure, I would suggest going with the first option as setting up a VPN can be a bit more tedious.</p>
