Associating existing VMs to a newly created NAT gateway for static outbound IP

Reshma Nair 140 Reputation points
2023-05-31T10:42:54.2566667+00:00

Hi,

A new requirement from our client side is, they need to whitelist the outbound IPs of our VMs in their firewall. For that I have created a NAT gateway with a Public IP associated in our play environment and added an existing subnet to it (The subnet contains our already existing 2 VMs(play host windows machines) with a standard Public IP which has a static allocation method). In order to test my new NAT configuration, I have created bastion and tried checking the outbound IP. But it is still showing the VMs public IP instead of the NAT public IP. Not able to figure out where I went wrong.

I am new to Azure and any helps would be grateful. Thanks in Advance.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,040 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,775 questions
0 comments No comments
{count} votes

Accepted answer
  1. TP 125.8K Reputation points Volunteer Moderator
    2023-05-31T10:56:39.95+00:00

    Hi,

    From your description it sounds like you still have public IP associated with your VM's network interface. You need to disassociate this so that the VM will use the NAT gateway on the VNet.

    In the Azure portal, please navigate to your VM, Networking blade. Next click on the address next to NIC Public IP. This will take you to the public IP address associated with your network interface. Click Disassociate button and click Yes to confirm.

    After making the above change, please connect to your VM using Bastion and verify that the public IP address matches the NAT gateway public IP now.

    Please click Accept Answer if the above was useful. If you have questions or need additional assistance, please add a comment.

    Thanks.

    -TP


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.