Managed Azure Kubernetes Service

Connect to the cluster

Connect to your Azure Kubernetes Service (AKS) cluster using Azure CLI commands.

On this page

Overview

This guide helps you connect to your Azure Kubernetes Service (AKS) cluster using Azure CLI commands.

Prerequisites

  • Azure account with necessary privileges.
  • Azure Cloud Shell / Any CLI

Connect to the AKS cluster

Log in to Azure

Go to the Azure Portal and login.

Open your Azure Cloud Shell by clicking the following button:

Azure Cloud Shell

Follow the browser prompt and use your Microsoft SSO login to authenticate.

Set Azure Subscription

Note

For convenience, Azure provides the commands below prefilled in the Azure Portal under your Kubernetes services resource's Connect section. Copy and paste the commands from there to avoid doing these steps manually

Run the following command in your cloud shell, replacing <subscription-id> with your Azure subscription ID:

Terminal
az account set --subscription <subscription-id>

Get AKS Credentials

Replace <resource-group-name> and <cluster-name> with your resource group and cluster name, respectively:

Terminal
az aks get-credentials --resource-group <resource-group-name> --name <cluster-name>

Convert KubeConfig for Azure AD Integration

Use kubelogin to convert your kubeconfig:

Terminal
kubelogin convert-kubeconfig -l azurecli

Conclusion

After executing these commands, you will be connected to your AKS cluster and can start managing it via kubectl.

Next steps

Last updated 2 November 2026 Edit this page on GitHub
Esc