Automating the tasks
Finally, we have reached the point of automating the manual tasks that have been implemented so far.
Adding a service endpoint to an existing virtual network using PowerShell
Adding a service endpoint to an existing virtual network is pretty straightforward. All you need to do is run the following cmdlet:
Get-AzureRmVirtualNetwork -ResourceGroupName PacktPub -Name PSVNet | Set-AzureRmVirtualNetworkSubnetConfig -Name NSubnet -AddressPrefix "192.168.1.0/24" -ServiceEndpoint "Microsoft.Storage" | Set-AzureRmVirtualNetwork
Adding a service endpoint to an existing virtual network using Azure CLI
To add a service endpoint to an existing virtual network using Azure CLI, you need to run the following command:
az network vnet subnet update -g PacktPub -n s1 --vnet-name CLIVNet --service-endpoints Microsoft.Storage
Creating virtual network peering using PowerShell
First off, you need to retrieve the virtual network information and store it in a variable using the following cmdlet:
$VNet1...