The issue that I am facing is I need to whitelist IP addresses for my virtual machines to access a third-party service. Right now, I have three virtual machines in the subnet, but in the future, there might be ten. Is there a way to group their IPs into a single IP address so that I don't have to keep adding them to the whitelist every time I add more machines? I tried using a NAT gateway, but it didn't work.
Created Application gateway associated with multiple virtual machines in backend Pool like below:
Application gateway redirected associated backed pool with this Ip address successfully like below:
I tried using a NAT gateway, but it didn't work.
I agree with @Anthony Nat gateway is easier to administer. Nat IP is only used for outgoing connections.
If your back end VM is behind an application gateway and its subnet has a Nat gateway Whenever you initiate a connection from your backend VM to any Internet resource which is over public Internet. It will only use the IP address of the Nat Gateway.
Created NAT gateway with outbound Ip address:
When you add more virtual machines to the subnet, you don't need to update the whitelist because the public IP address of the NAT gateway remains the same. I validated it using a packet capture it is using NAT gateway like below: