List Virtual Machines in Azure with Static IP Address
Check for static IP addresses in Azure.
John Savill
September 19, 2014
1 Min Read
Q: How can I quickly find all virtual machines in Azure that have a reserved IP address?
A: Virtual machines on a virtual network can have an IP address assigned that will be maintained for the virtual machine even if the virtual machine is deprovisioned from the Azure fabric. The following PowerShell code shows all virtual machines, their cloud service, and whether they have an assigned, reserved IP address.
Get-AzureVM | Select-Object -Property Name, ServiceName, @{Name='ReservedIP';Expression={(Get-AzureStaticVNetIP -VM $_ ).IPAddress}} | Format-Table -AutoSize
To only show those with a reserved IP address, use the following code:
Get-AzureVM | Select-Object -Property Name, ServiceName, @{Name='ReservedIP';Expression={(Get-AzureStaticVNetIP -VM $_ ).IPAddress}} | Where-Object {$_.ReservedIP -ne $null} | Format-Table -AutoSize
About the Author
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
You May Also Like