You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use [New-AzPublicIpAddress](/powershell/module/az.network/new-azpublicipaddress) to create a secondary public IP address.
266
259
267
260
```azurepowershell-interactive
268
-
$ip4-2 = @{
261
+
$ip2 = @{
269
262
Name = 'myPublicIP-2'
270
263
ResourceGroupName = 'myResourceGroup'
271
264
Location = 'eastus2'
@@ -274,7 +267,7 @@ $ip4-2 = @{
274
267
IpAddressVersion = 'IPv4'
275
268
Zone = 1,2,3
276
269
}
277
-
New-AzPublicIpAddress @ip4-2
270
+
New-AzPublicIpAddress @ip2
278
271
```
279
272
280
273
Use [New-AzNetworkInterfaceIpConfig](/powershell/module/az.network/new-aznetworkinterfaceipconfig) to create the secondary IP configuration for the virtual machine.
@@ -299,7 +292,7 @@ $pip = @{
299
292
Name = 'myPublicIP-2'
300
293
ResourceGroupName = 'myResourceGroup'
301
294
}
302
-
$pubIP-2 = Get-AzPublicIPAddress @pip
295
+
$pubIP2 = Get-AzPublicIPAddress @pip
303
296
304
297
## Place the network interface into a variable. ##
305
298
$net = @{
@@ -309,14 +302,14 @@ $net = @{
309
302
$nic = Get-AzNetworkInterface @net
310
303
311
304
## Create secondary configuration for NIC. ##
312
-
$IP2 = @{
305
+
$IPc2 = @{
313
306
Name = 'ipconfig2'
314
307
Subnet = $vnet.Subnets[0]
315
308
PrivateIpAddressVersion = 'IPv4'
316
309
PrivateIpAddress = '10.1.0.5'
317
-
PublicIPAddress = $pubIP-2
310
+
PublicIPAddress = $pubIP2
318
311
}
319
-
$IP2Config = New-AzNetworkInterfaceIpConfig @IP2
312
+
$IP2Config = New-AzNetworkInterfaceIpConfig @IPc2
320
313
321
314
## Add the IP configuration to the network interface. ##
0 commit comments