Skip to content

Instantly share code, notes, and snippets.

@ibombonato
Created January 29, 2026 21:22
Show Gist options
  • Select an option

  • Save ibombonato/8f271f0ad99fd38a773dea8c4505485e to your computer and use it in GitHub Desktop.

Select an option

Save ibombonato/8f271f0ad99fd38a773dea8c4505485e to your computer and use it in GitHub Desktop.
TIL: Get public IP of Azure/Cloud VMs when there is none in the interface
TIL: If you need to give firewall access to a VM that just have internal IP in Azure to another Azure VM, in another subscription, you can use `curl ifconfig.me` to discover the external ip from the machine, and allow in the other machine.
Deal was:
Subscription #1 form person one has one VM with only private ip, that need to access a VM in Subscripton #2 from person 2. So, they are anot connected in any way.
Due VM #1 has "private only IP", something like 172.168.X.X, We could not allow it in VM#2.
How we solve:
In VM #1, run: `curl ifconfig.me` it will then show a "external ip", like 20.168.X.X. Add this IP in the "Allow List"of VM #2 and it worked.
We also allowed outside connection for the public IP of VM #2 in the configs of VM #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment