PrateekKumarSingh / AzViz

⚡ ☁ Azure Visualizer aka 'AzViz' : A #powershell module to automatically generate Azure resource topology diagrams by just typing a PowerShell cmdlet and passing the name of one or more Azure Resource groups

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTTP 404 response on any resource group containing an Application Gateway resource

nbrossman-work opened this issue · comments

I've tried against multiple subscriptions and resource groups, they all seem to work except for resource groups containing Application Gateway resources. I get an HTTP 404 not found response, as seen below

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com//subscriptions/[removed]/resourceGroups/[removed]/providers/Microsoft.Network/applicationGateways/[removed]/frontendIPConfigurations/appGatewayFrontendIP?api-version=2016-09-01

Headers:
x-ms-client-request-id : [removed]
Accept-Language : en-US

Body:

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
NotFound

Headers:
Cache-Control : no-cache
Pragma : no-cache
Strict-Transport-Security : max-age=31536000; includeSubDomains
Server : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 11998
x-ms-request-id : [removed]
x-ms-correlation-request-id : [removed]
x-ms-routing-request-id : [location]:20210428T131307Z:[removed]
X-Content-Type-Options : nosniff
Date : Wed, 28 Apr 2021 13:13:06 GMT

Body:
{
"Message": "No HTTP resource was found that matches the request URI 'https://[location].network.azure.com:30010/[removed]/132615493315838172/subscriptions/[removed]/resourceGroups/[removed]/providers/Microsoft.Network/applicationGateways/[removed]/frontendIPConfigurations/appGatewayFrontendIP?api-version=2016-09-01'."
}

Get-AzResource: PowerShell\Modules\AzViz\1.1.2\src\private\ConvertFrom-Network.ps1:90
Line |
90 | … toCateg = (Get-AzResource -ResourceId $to.ResourceId).Resour …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| No HTTP resource was found that matches the request URI
| 'https://[location].network.azure.com:30010/[removed]/132615493315838172/subscriptions/[removed]/resourceGroups/[removed]/providers/Microsoft.Network/applicationGateways/[removed]/frontendIPConfigurations/appGatewayFrontendIP?api-version=2016-09-01'. StatusCode: 404 ReasonPhrase: Not Found OperationID : [removed]

Testing a little bit on my own, I get the same HTTP 404 response on the following uris
applicationGateways/[appgwname]/frontendIPConfigurations/appGatewayPublicIP?api-version=2016-09-01
applicationGateways/[appgwname]/backendAddressPools/[poolname1]?api-version=2016-09-01
applicationGateways/[appgwname]/backendAddressPools/[poolname2]?api-version=2016-09-01

I am also having the same issue, would love a fix!

Looks like the same issue on Load Balancers:

No HTTP resource was found that matches the request URI 'https://northeurope.network.azure.com:30060/{removed}/132593330479865294/subscriptions/{removed}/resourceGroups/{removed}/pr
oviders/Microsoft.Network/loadBalancers/ilbcoplanuat01/inboundNatPools/LoadBalancerBEAddressNatPool?api-version=2016-09
-01'.
StatusCode: 404
ReasonPhrase: Not Found
OperationID :

commented

Same issue here with a gateway.

▶ Starting to generate Azure visualization... 179ms
▶ Exporting network associations for resource group: *
▶ Network watcher found: 'NetworkWatcher_*'
▶ Obtaining network topology using Network Watcher

Get-AzResource: Documents\PowerShell\Modules\AzViz\1.1.2\src\private\ConvertFrom-Network.ps1:90
Line |
90 | … toCateg = (Get-AzResource -ResourceId $to.ResourceId).Resour …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| No HTTP resource was found that matches the request URI

I was able to reproduce the issue when Get-AzResource cmdlet in the function ConvertFrom-Network attempts to get network associations of the resources in current resource group, or the current context.

REASON: Often network associations as not limited to current Resource group and point to different resource groups and even subscriptions in many cases, and when Get-AzResource -ResourceId xxxxxxx cmdlet attempts to get the resource object of any such association, it fails because either it is outside current context or permission issues.

'Export-AzViz' cmdlet as of today only intends to target all resources within the target resource groups and there is no need to visualize dependencies or network associations outside the resource group. So, to fix this: Only target Resource IDs which has target resource group in the string, and skip all external associations, see the below lines of code to understand what has been implemented👇

https://github.com/PrateekKumarSingh/AzViz/blob/master/AzViz/src/private/ConvertFrom-Network.ps1#L85-L88

At some later stage as and when this module evolves, I want to add a feature\enhancement to visualize any external dependencies as well, so creating another issue #58 and closing this one.

Can any one tell what could be the reason for this error.

dot.exe : Warning: Two clusters named clusterWebPortal - the second will be ignored
At C:\Users\akshay.bhadoria\Documents\WindowsPowerShell\Modules\AzViz\1.2.1\src\private\ConvertTo-DOTLangauge.ps1:334 char:25

  •                     & $GraphViz.FullName $dot_file
    
  •                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (Warning: Two cl...will be ignored:String) [], RemoteException
    • FullyQualifiedErrorId : NativeCommandError