<p>I'm currently working on a pipeline job that requires kubernetes access through powershell.
The only issue is that I need to sign in for Az cli. For testing I'm using my personal credentials, clearly not a good definitive option. Are there any other options for Azure cli login that could be used instead?
<a href="https://i.stack.imgur.com/joYks.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/joYks.jpg" alt="enter image description here"></a></p>

<p>I'm guessing you are working with hosted agents, therefore, you need to configure <code>kube.config</code> on the hosted agent.</p>

<p>in order to do that, run <code>az aks get-credentials --name $(CLUSTER_NAME) --resource-group $(RESOURCE_GROUP_NAME)</code>. The easiest way is to use <code>Azure CLI</code> task. Be aware that this task required authorization from Azure DevOps to Azure.
More info can be found <a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&amp;tabs=yaml" rel="nofollow noreferrer">here</a>.</p>

<p>In case you are the subscription owner- select your subscription and click on <code>Authorize</code>.</p>

<p><a href="https://i.stack.imgur.com/VFXmZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VFXmZ.png" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/6WdOT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6WdOT.png" alt="enter image description here"></a></p>

<p>When the <code>kube.config</code> configured on the hosted agent, you can run any <code>kubectl</code> command you wish (Using Powershell\Bash\CMD).</p>

<p><a href="https://i.stack.imgur.com/pncRu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pncRu.png" alt="enter image description here"></a></p>
