Azure compute resources that are used to create and manage groups of heterogeneous load-balanced virtual machines.
Hello Barak Pahima Welcome to Microsoft Q&A. Thank you for posting your query here!
The error message you are seeing is related to the fact that there is no outbound internet connection for the Virtual Machine Scale Set. The error message is not related to the code you are using to list the network interfaces of the Azure VM in the scale set.
To resolve the error, you need to enable secure outbound access for your Virtual Machine Scale Set by using a method that's best suited for your application. Outbound access can be enabled by using one of the following methods:
- Use a Network Address Translation (NAT) Gateway on your subnet.
- Add scale set instances to a Load Balancer backend pool.
- Add an explicit public IP address per scale set instance.
For more information, please see the following document: https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machine-scale-sets/vmss-outbound-connectivity-not-enabled
Please let us know if you have any further queries. I’m happy to assist you further.
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.
-Ekta