Load Balancers Table view Azure CLI

%3CLINGO-SUB%20id%3D%22lingo-sub-1040278%22%20slang%3D%22en-US%22%3ELoad%20Balancers%20Table%20view%20Azure%20CLI%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1040278%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%60m%20trying%20to%20pull%20the%20below%20table%20in%20Azure%20CLI%20or%20Powershell%20and%20I%20cant%2C%20this%20is%20the%20portal%20table%20information%20which%20it%20cant%20be%20exported%20to%20csv%20....%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%60m%20working%20to%20get%20a%20script%20in%20place%20to%20route%20all%20the%20diagnostic%20settings%20from%20the%20PUBLIC%20Load%20balance%20to%20an%20event%20HUB%2C%20but%20in%20order%20to%20do%20this%20I%20have%20to%20identify%20which%20one%20is%20Public%20and%20which%20one%20is%20Private%20and%20I%20cant%20find%20what%20command%20to%20use%20to%20get%20this%20information.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20someone%20help%20me%20pls%20to%20get%20the%20below%20table%20or%20to%20get%20load%20balance%3A%26nbsp%3B%20Name%2C%20Id%2C%20Load%20balance%20Type%20%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F159465i387FCCF93243ED2F%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22load_balancer_portal_table.jpg%22%20title%3D%22load_balancer_portal_table.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E2%80%83%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1040278%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAutomation%20%26amp%3B%20Control%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzureCLI%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ELoad%20Balancer%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1041393%22%20slang%3D%22en-US%22%3ERe%3A%20Load%20Balancers%20Table%20view%20Azure%20CLI%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1041393%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F471730%22%20target%3D%22_blank%22%3E%40NumBillniF%3C%2FA%3E%26nbsp%3Bthe%20best%20Azure%20resource%20for%20this%20type%20of%20need%20is%20Azure%20Resource%20Graph.%20You%20can%20use%20it%20in%20the%20Azure%20Portal%2C%20by%20opening%20the%20Azure%20Resource%20Graph%20Explorer%20blade%20and%20run%20the%20query%20below.%20You%20can%20download%20the%20results%20as%20CSV.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3E%0A%3CDIV%3E%3CSPAN%3Eresources%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Btype%26nbsp%3B%3D~%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E'Microsoft.Network%2FloadBalancers'%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BlbType%26nbsp%3B%3D%26nbsp%3Biif(isnull(properties.frontendIPConfigurations%5B%3C%2FSPAN%3E%3CSPAN%3E0%3C%2FSPAN%3E%3CSPAN%3E%5D.properties.publicIPAddress)%2C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E'internal'%3C%2FSPAN%3E%3CSPAN%3E%2C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E'public'%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%3E%7C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eproject%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bid%2C%26nbsp%3Bname%2C%26nbsp%3BresourceGroup%2C%26nbsp%3Blocation%2C%26nbsp%3BlbType%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20668px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F159527iB893405369E04760%2Fimage-dimensions%2F668x269%3Fv%3D1.0%22%20width%3D%22668%22%20height%3D%22269%22%20alt%3D%22clipboard_image_3.png%22%20title%3D%22clipboard_image_3.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20also%20use%20Azure%20Resource%20Graph%20from%20CLI.%20Learn%20more%20about%20it%20here.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi,

 

I`m trying to pull the below table in Azure CLI or Powershell and I cant, this is the portal table information which it cant be exported to csv ....

 

I`m working to get a script in place to route all the diagnostic settings from the PUBLIC Load balance to an event HUB, but in order to do this I have to identify which one is Public and which one is Private and I cant find what command to use to get this information.

 

Can someone help me pls to get the below table or to get load balance:  Name, Id, Load balance Type ?

 

load_balancer_portal_table.jpg

1 Reply

@NumBillniF the best Azure resource for this type of need is Azure Resource Graph. You can use it in the Azure Portal, by opening the Azure Resource Graph Explorer blade and run the query below. You can download the results as CSV.

 

resources
where type =~ 'Microsoft.Network/loadBalancers'
extend lbType = iif(isnull(properties.frontendIPConfigurations[0].properties.publicIPAddress), 'internal''public')
project id, name, resourceGroup, location, lbType

 

clipboard_image_3.png

 

You can also use Azure Resource Graph from CLI. Learn more about it here.