I cannot ping from an on-premises VM to a VM in Azure via the VPN gateway connection. The problem occurs only if the VM in Azure is in a VNET that is not the same with the VNET the VPN connection is established. However there is a peering connection between the Azure VNETs. Is this a feature or a miss-configuration from my side?
So here is the setup:
Problem
Any idea where the problem could be?
You need to set the Allow gateway transit option in the "Hub-RM" virtual network in a peering from Azure VNET1 to Azure VNET2 and enable the Use remote gateways in the "Spoke-RM" virtual network in a peering from Azure VNET2 to Azure VNET1. Do not select allow traffic forwarding.
Note: If you have a P2S VPN connection, once you change the peering setting, you should redownload the VPN client from Azure VPN gateway portal and reinstall it on the on-premise machine to make the route update on your on-premise network.
Get more details from configuring VPN gateway transit for virtual network peering
After confirming with you, you actually want to do the s2s connection with Azure VPN gateway with VNet Peering following the article. I suggest that you have VNet peering configuring with gateway transit between VNet1 and VNet2. You have to make sure the on-premise VNet has the routing for VNet2 and VNet1. After you have a static route configured correctly in the Fortigate(on-premise firewall). This works.