Figured out something today and I feel so stupid for not having figured it out earlier! ☺️
I have a very basic Linux VM in Azure. I barely use it, and I even have it scheduled to shutdown and deallocate every day, and I only turn it on when needed. For external connectivity I need a public IP, however, and while I can get a dynamic public IPv4 address if I go with the Basic SKU, that is being retired in September 2025 and so I decided to go with a Standard SKU and that only offers a static public IPv4 address. Which is not good cost wise, coz while I can save money on the VM by aggresively shutting it down, the public IPv4 address is constantly eating money.
As you can see in the screenshot above, the public IP address costs more than the VM + its disks! Not good.
Some time ago I tried switching to an IPv6 only situation as those are free. I followed the instructions in this article to add an IPv6 network and public address, but when I then removed the IPv4 configuration the VM had no connectivity to the outside world! That’s when I came across the limitations article and learnt that
IPv6-only Virtual Machines or Virtual Machines Scale Sets aren’t supported, each NIC must include at least one IPv4 IP configuration.
Bummer!
That’s where I left it, with a mental note to write some PowerShell script maybe that will deallocate and delete the public IPv4 address when the VM is shutdown, as well as allocate one when it is turned on. Not ideal, and I wasn’t too keen on spending time on this either, so it kind of languished…
Today, however, I had a brainwave. Each NIC must include an IPv4 IP configuration – sure – but it doesn’t say there must be a public IPv4 address too! What if I left the IPv4 configuration as is, but removed the public IPv4 address from it, and added the IPv6 configuration with a public IPv6 address? Worth a shot.
I didn’t expect it to work, but it did! Now the machine has no public IPv4 address and only public IPv6 address. Sweet!