Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
IMDS is available for running instances of virtual machines (VMs) and scale set instances. All endpoints support VMs created and managed by using Azure Resource Manager. IMDS is a REST API that's available at a well-known, non-routable IP address (169.254.169.254
). You can only access it from within the VM. Communication between the VM and IMDS never leaves the host.
However, I do not think IMDS provides a direct method to retrieve the private IP addresses of all instances within a VMSS. Instead, you can use Azure CLI or PowerShell scripts to query the network interfaces associated with the VMSS instances and retrieve their private IP addresses. The IMDS only provides metadata for the instance making the request, so if you want to gather information about all instances, you'll need to either loop through each instance or use Azure CLI.https://zcusa.951200.xyz/en-us/azure/virtual-machines/instance-metadata-service?tabs=windows
Here's a PowerShell script that can help you retrieve the private IP addresses of all instances within a VMSS: https://zcusa.951200.xyz/en-us/answers/questions/1300833/how-to-retrieve-private-ip-addresses-and-names-of
If you have any further queries, do let us know.
If the answer is helpful, please click "Accept Answer" and "Upvote it."