Created
March 9, 2020 20:34
-
-
Save rwaal/869e6dee63541b064128b389bdb0e68b to your computer and use it in GitHub Desktop.
Associate Azure Public IP to an existing Network Interface using Powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pip = New-AzPublicIpAddress -Name 'MyPublicIpName' -ResourceGroupName 'MyResourceGroupName' -Sku 'Basic' -AllocationMethod 'Dynamic' -Location 'West Europe' | |
$vnet = Get-AzVirtualNetwork -Name 'MyVnetName' -ResourceGroupName 'MyResourceGroupName' | |
$subnet = Get-AzVirtualNetworkSubnetConfig -Name 'MySubnetName' -VirtualNetwork $vnet | |
$nic = Get-AzNetworkInterface -Name 'MyNicName' -ResourceGroupName 'MyResourceGroupName' | |
$ipconfig = New-AzNetworkInterfaceIpConfig -Name 'MyIpConfigName' -Subnet $subnet -PublicIpAddress $pip | |
$nic | Add-AzNetworkInterfaceIpConfig -Name $ipconfigName -Subnet $subnet -PublicIpAddress $pip | |
$nic | Set-AzNetworkInterface |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment