In this demonstration, we are going to configure a private and a public IP address. When we created the VNet, a private IP address was already created for us automatically by Azure. However, we are going to create another in this demonstration and associate it, together with the public IP address, to a network interface card (NIC). To configure a private and public IP address from PowerShell, you have to take the following steps:
- In the same PowerShell window, add the following code to retrieve the VNet and subnet configuration:
$vnet = Get-AzVirtualNetwork -Name PacktVirtualNetwork -ResourceGroupName PacktVNetResourceGroup
$subnet = Get-AzVirtualNetworkSubnetConfig -Name default -VirtualNetwork $vnet
- Next, create a private and public IP address and assign them to the configuration as follows:
$publicIP = New-AzPublicIpAddress `
...