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
The sample PowerShell commands below expect a simple environment already created. If you want to run the commands as they are displayed in this document, first build the test environment described in [Create a VNet](/previous-versions/azure/virtual-network/virtual-networks-create-vnet-classic-netcfg-ps).
27
+
The following sample PowerShell commands expect a simple environment already created. If you want to run the commands as they're displayed in this document, first build the test environment described in [Create a VNet](/previous-versions/azure/virtual-network/virtual-networks-create-vnet-classic-netcfg-ps).
28
28
29
29
## How to verify if a specific IP address is available
30
+
30
31
To verify if the IP address *192.168.1.101* is available in a VNet named *TestVNet*, run the following PowerShell command and verify the value for *IsAvailable*:
## How to specify a static private IP address when creating a VM
47
-
The PowerShell script below creates a new cloud service named *TestService*, then retrieves an image from Azure, creates a VM named *DNS01* in the new cloud service using the retrieved image, sets the VM to be in a subnet named *FrontEnd*, and sets *192.168.1.7* as a static private IP address for the VM:
53
+
54
+
The following PowerShell script creates a new cloud service named *TestService*. The script then retrieves an image from Azure and creates a VM named *DNS01* in the new cloud service. Finally, the script using the sets the VM to be in a subnet named *FrontEnd*, and sets *192.168.1.7* as a static private IP address for the VM:
## How to retrieve static private IP address information for a VM
70
-
To view the static private IP address information for the VM created with the script above, run the following PowerShell command and observe the values for *IpAddress*:
102
+
103
+
To view the static private IP address information for the VM created with the previous script, run the following PowerShell command and observe the values for *IpAddress*:
71
104
72
105
```azurepowershell
73
-
Get-AzureVM -Name DNS01 -ServiceName TestService
106
+
$vm = @{
107
+
Name = "DNS01"
108
+
ServiceName = "TestService"
109
+
}
110
+
Get-AzureVM @vm
74
111
```
75
112
76
113
Expected output:
@@ -105,12 +142,15 @@ OperationStatus : OK
105
142
```
106
143
107
144
## How to remove a static private IP address from a VM
108
-
To remove the static private IP address added to the VM in the script above, run the following PowerShell command:
145
+
146
+
To remove the static private IP address added to the VM in the previous script, run the following PowerShell command:
It’s recommended that you do not statically assign the private IP assigned to the Azure virtual machine within the operating system of a VM, unless necessary. If you do manually set the private IP address within the operating system, ensure that it is the same address as the private IP address assigned to the Azure VM, or you can lose connectivity to the virtual machine. You should never manually assign the public IP address assigned to an Azure virtual machine within the virtual machine's operating system.
189
+
It’s recommended that you don't statically assign the private IP assigned to the Azure virtual machine within the operating system of a VM, unless necessary. If you do manually set the private IP address within the operating system, ensure that it's the same address as the private IP address assigned to the Azure VM. Failure to match the IP address could result in loss of connectivity to the virtual machine.
144
190
145
191
## Next steps
192
+
146
193
* Learn about [reserved public IP](/previous-versions/azure/virtual-network/virtual-networks-reserved-public-ip) addresses.
194
+
147
195
* Learn about [instance-level public IP (ILPIP)](/previous-versions/azure/virtual-network/virtual-networks-instance-level-public-ip) addresses.
196
+
148
197
* Consult the [Reserved IP REST APIs](/previous-versions/azure/reference/dn722420(v=azure.100)).
0 commit comments