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
857 stars 308 forks source link

Issue at line 5437 when running in console #228

Closed RTaneja23 closed 7 months ago

RTaneja23 commented 7 months ago

AzGovViz version 6.4.3

CodeRunPlatform Console

Describe the bug [AzAPICallErrorHandler 1.2.0] Getting Microsoft Defender for Cloud plans for Subscription: ' [quotaId:'EnterpriseAgreement_2014-09-01'] try #8; uri:"https://management.azure.com/subscriptions/b27e7e0e-d477-4a89-9fdb-c098d7c9d2a9/providers/Microsoft.Security/pricings?api-version=2018-06-01"; return: (StatusCode: '500' (InternalServerError)) <.code: ''> <.error.code: 'GeneralError'> | <.message: ''> <.error.message: 'Internal server error has occurred'> AzAPICall: exit (after 7 tries) - unhandledErrorAction: Stop Exception: C:\Users\Rahul.Taneja\Azure-MG-Sub-Governance-Reporting\Azure-MG-Sub-Governance-Reporting\pwsh\AzGovVizParallel.ps1:5437:9 Line | 5437 | $subsToProcessInCustomDataCollectionBatch | ForEach-Object -P … | ~~~~~~~~~~~~~ | Error - check the last console output for details

Screenshots

Additional context The error is produced every time I run the script from local console regardless of management group ID. Please help!

JulianHayward commented 7 months ago

hmm, can you try this?


$scopeId = 'your-subscriptionId-here'
$uri = "https://management.azure.com/subscriptions/$($scopeId)/providers/Microsoft.Security/pricings?api-version=2018-06-01"
$method = 'GET'
$defenderPlansResultTest = Invoke-AzRestMethod -uri $uri -method $method
´´´