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
Specifies a **NetworkInterface** object that represents the goal state for a network interface.
48
+
The first command gets a network interface named NetworkInterface1 that exists within resource group ResourceGroup1. The second command adds DNS server 192.168.1.100 to this interface. The third command applies these changes to the network interface. To remove a DNS server, follow the commands listed above, but replace ```.Add``` with ```.Remove``` in the second command.
49
49
50
-
```yaml
51
-
Type: PSNetworkInterface
52
-
Parameter Sets: (All)
53
-
Aliases:
50
+
### Example 3: Enable IP forwading on a network interface
The first command gets an existing network interface called NetworkInterface1 and stores it in the ```$nic``` variable. The second command changes the IP forwarding value to true. Finally, the third command applies the changes to the network interface. To disable IP forwarding on a network interface, follow the sample example, but be sure to change the second command to ```$nic.EnableIPForwarding = 0```.
54
57
55
-
Required: True
56
-
Position: Named
57
-
Default value: None
58
-
Accept pipeline input: True (ByValue)
59
-
Accept wildcard characters: False
58
+
### Example 4: Change the subnet of a network interface
The first command gets the network interface NetworkInterface1 and stores it in the ```$nic``` variable. The second command gets the virtual network associated with the subnet that the network interface is going to be associated with. The second command gets the subnet and stores it in the ```$subnet2``` variable. The third command associated the primary private IP address of the network interface with the new subnet. Finally the last command applied these changes on the network interface.
67
+
68
+
>[!NOTE]
69
+
>The IP configurations must be dynamic before you can change the subnet. If you have static IP configurations, change then to dynamic before proceeding.
70
+
71
+
>[!NOTE]
72
+
>If the network interface has multiple IP configurations, the forth command must be done for all these IP configurations before the final ```Set-AzureRmNetworkInterface``` command is executed. This can be done as in the forth command but by replacing ```0``` with the appropriate number. If a network interface has N IP configurations, then N-1 of these commands must exist.
73
+
74
+
### Example 5: Associate/Dissociate a Network Security Group to a network interface
The first command gets an existing network interface called NetworkInterface1 and stores it in the ```$nic``` variable. The second command gets an existing network security group called MyNSG and stores it in the ```$nsg``` variable. The forth command assigns the ```$nsg``` to the ```$nic```. Finally, the fifth command applies the changes to the Network interface. To dissociate network security groups from a network interface, simple replace ```$nsg``` in the forth command with ```$null```.
82
+
83
+
## PARAMETERS
61
84
62
85
### -InformationAction
63
86
Specifies how this cmdlet responds to an information event.
@@ -98,6 +121,21 @@ Accept pipeline input: False
98
121
Accept wildcard characters: False
99
122
```
100
123
124
+
### -NetworkInterface
125
+
Specifies a **NetworkInterface** object that represents the goal state for a network interface.
126
+
127
+
```yaml
128
+
Type: PSNetworkInterface
129
+
Parameter Sets: (All)
130
+
Aliases:
131
+
132
+
Required: True
133
+
Position: Named
134
+
Default value: None
135
+
Accept pipeline input: True (ByValue)
136
+
Accept wildcard characters: False
137
+
```
138
+
101
139
### CommonParameters
102
140
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
0 commit comments