Hi Tomas,
The outgoing public IP for a VM depends on the specific networking configuration applicable to that VM.
For example, say you create a new VM, in new Virtual Network (VNet), with a Standard Public IP associated to the network interface. In this case, the VM will use the associated Public IP, and that is what you would see when browsing to websites that show public IP.
On the other hand, if a VM is on a Virtual Network that is using Azure NAT Gateway, then it will use the Public IP associated with the NAT Gateway. If a VM is on a VNet where outbound traffic is flowing through Azure Firewall (and then directly out to Internet), then it will use the firewall's public IP.
If no public IP is associated with a VM, and there is no NAT Gateway/Firewall/load balancer/similar on the VNet, then it will use default outbound access. The public IP used for default outbound access is not in your control and is subject to change.
Default outbound access in Azure
https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/default-outbound-access
With the above in mind, what is the network configuration of the VM that you tested with? If you are unsure where it is getting its public IP from please describe details about your configuration and I will assist.
Please click Accept Answer and upvote if the above was useful.
Thanks.
-TP