JulianHayward / Azure-MG-Sub-Governance-Reporting

Azure Governance Visualizer aka AzGovViz is a PowerShell script that captures Azure Governance related information such as Azure Policy, RBAC (a lot more) by polling Azure ARM, Storage and Microsoft Graph APIs.
MIT License
814 stars 293 forks source link

Script stopped with the error and did not complete #194

Closed netkrish80 closed 12 months ago

netkrish80 commented 1 year ago

AzGovViz version Latest version. please only report bug if you are running the latest version of AzGovViz. yes

CodeRunPlatform Visual Studio Code Terminal

Describe the bug [AzAPICallErrorHandler 1.1.72] getTenantId for subscriptionId 'xxxxxx' [AzAPICallErrorHandler 1.1.72] getTenantId for subscriptionId 'xxxxxx' try #1; return: (StatusCode: '404' (NotFound)) <.code: ''> <.error.code: 'SubscriptionNotFound'> | <.message: ''> <.error.message: 'The subscription 'xxxxxx' could not be found.'> - AzAPICall: return 'SubscriptionNotFound Tenant unknown' AzGovVizParallel.ps1: Cannot find an overload for "TryParse" and the argument count: "2".

Screenshots If applicable, add screenshots to help explain your problem. Screenshot is only an addition paste the error output as text, please.

Additional context The script executed fine for three management group. But in this management group we are receiving the above error and script stopped running.

JulianHayward commented 1 year ago

@netkrish80 can you please share at what section the script was operating before the error? thx

netkrish80 commented 1 year ago

Hi Julian, Please find below the list of events before the error. ResourceTypeSupported | The resource type 'microsoft.web/staticsites' supports diagnostic settings. ResourceTypeSupported | The resource type 'microsoft.web/sites/slots' supports diagnostic settings. Checking Resource Types Diagnostics capability duration: 0.133987581666667 minutes (8.0392549 seconds) Building HTML Building preQueries Create Policy/Set helper hash table Create Policy/Set helper hash table duration: 6.9016475 seconds 0 orphaned Policy assignments found Processing Policy custom/built-In parity check 6 custom Policy definition(s) found that have parity with built-In Policy definition Policy rule Exporting PolicyCustomBuiltInParity CSV Policy custom/built-In parity check duration: 0.002099365 minutes (0.1259619 seconds) PreQueriesPolicyRelated duration: 0.6835292 seconds PreQueriesRBACRelated duration: 0.9266547 seconds PreQueriesDiagnosticsRelated duration: 0.0842192 seconds PreQueriesDefenderRelated duration: 0.0151559 seconds Pre Queries duration: 0.1446008 minutes (8.676048 seconds) Summary data collection Total Management Groups: xx (depth x) Total Subscriptions: xx () Total BuiltIn Policy definitions: xxxx Total Custom Policy definitions: xx Total BuiltIn PolicySet definitions: xx Total Custom PolicySet definitions: xx Total Policy assignments: xx Total Policy assignments ManagementGroups xx Total Policy assignments Subscriptions xx Total Policy assignments ResourceGroups: xx Total Custom Role definitions: xxx Total Role assignments: xxxx Total Role assignments (Tenant): x Total Role assignments (ManagementGroups): xx Total Role assignments (Subscriptions): xxx Total Role assignments (ResourceGroups and Resources): xxxx Total Blueprint definitions: xx Total Blueprint assignments: xxx Total Resources: xxxxx Total Resource Types: xxx Summary data collection duration: 8.8398808 seconds Creating new state (HTML-Subscriptions) (local only)) Building HierarchyMap Building HierarchyMap duration: 0.00487509333333333 minutes (0.2925056 seconds) Processing Network enrichment (161 Virtual Networks) [AzAPICallErrorHandler 1.1.72] getTenantId for subscriptionId 'xxxxxx' [AzAPICallErrorHandler 1.1.72] getTenantId for subscriptionId 'xxxxxx' try #1; return: (StatusCode: '404' (NotFound)) <.code: ''> <.error.code: 'SubscriptionNotFound'> | <.message: ''> <.error.message: 'The subscription 'xxxxxx' could not be found.'> - AzAPICall: return 'SubscriptionNotFound Tenant unknown' AzGovVizParallel.ps1: Cannot find an overload for "TryParse" and the argument count: "2".

JulianHayward commented 1 year ago

@netkrish80 ok, thanks - looks like there is a vnet peering where the peer subscription doesn´t exist anymore. Will mention here once a fix is available. In the meantime you can use the parameter -NoNetwork.

JulianHayward commented 1 year ago

@netkrish80 please try: branch issue194

netkrish80 commented 1 year ago

Hi Julian,

The -NoNetwork option worked. If i don't include that even in the new version of code the same error message i received.

JulianHayward commented 1 year ago

@netkrish80 refreshed the branch, can you please try again?

netkrish80 commented 1 year ago

Hi Julian,

I tried. Still got the same error.

JulianHayward commented 1 year ago

@netkrish80 can you please again share the list of events before the error (the last one before the error is sufficient - like e.g. 'Processing Network enrichment')

JulianHayward commented 1 year ago

@netkrish80 will you please update? thx

netkrish80 commented 1 year ago

Processing Network enrichment (163 Virtual Networks) [AzAPICallErrorHandler 1.1.72] getTenantId for subscriptionId 'xxxxx' [AzAPICallErrorHandler 1.1.72] getTenantId for subscriptionId 'xxxxx' try #1; return: (StatusCode: '404' (NotFound)) <.code: ''> <.error.code: 'SubscriptionNotFound'> | <.message: ''> <.error.message: 'The subscription 'xxxxx' could not be found.'> - AzAPICall: return 'SubscriptionNotFound Tenant unknown' AzGovVizParallel.ps1: Cannot find an overload for "TryParse" and the argument count: "2".

JulianHayward commented 1 year ago

@netkrish80 but that´s impossible :) can you ping me on linkedIn?

netkrish80 commented 1 year ago

Sure. I sent you connection request in linkedin

JulianHayward commented 1 year ago

@netkrish80 new version 6.2.3 in the fix branch - please test

JulianHayward commented 1 year ago

@netkrish80 any update from your side?

netkrish80 commented 1 year ago

Hello Julian,

I will execute the code today and let you know. Apologies for the delay.

netkrish80 commented 1 year ago

Hi Julian,

this version worked without any issue. thanks a lot

Krishna.