Description
Get-AzPolicyRemediation at management-group scope is broken in Az.PolicyInsights 2.0.0. When listing remediations for a management group it resolves the Microsoft.Management/managementGroups resource using api-version 2024-10-01 — but the Microsoft.Management resource provider does not support that api-version, so the call fails.
Repro
Install-Module Az.PolicyInsights -RequiredVersion 2.0.0 -Force
Get-AzPolicyRemediation -ManagementGroupName
Expected: MG-scope resolution should use a supported Microsoft.Management api-version (e.g. 2023-04-01), as in 1.7.4. Get-AzPolicyRemediation -ManagementGroupName should return remediations without error.
Every management-group-scoped remediation status check fails. This breaks EPAC New-AzRemediationTasks monitoring for all MG-scoped remediation tasks.
Environment
Az.PolicyInsights: 2.0.0 (broken) / 1.7.4 (works)
PowerShell 7 / Linux
Workaround: pin Az.PolicyInsights to 1.7.4.
Issue script & Debug output
Get-AzPolicyRemediation_List3: .../Az.PolicyInsights/2.0.0/PolicyInsights.Autorest/custom/Get-AzPolicyRemediation.ps1:280
The resource type 'managementGroups' could not be found in the namespace 'microsoft.management'
for api version '2024-10-01'. The supported api-versions are
'2024-02-01-preview,2023-04-01,2021-04-01,2020-10-01,2020-05-01,2020-02-01,2019-11-01,
2018-03-01-preview,2018-01-01-preview,2017-11-01-preview,2017-08-31-preview,
2017-06-30-preview,2017-05-31-preview,2018-03-01-beta'.
Environment data
Reproduced in a Linux CI container (custom internal image), PowerShell 7.x (Core).
This is an api-version issue in the generated cmdlet, so it is OS-independent.
Module versions
Az.PolicyInsights 2.0.0 fails / 1.7.4 works
Error output
Description
Get-AzPolicyRemediation at management-group scope is broken in Az.PolicyInsights 2.0.0. When listing remediations for a management group it resolves the Microsoft.Management/managementGroups resource using api-version 2024-10-01 — but the Microsoft.Management resource provider does not support that api-version, so the call fails.
Repro
Install-Module Az.PolicyInsights -RequiredVersion 2.0.0 -Force
Get-AzPolicyRemediation -ManagementGroupName
Expected: MG-scope resolution should use a supported Microsoft.Management api-version (e.g. 2023-04-01), as in 1.7.4. Get-AzPolicyRemediation -ManagementGroupName should return remediations without error.
Every management-group-scoped remediation status check fails. This breaks EPAC New-AzRemediationTasks monitoring for all MG-scoped remediation tasks.
Environment
Az.PolicyInsights: 2.0.0 (broken) / 1.7.4 (works)
PowerShell 7 / Linux
Workaround: pin Az.PolicyInsights to 1.7.4.
Issue script & Debug output
Environment data
Module versions
Error output