<p>What happened:
We're on AKS with RBAC enabled. Executing any kubectl/helm command that connects to the k8s cluster, I have to reauthenticate. Output:</p>
<p><code>To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXX to authenticate.</code>
This succeeds but then when I execute the next kubectl command I have to reauthenticate again.</p>
<p>What you expected to happen:
Authenticate and use that token for more than one command.</p>
<p>How to reproduce it (as minimally and precisely as possible):</p>
<p>Get credentials and then execute any kubectl command.</p>
<p>Anything else we need to know?:</p>
<p>Environment:</p>
<pre><code>Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;19&quot;, GitVersion:&quot;v1.19.0&quot;, GitCommit:&quot;e199641833566e5d052d1f1fa930c4d7575bd50&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2020-08-26T14:30:33Z&quot;, GoVersion:&quot;go1.15&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
</code></pre>
<p>On one of the git answer (<a href="https://github.com/Azure/AKS/issues/1057" rel="nofollow noreferrer">https://github.com/Azure/AKS/issues/1057</a>), I found that we have to remove config.lock to resolve the issue, but there is no such file in my case.
Help appreciated !</p>

keshav goyal
<p>I recommend using <a href="https://learn.microsoft.com/en-us/cli/azure/authenticate-azure-cli" rel="nofollow noreferrer"><code>az login</code></a> An auth token is cached locally on your environment and should give you access to your Kubernetes cluster.</p>
<p>Then follow the Microsoft <a href="https://learn.microsoft.com/en-us/azure/aks/kubernetes-walkthrough#connect-to-the-cluster" rel="nofollow noreferrer">docs</a> to install <code>kubectl</code>.</p>
<pre><code>az aks install-cli
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
</code></pre>
