fix: handle retired classicAdministrators API (InvalidResourceType 404) - #68
Open
SilvanBuehler wants to merge 1 commit into
Open
Conversation
Microsoft retired Azure classic administrators on 2024-08-31 and the resource type has been fully removed as of May 2026. The endpoint now returns HTTP 404 with error.code InvalidResourceType. dataCollectionClassicAdministratorsSub called AzAPICall without unhandledErrorAction, so AzAPICall defaulted to Stop on this unhandled 404, raising a terminating error inside the -Parallel ForEach-Object block and killing the entire run. Two changes to dataCollectionClassicAdministratorsSub (AzGovVizParallel.ps1 and dev/functions/dataCollection/dataCollectionFunctions.ps1): 1. Add unhandledErrorAction = 'ContinueQuiet' to the AzAPICall splat so the defunct endpoint does not terminate the run. 2. Add 'InvalidResourceType' to the result guard alongside the existing 'ClassicAdministratorListFailed' check so the subscription is silently skipped when AzAPICall returns that string. Ref: https://learn.microsoft.com/en-us/azure/role-based-access-control/classic-administrators
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Microsoft retired Azure classic administrators on 2024-08-31 and the resource type has been fully removed as of May 2026. The endpoint now returns:
dataCollectionClassicAdministratorsSubcalledAzAPICallwithout anunhandledErrorActionparameter. AzAPICall 1.4.1 treats this unrecognised 404 asStop, which raises a terminating error inside the-ParallelForEach-Object block and kills the entire run for all subscriptions in the tenant.First observed on a CSP subscription (quotaId
CSP_2015-05-01), but not CSP-specific - the resource type is gone tenant-wide.Fix
Two changes to
dataCollectionClassicAdministratorsSub(inAzGovVizParallel.ps1anddev/functions/dataCollection/dataCollectionFunctions.ps1):1. Add
unhandledErrorAction = 'ContinueQuiet'to the AzAPICall splatPrevents the defunct endpoint from terminating the run. Matches the pattern already used by
getDiagnosticSettingsMg, storage account calls, and other functions that encounter legitimately absent resource types.2. Add
'InvalidResourceType'to the result guardWhen the retired API returns
InvalidResourceType, the subscription is silently skipped and no classic administrators entry is recorded - which is correct since the resource type no longer exists anywhere in Azure.Reference
https://learn.microsoft.com/en-us/azure/role-based-access-control/classic-administrators