File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -70,15 +70,17 @@ created automatically using the name IPConfiguration1.
70
70
71
71
### Example 2: Create an Azure network interface using an IP configuration object
72
72
```
73
- PS C:\>$IPconfig = New-AzNetworkInterfaceIpConfig -Name "IPConfig1" -PrivateIpAddressVersion IPv4 -PrivateIpAddress "10.0.1.10" -SubnetId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ResourceGroup1/providers/Microsoft.Network/virtualNetworks/VirtualNetwork1/subnets/Subnet1"
73
+ PS C:\>$Subnet = Get-AzVirtualNetwork -name "VirtualNetwork1" -ResourceGroupName "ResourceGroup1"
74
+ PS C:\>$IPconfig = New-AzNetworkInterfaceIpConfig -Name "IPConfig1" -PrivateIpAddressVersion IPv4 -PrivateIpAddress "10.0.1.10" -SubnetId $Subnet.subnets[0].id
74
75
PS C:\> New-AzNetworkInterface -Name "NetworkInterface1" -ResourceGroupName "ResourceGroup1" -Location "centralus" -IpConfiguration $IPconfig
75
76
```
76
77
77
78
This example creates a new network interface using an IP configuration object. The IP configuration
78
79
object specifies a static private IPv4 address.
79
- The first command creates a network interface IP configuration named IPConfig1 and stores the
80
+ The first command retrieves an existing specified virtual network used to assign the subnet in the second command.
81
+ The second command creates a network interface IP configuration named IPConfig1 and stores the
80
82
configuration in the variable named $IPconfig.
81
- The second command creates a network interface named NetworkInterface1 that uses the network
83
+ The third command creates a network interface named NetworkInterface1 that uses the network
82
84
interface IP configuration stored in the variable named $IPconfig.
83
85
84
86
## PARAMETERS
You can’t perform that action at this time.
0 commit comments