0
votes

Is there a way for an instance in a Virtual Machine Scale Set to discover the other instances (private IP addresses) within the same Scale Set? The VMSS is set to auto-scale, so other instances may come and go at any time.

The Azure Instance Metadata Service only returns information on the instance that made the query, not any other instances within the VMSS. The az vmss list-instance-connection-info command only returns information about the inbound NAT pool's publicly-accessible ports on the load balancer.

I am trying to create a backchannel for instances in a VMSS to (synchronously) co-operate. Other alternatives I've considered include UDP multicast on the subnet to advertise availability, an Azure Redis Cache that VMs register their network information with (and de-register when scaling down), and Service Fabric Reliable Collections (we don't use containers). Is there any other way?

1

1 Answers

1
votes

It seems that you want to know the private IP address of each instance in a VMSS.

If so, you can retrieve it using Azure CLI,

az vmss nic list -g nancyvm --vmss-name myvmss --query "[].ipConfigurations[].{ID:id,PrivateIPAddress:privateIpAddress}" -o table

enter image description here

If you run it on Linux, you can get it easier,

az vmss nic list -g nancyvm --vmss-name myvmss | grep -w "privateIpAddress" 

enter image description here

For more PowerShell script for it, refer to this blog.