SOLVED

VM with Public IP

%3CLINGO-SUB%20id%3D%22lingo-sub-915208%22%20slang%3D%22en-US%22%3EVM%20with%20Public%20IP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-915208%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20someone%20help%20me%20with%20query%20to%20get%20list%20of%20VM%20names%20and%20public%20IP%20address%20assigned%20to%20them.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%20how%20to%20create%20view%20in%20dashboard%20for%20the%20same%20as%20I%20dont%20have%20permission%20to%20modify%20or%20share%20existing%20shared%20dashboards%2C%20hence%20need%20the%20output%20in%20my%20private%20dashboard.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethanks%20in%20advance%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-915208%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-915693%22%20slang%3D%22en-US%22%3ERe%3A%20VM%20with%20Public%20IP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-915693%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F380509%22%20target%3D%22_blank%22%3E%40Rahul_Mahajan%3C%2FA%3E%20Can%20you%20specify%20more%20details%3F%20Are%20these%20for%20Azure%20VMs%3F%20Also%20it%20is%20important%20to%20understand%20that%20Log%20Analytics%20does%20not%20have%20such%20information.%20Trough%20Heartbeat%20data%20you%20can%20get%20the%20public%20IP%20address%20from%20which%20the%20VM%20communicates%20to%20internet%20but%20it%20does%20not%20mean%20that%20the%20VM%20itself%20have%20such%20information.%20On%20the%20other%20hand%20this%20information%20should%20be%20possible%20to%20find%20via%20Resource%20Graph%20if%20it%20is%20only%20for%20Azure%20VMs.%20Data%20from%20Azure%20Resource%20Graph%20can%20be%20visualized%20in%20dashboard.%20Is%20that%20what%20you%20are%20looking%20for%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-918655%22%20slang%3D%22en-US%22%3ERe%3A%20VM%20with%20Public%20IP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-918655%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F9172%22%20target%3D%22_blank%22%3E%40Stanislav%20Zhelyazkov%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%2C%20exactly%20that's%20what%20I%20am%20looking%20for.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%20when%20I%20am%20trying%20to%20create%20visual%20using%20query%20all%20things%20pointing%20to%20Visual%20Designer%20but%20I%20am%20not%20able%20to%20find%20in%20Azure%20portal%2C%20seems%20to%20be%20depreciated.%20Do%20we%20have%20any%20alternative%20for%20it%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20create%20something%20like%20%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fadinermie.com%2Fusing-azure-backup-logs-azure-log-analytics-aka-oms%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fadinermie.com%2Fusing-azure-backup-logs-azure-log-analytics-aka-oms%2F%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-918680%22%20slang%3D%22en-US%22%3ERe%3A%20VM%20with%20Public%20IP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-918680%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F380509%22%20target%3D%22_blank%22%3E%40Rahul_Mahajan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20is%20a%20blog%20post%20about%20visualizing%20data%20from%20resource%20graph%20in%20Azure%20Dashboards%3A%20%3CA%20href%3D%22https%3A%2F%2Fsamcogan.com%2Fvisualise-your-azure-resource-with-resource-graph-explorer%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsamcogan.com%2Fvisualise-your-azure-resource-with-resource-graph-explorer%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20Monitor%20workbooks%20can%20also%20visualize%20data%20from%20the%20resource%20graph%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2Fapp%2Fusage-workbooks%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2Fapp%2Fusage-workbooks%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBelow%20you%20can%20find%20the%20resource%20graph%20query.%20Keep%20in%20mind%20you%20can%20get%20only%20the%20IP%20address%20of%20static%20ip%20address%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EResources%20%7C%20where%20type%20%3D~%20%22Microsoft.Network%2FnetworkInterfaces%22%0A%20%7C%20mv-expand%20properties.ipConfigurations%0A%20%7C%20where%20isnotempty(properties_ipConfigurations.properties.publicIPAddress.id)%0A%20%7C%20extend%20publicIpId%20%3D%20tostring(properties_ipConfigurations.properties.publicIPAddress.id)%0A%20%20%7C%20join%20(%0A%20Resources%20%7C%20where%20type%20%3D~%20%22microsoft.network%2Fpublicipaddresses%22%0A%20)%20on%20%24left.publicIpId%20%3D%3D%20%24right.id%0A%20%7C%20extend%20ipAddress%20%3D%20tostring(properties1.ipAddress)%0A%20%7C%20extend%20publicIPAllocationMethod%20%3D%20tostring(properties1.publicIPAllocationMethod)%0A%20%7C%20extend%20publicIpName%20%3D%20tostring(name1)%0A%20%7C%20extend%20vmId%20%3D%20tostring(properties.virtualMachine.id)%0A%20%7C%20where%20notempty(vmId)%0A%20%20%7C%20join%20%20(%0A%20%20Resources%20%7C%20where%20type%20%3D%3D%20%22microsoft.compute%2Fvirtualmachines%22%0A%20)%20on%20%24left.vmId%20%3D%3D%20%24right.id%0A%7C%20extend%20name%20%3D%20name2%0A%7C%20extend%20resourceGroup%20%3D%20resourceGroup2%0A%7C%20project%20name%2C%20resourceGroup%2CpublicIpName%2C%20publicIPAllocationMethod%2C%20ipAddress%0A%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-942719%22%20slang%3D%22en-US%22%3ERe%3A%20VM%20with%20Public%20IP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-942719%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F9172%22%20target%3D%22_blank%22%3E%40Stanislav%20Zhelyazkov%3C%2FA%3E%26nbsp%3B%20Thanks%2C%20will%20check%20and%20get%20back%20to%20you.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F239477%22%20target%3D%22_blank%22%3E%40Clive%20Watson%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%20and%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F54923%22%20target%3D%22_blank%22%3E%40Noa%20Kuperberg%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%20Can%20you%20please%20help%20me%20with%20what%20is%20alternative%20for%20view%20designer%20so%20I%20can%20create%20dashboards%20as%20required%3C%2FSPAN%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-967798%22%20slang%3D%22en-US%22%3ERe%3A%20VM%20with%20Public%20IP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-967798%22%20slang%3D%22en-US%22%3EAnyone%20can%20update%20on%20above%20query%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-967813%22%20slang%3D%22en-US%22%3ERe%3A%20VM%20with%20Public%20IP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-967813%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F380509%22%20target%3D%22_blank%22%3E%40Rahul_Mahajan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHave%20you%20tried%20the%20links%20I%20have%20posted%20on%20visualizations%20%3F%3C%2FP%3E%0A%3CP%3EAt%20the%20end%20it%20depends%20on%20what%20you%20want%20to%20visualize%20exactly%20and%20how.%20For%20example%20when%20you%20execute%20the%20below%20query%20in%20Resource%20Graph%20explorer%20you%20will%20click%20on%20Chart%20tab%20and%20there%20you%20can%20ping%20it%20to%20dashboard%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EResources%20%7C%20where%20type%20%3D~%20%22Microsoft.Network%2FnetworkInterfaces%22%0A%20%7C%20mv-expand%20properties.ipConfigurations%0A%20%7C%20where%20isnotempty(properties_ipConfigurations.properties.publicIPAddress.id)%0A%20%7C%20extend%20publicIpId%20%3D%20tostring(properties_ipConfigurations.properties.publicIPAddress.id)%0A%20%20%7C%20join%20(%0A%20Resources%20%7C%20where%20type%20%3D~%20%22microsoft.network%2Fpublicipaddresses%22%0A%20)%20on%20%24left.publicIpId%20%3D%3D%20%24right.id%0A%20%7C%20extend%20ipAddress%20%3D%20tostring(properties1.ipAddress)%0A%20%7C%20extend%20publicIPAllocationMethod%20%3D%20tostring(properties1.publicIPAllocationMethod)%0A%20%7C%20extend%20publicIpName%20%3D%20tostring(name1)%0A%20%7C%20extend%20vmId%20%3D%20tostring(properties.virtualMachine.id)%0A%20%7C%20where%20notempty(vmId)%0A%20%20%7C%20join%20%20(%0A%20%20Resources%20%7C%20where%20type%20%3D%3D%20%22microsoft.compute%2Fvirtualmachines%22%0A%20)%20on%20%24left.vmId%20%3D%3D%20%24right.id%0A%7C%20extend%20name%20%3D%20name2%0A%7C%20extend%20resourceGroup%20%3D%20resourceGroup2%0A%7C%20project%20name%2C%20resourceGroup%2CpublicIpName%2C%20publicIPAllocationMethod%2C%20ipAddress%0A%7C%20summarize%20count()%20%20by%20name%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3BFor%20workbooks%20there%20are%20also%20some%20guidance%20on%20how%20to%20do%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

Hi All,

 

Can someone help me with query to get list of VM names and public IP address assigned to them.

 

Also how to create view in dashboard for the same as I dont have permission to modify or share existing shared dashboards, hence need the output in my private dashboard.

 

thanks in advance

6 Replies
Highlighted

Hi@Rahul_Mahajan Can you specify more details? Are these for Azure VMs? Also it is important to understand that Log Analytics does not have such information. Trough Heartbeat data you can get the public IP address from which the VM communicates to internet but it does not mean that the VM itself have such information. On the other hand this information should be possible to find via Resource Graph if it is only for Azure VMs. Data from Azure Resource Graph can be visualized in dashboard. Is that what you are looking for?

Highlighted

@Stanislav Zhelyazkov 

 

Yes, exactly that's what I am looking for.

 

@Clive Watson  and @Noa Kuperberg 

Also when I am trying to create visual using query all things pointing to Visual Designer but I am not able to find in Azure portal, seems to be depreciated. Do we have any alternative for it?

 

I am trying to create something like :

 

https://adinermie.com/using-azure-backup-logs-azure-log-analytics-aka-oms/

Highlighted
Solution

Hi@Rahul_Mahajan 

Here is a blog post about visualizing data from resource graph in Azure Dashboards: https://samcogan.com/visualise-your-azure-resource-with-resource-graph-explorer/

 

Azure Monitor workbooks can also visualize data from the resource graph:

https://docs.microsoft.com/en-us/azure/azure-monitor/app/usage-workbooks

 

Below you can find the resource graph query. Keep in mind you can get only the IP address of static ip address:

Resources | where type =~ "Microsoft.Network/networkInterfaces"
 | mv-expand properties.ipConfigurations
 | where isnotempty(properties_ipConfigurations.properties.publicIPAddress.id)
 | extend publicIpId = tostring(properties_ipConfigurations.properties.publicIPAddress.id)
  | join (
	Resources | where type =~ "microsoft.network/publicipaddresses"
 ) on $left.publicIpId == $right.id
 | extend ipAddress = tostring(properties1.ipAddress)
 | extend publicIPAllocationMethod = tostring(properties1.publicIPAllocationMethod)
 | extend publicIpName = tostring(name1)
 | extend vmId = tostring(properties.virtualMachine.id)
 | where notempty(vmId)
  | join  (
	 Resources | where type == "microsoft.compute/virtualmachines"
 ) on $left.vmId == $right.id
| extend name = name2
| extend resourceGroup = resourceGroup2
| project name, resourceGroup,publicIpName, publicIPAllocationMethod, ipAddress
Highlighted

@Stanislav Zhelyazkov  Thanks, will check and get back to you.

 

@Clive Watson  and @Noa Kuperberg  Can you please help me with what is alternative for view designer so I can create dashboards as required 

Highlighted
Anyone can update on above query?
Highlighted

Hi@Rahul_Mahajan 

Have you tried the links I have posted on visualizations ?

At the end it depends on what you want to visualize exactly and how. For example when you execute the below query in Resource Graph explorer you will click on Chart tab and there you can ping it to dashboard

Resources | where type =~ "Microsoft.Network/networkInterfaces"
 | mv-expand properties.ipConfigurations
 | where isnotempty(properties_ipConfigurations.properties.publicIPAddress.id)
 | extend publicIpId = tostring(properties_ipConfigurations.properties.publicIPAddress.id)
  | join (
	Resources | where type =~ "microsoft.network/publicipaddresses"
 ) on $left.publicIpId == $right.id
 | extend ipAddress = tostring(properties1.ipAddress)
 | extend publicIPAllocationMethod = tostring(properties1.publicIPAllocationMethod)
 | extend publicIpName = tostring(name1)
 | extend vmId = tostring(properties.virtualMachine.id)
 | where notempty(vmId)
  | join  (
	 Resources | where type == "microsoft.compute/virtualmachines"
 ) on $left.vmId == $right.id
| extend name = name2
| extend resourceGroup = resourceGroup2
| project name, resourceGroup,publicIpName, publicIPAllocationMethod, ipAddress
| summarize count()  by name

 For workbooks there are also some guidance on how to do it.