List all AKS and ARO clusters in Azure subscription
List all AKS and ARO clusters in your Azure subscription with detailed information, connection commands, and cost estimates.
/plugin marketplace add kcns008/cluster-code/plugin install kcns008-cloud-azure-plugins-cloud-azure@kcns008/cluster-codeList all AKS and ARO clusters in your Azure subscription with detailed information.
az account show --output json
az loginIf --type is "aks" or "all":
az aks list \
${RESOURCE_GROUP:+--resource-group $RESOURCE_GROUP} \
--output json
Extract for each AKS cluster:
If --type is "aro" or "all":
az aro list \
${RESOURCE_GROUP:+--resource-group $RESOURCE_GROUP} \
--output json
Extract for each ARO cluster:
Azure Clusters in Subscription: <subscription-name> (<subscription-id>)
AKS CLUSTERS:
┌─────────────────┬─────────────────┬──────────┬─────────┬───────┬──────────┐
│ Name │ Resource Group │ Location │ Version │ Nodes │ State │
├─────────────────┼─────────────────┼──────────┼─────────┼───────┼──────────┤
│ prod-aks-001 │ production-rg │ eastus │ 1.28.9 │ 5 │ Succeeded│
│ dev-aks-001 │ development-rg │ westus2 │ 1.28.5 │ 3 │ Succeeded│
└─────────────────┴─────────────────┴──────────┴─────────┴───────┴──────────┘
ARO CLUSTERS:
┌─────────────────┬─────────────────┬──────────┬─────────┬──────────┐
│ Name │ Resource Group │ Location │ Version │ State │
├─────────────────┼─────────────────┼──────────┼─────────┼──────────┤
│ prod-aro-001 │ production-rg │ eastus2 │ 4.15.0 │ Succeeded│
└─────────────────┴─────────────────┴──────────┴─────────┴──────────┘
Total: 3 clusters (2 AKS, 1 ARO)
Quick Connect:
cluster-code connect azure --name prod-aks-001 --resource-group production-rg
cluster-code connect azure --name prod-aro-001 --resource-group production-rg
If --format json, output structured JSON:
{
"subscription": {
"id": "...",
"name": "..."
},
"clusters": {
"aks": [
{
"name": "prod-aks-001",
"resourceGroup": "production-rg",
"location": "eastus",
"kubernetesVersion": "1.28.9",
"nodeCount": 5,
"provisioningState": "Succeeded",
"fqdn": "prod-aks-001-dns-12345678.hcp.eastus.azmk8s.io",
"powerState": "Running"
}
],
"aro": [
{
"name": "prod-aro-001",
"resourceGroup": "production-rg",
"location": "eastus2",
"openshiftVersion": "4.15.0",
"provisioningState": "Succeeded",
"consoleUrl": "https://console-openshift-console.apps.prod-aro-001.example.com",
"apiServerUrl": "https://api.prod-aro-001.example.com:6443"
}
]
},
"summary": {
"total": 3,
"aks": 2,
"aro": 1,
"running": 3,
"stopped": 0
}
}
For each cluster, optionally show:
Cost Estimate (if requested):
az consumption usage list \
--start-date $(date -d '30 days ago' +%Y-%m-%d) \
--end-date $(date +%Y-%m-%d) \
| grep <cluster-name>
Node Pool Details (AKS):
az aks nodepool list \
--resource-group <resource-group> \
--cluster-name <cluster-name>
Add-ons Status (AKS):
az aks addon list \
--resource-group <resource-group> \
--name <cluster-name>
No clusters found:
ℹ️ No clusters found in subscription.
Create a new cluster:
cluster-code azure-cluster-create --type aks --name my-cluster --resource-group my-rg
Authentication error:
⚠️ Not authenticated to Azure.
Run: az login
Insufficient permissions:
⚠️ Insufficient permissions to list clusters.
Required role: Reader or higher on subscription/resource group