question

MinorMona-1054 avatar image
0 Votes"
MinorMona-1054 asked PopLIU-6371 commented

How to get AKS VMSS name

i have create a AKS using terraform, once the cluster is created, i ran the command



az vmss list -g <node-resource-group-name> --query [0].name -o tsv

but this command has given no result, but the expectation was to get the VMSS name.

azure-kubernetes-service
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

learn2skills avatar image
0 Votes"
learn2skills answered MinorMona-1054 commented

Hi @MinorMona-1054

To view a list of VM instance in a scale set, use az vmss list-instances. The following example lists all VM instances in the scale set named myScaleSet in the myResourceGroup resource group. Provide your own values for these names:

 az vmss list-instances \
     --resource-group myResourceGroup \
     --name myScaleSet \
     --output table

Manage a virtual machine scale set with the Azure CLI
https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-manage-cli



If the Answer is helpful, please click Accept Answer and up-vote, this can be beneficial to other community members.



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

hi @learn2skills thank you for your reply but , i have asked for how to get aks vmss's name.

i am not looking to get instances of every VMSS.

i am unable to get vmss name by running above command that i provided.

0 Votes 0 ·
srbose-msft avatar image
3 Votes"
srbose-msft answered PopLIU-6371 commented

@MinorMona-1054 , Your question is answered at https://stackoverflow.com/a/68095827/16169604

Please use the following commands to get the name of the vmss associated with an AKS nodepool:

  1. az aks nodepool list -g $ClusterRG --cluster-name $ClusterName -o table
    Get the desired node pool name from the output. We shall refer to this later as <NODE_POOL_NAME>

  2. CLUSTER_RESOURCE_GROUP=$(az aks show --resource-group YOUR_Resource_Group --name YOUR_AKS_Cluster --query nodeResourceGroup -o tsv)

  3. az vmss list -g $CLUSTER_RESOURCE_GROUP --query "[?tags.poolName =='<NODE_POOL_NAME>'].{VMSS_Name:name}" -o tsv


Hope this helps.

Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Verified this works! Thanks!

0 Votes 0 ·