az Verified current stable Not installed? Cloud Infrastructure

Az / List Aks Clusters

List Aks Clusters

Lists Azure Kubernetes Service clusters.

$
Terminal
az aks list -g <resource_group>

When To Use

During infrastructure audits or inventory assessments.

Pro Tip

Pipe outputs to `grep` to filter specific cluster names in extensive environments for efficiency.

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
| Name               | ResourceGroup        | Location     | ProvisioningState |
|--------------------|----------------------|--------------|-------------------|
| MyAKSCluster1      | myResourceGroup      | eastus       | Succeeded         |
| MyAKSCluster2      | myOtherResourceGroup | westus       | Succeeded         |

Anatomy of Output

Understanding the result

Name ResourceGroup Location ProvisioningState Header

Column headers indicating the properties of each AKS cluster.

MyAKSCluster MyResourceGroup eastus Succeeded Cluster Information

Displays the cluster name, the resource group it belongs to, its location, and provisioning status.

Power User Variants

Optimized versions

az aks list -g resource_group

List AKS clusters in a specific resource group.

az aks list --query '[].{name:name, state:provisioningState}'

Query specific fields for a cleaner output.

Troubleshooting

Common pitfalls

Error: resource group not found.

Solution: Verify the resource group name and its existence.

Your subscription is invalid.

Solution: Check the active Azure subscription and authentication.

No Azure Kubernetes Service clusters found.

Solution: Confirm that AKS clusters exist in the target subscription.

Command Breakdown

What each part is doing

az
Base Command
The executable that performs this operation. Here it runs Az before the shell applies any redirect operators.
-g
g| resource group
The value supplied for g| resource group.
<resource_group>
resource group
The value supplied for resource group.
-g
Command Option
Tool-specific option used by this command invocation.

How To Run

Execution path

  1. Step 1

    Run the command: az aks list --resource-group myResourceGroup

  2. Step 2

    Verify output shows the expected AKS clusters in the specified resource group.

Alternative Approaches

Comparable commands in other tools

Alternative cloud infrastructure tools for the same job.