Azure – How to log IP addresses of all connections to virtual machines in Azure

azureazure-networking

We have a private Azure network configured with a Virtual Network Gateway where all traffic is passing through. Network Security Groups are not currently used.

I've tried to enable diagnostic logs on a VNG and archive to a storage account, but I don't see logs coming in the storage account blobs.

Do VNG diagnostic logs capture client IPs? How can I log IP addresses of all connections to virtual machines in Azure?

Best Answer

You need to enable NSG Flow Logging. Check the article below:

https://docs.microsoft.com/en-us/azure/network-watcher/network-watcher-nsg-flow-logging-overview

This will give you:

  • Outbound and inbound flows on a per-rule basis
  • The NIC that the flow applies to
  • 5-tuple information about the flow (source/destination IP, source/destination port, protocol)
  • Information about whether traffic was allowed or denied

I believe you need to create and associate the subnet (or individual NIC) to an NSG, even if it only has the default rules - which allows traffic in/out of VPN and within the VNet.

Once you have the logs configured, you can analyse it with Log Analytics (OMS)

Related Topic