Creating a virtual network gateway with PowerShell
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, 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 the creation of the virtual network gateway.
Getting ready
Open the PowerShell console and make sure that you are connected to your Azure subscription.
How to do it…
To create a new virtual network gateway, execute the following script:
$vnet = Get-AzVirtualNetwork -ResourceGroupName 'Packt-Networking-Script' -Name 'Packt-Script' Add-AzVirtualNetworkSubnetConfig -Name &apos...