Below mentioned are the command to connect to an aks cluster via Powershell. once you are connected to that cluster then you run the kubectl commands to perform different operations on the Kubernetes resource.
Connect to azure cli and do do that you need to login to azure using the following command.
az login
After you are logged in make sure you are pointing to the right subscription. you can verifying that by running the command
az account show
once you verify that then you are in correct subscription then you need to pull the credentials file from AKS so that you can use kubernetes cli commands. Run the following command to do that
az aks get-credentials -g aks_cluster_resourcegroup -n aks_cluster_name --admin
This will get you admin credentials to your cluster and it will also point your kubernetes cli to this cluster. Last step is to verify that you are connected against the correct cluster and to do that you should run
kubectl config current-context
This will give you the name of the cluster that you are working against. That’s all for this article.