Is there a better way to search by IP address in the portal? Both Public & Private?

Copper Contributor

I know that you can list the VM's and show the ip addresses on the VM list, but short of digging through every row finding a machine by ip is a pain.  Private connected networks, I can ping it with a name resolution to get the name to search for that, but on the public side I can't, or for servers in a different network I can't.

Thanks,

Russ

7 Replies

Are you looking for Public or Private IPs? It sounds like Public IPs. If that's the case, you can in the Portal, go to "All Services" then search for "Public IP Addresses" (which I made a favorite), then once you go to that, you can click on "Edit Columns" at the top, and add "IP Address" as a column. Then you can find the Public IP that you're looking for and the name of the Public IP. If you click on it, you can see which VM it is associated with. That might be a little simpler for you possibly?

 

Maybe on the Private IP side go to the VNet and look at the resources that have IPs in that VNet? Are you using Azure DNS or your own DNS in your Private network side?

@Russell Hackworth 

I just spotted this post and just joined here. I used this script to get all the public ip's associated with IaaS resources or Appliances in Azure. (It does not dump PaaS resources though so keep that in mind. What i mean is that if you allow a public ip range in one of your PaaS services, this script will not capture that information. I hope you find this useful:

Connect-AzAccount
Set-AzContext -Subscriptionid (Put your id here)
# This gets all the public IP's and displays it on the screen:
Get-AzPublicIpAddress | select name,ipaddress
# To pipe this out to a file. You can specify any folder you can access:
Get-AzPublicIpAddress | select name,ipaddress | export-csv c:\temp\azurepublicip.csv

 

In CLI, this command works, but it's ugly: az network public-ip list [--resource-group]
[--subscription]

Hi @Russell,

Found this post just now...

We now have a 'Virtual Machines' view on the Azure portal, which allows customizing the column order on display. The displayed list can then be saved with a name. One can switch to this saved view when needed.

I followed these steps to display the Private IP address right next to the VM Name column. Likewise, one could arrange the Public IP address column.

Hope this helps.

Thanks,
Siva
Great Script. For anyone who doesn't already know, before you can run it you have to:-

Install-Module -Name Az
Import-Module Az

@RichardA 

Here is an ARG (Azure Resource Graph) Query that might help to get you started:

// Get vmNics with IP Addresses
// Aggregation of all the vmNics by the lowercase VM id
Resources
    | where type =~ 'microsoft.compute/virtualmachines'
    | project vmId = tolower(tostring(id)), vmName = name
    | join (Resources
        | where type =~ 'microsoft.network/networkinterfaces'
        | mv-expand ipconfig=properties.ipConfigurations
        | project vmId = tolower(tostring(properties.virtualMachine.id)), privateIp = ipconfig.properties.privateIPAddress, publicIpId = tostring(ipconfig.properties.publicIPAddress.id)
        | join kind=leftouter (Resources
            | where type =~ 'microsoft.network/publicipaddresses'
            | project publicIpId = id, publicIp = properties.ipAddress
        ) on publicIpId
        | project-away publicIpId, publicIpId1
        | summarize privateIps = make_list(privateIp), publicIps = make_list(publicIp) by vmId
    ) on vmId
    | project-away vmId1
    | sort by vmName asc

It is true that you can list the VMs and show their IP addresses, searching for a specific machine using its IP address can take quite some time. For private connected networks, pinging the IP address with a name resolution is a great way to find the machine you're looking for. However, this method may not always work for public networks or servers in different networks. One tip I can offer is to use the search bar on the portal to look for specific keywords that may lead you to the machine you're looking for. For this you may also want to look at routeripnet.com. Additionally, you could try filtering the VM list by network, which can narrow down your search.

@BrooksV I also found a more generic property search for things that regex to IP helps find all types of resources (NSGs, vNETs, NICs):

 

Resources
| where properties matches regex @'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'
| extend IP=extract_all(@'(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(?:\/\d{1,2}){0,1})',tostring(properties))
| project  name, type, IP, location, resourceGroup, subscriptionId, properties
| mv-expand IP
| order by type,name