Creating a virtual network gateway is possible with PowerShell. Again, this helps automate processes. For example, if we start creating a virtual network gateway using a portal and notice that our virtual network isn't listed, it's probably because it's missing a gateway subnet. So, we must abandon the process, go back and create the gateway subnet, and start creating the virtual network gateway. Using PowerShell, we can ensure that all the requisite resources are present before starting and then continue with creating the virtual network gateway.
Creating a virtual network gateway with PowerShell
Getting ready
Open the PowerShell console and make sure you are connected to your Azure subscription.
...