virtual IP address

List Virtual Machines in Azure with Static IP Address

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
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish