Accessing Azure Cli from Prowershell in devops pipeline
I'm guessing you are working with hosted agents, therefore, you need to configure kube.config
on the hosted agent.
in order to do that, run az aks get-credentials --name $(CLUSTER_NAME) --resource-group $(RESOURCE_GROUP_NAME)
. The easiest way is to use Azure CLI
task. Be aware that this task required authorization from Azure DevOps to Azure.More info can be found here.
In case you are the subscription owner- select your subscription and click on Authorize
.
When the kube.config
configured on the hosted agent, you can run any kubectl
command you wish (Using Powershell\Bash\CMD).