Open
Conversation
| Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates Az.PolicyInsights cmdlets to AutoRest-based generation and scaffolds module assets (custom cmdlets, overrides, docs/examples, and Pester tests) needed to keep back-compat behavior while switching generation approach.
Changes:
- Introduces AutoRest module structure for PolicyInsights, including custom PowerShell cmdlets and generated override hooks in C#.
- Adds/updates Pester test harness, test data files, and back-compat tests for core cmdlets.
- Adds generated documentation and usage examples for the migrated cmdlets.
Reviewed changes
Copilot reviewed 105 out of 359 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| src/PolicyInsights/PolicyInsights.Management.Sdk/Customizations/Attestation.cs | Removes legacy SDK customization class in favor of AutoRest-generated model/cmdlets. |
| src/PolicyInsights/PolicyInsights.Autorest/utils/Unprotect-SecureString.ps1 | Adds a utility script used to convert SecureString to plaintext (likely for test/dev workflows). |
| src/PolicyInsights/PolicyInsights.Autorest/utils/Get-SubscriptionIdTestSafe.ps1 | Adds helper to retrieve subscription id in a playback-safe way for tests. |
| src/PolicyInsights/PolicyInsights.Autorest/test/localEnv.json | Adds live-mode local environment values for tests. |
| src/PolicyInsights/PolicyInsights.Autorest/test/loadEnv.ps1 | Adds test environment loader used by Pester runs. |
| src/PolicyInsights/PolicyInsights.Autorest/test/env.json | Adds record/playback environment values for tests. |
| src/PolicyInsights/PolicyInsights.Autorest/test/TestSetupFiles/NSG_modify_neverCompliant_policyDefinition.json | Normalizes JSON file (removes BOM) for test setup content. |
| src/PolicyInsights/PolicyInsights.Autorest/test/TestSetupFiles/NSG_audit_partiallyCompliant_policyDefinition.json | Normalizes JSON file (removes BOM) for test setup content. |
| src/PolicyInsights/PolicyInsights.Autorest/test/TestSetupFiles/NSG_DINE_neverCompliant_policyDefinition.json | Normalizes JSON file (removes BOM) for test setup content. |
| src/PolicyInsights/PolicyInsights.Autorest/test/TestSetupFiles/ManualPolicySubDefinition.json | Adds manual policy definition used by tests. |
| src/PolicyInsights/PolicyInsights.Autorest/test/TestSetupFiles/ManualPolicyResourceDefinition.json | Adds manual policy definition used by tests. |
| src/PolicyInsights/PolicyInsights.Autorest/test/TestSetupFiles/ManualPolicyRGDefinition.json | Adds manual policy definition used by tests. |
| src/PolicyInsights/PolicyInsights.Autorest/test/TestSetupFiles/CreateRemediationsTemplate.json | Normalizes JSON file (removes BOM) for ARM template test asset. |
| src/PolicyInsights/PolicyInsights.Autorest/test/TestSetupFiles/CreateNSGsTemplate.json | Normalizes JSON file (removes BOM) for ARM template test asset. |
| src/PolicyInsights/PolicyInsights.Autorest/test/TestSetupFiles/AttestationMetadata.json | Adds metadata JSON used by attestation tests. |
| src/PolicyInsights/PolicyInsights.Autorest/test/README.md | Adds documentation describing test modes and how stubs are generated. |
| src/PolicyInsights/PolicyInsights.Autorest/test/Common.ps1 | Adds shared Pester test initialization and mocking discovery logic. |
| src/PolicyInsights/PolicyInsights.Autorest/test/Backcompat/PolicyStateSummary.Tests.ps1 | Adds back-compat tests for Get-AzPolicyStateSummary. |
| src/PolicyInsights/PolicyInsights.Autorest/test/Backcompat/PolicyState.Tests.ps1 | Adds back-compat tests for Get-AzPolicyState (including paging and query options). |
| src/PolicyInsights/PolicyInsights.Autorest/test/Backcompat/PolicyMetadata.Tests.ps1 | Adds back-compat tests for Get-AzPolicyMetadata. |
| src/PolicyInsights/PolicyInsights.Autorest/test/Backcompat/PolicyEvent.Tests.ps1 | Adds back-compat tests for Get-AzPolicyEvent. |
| src/PolicyInsights/PolicyInsights.Autorest/test/Backcompat/PolicyComplianceScan.Tests.ps1 | Adds back-compat tests for Start-AzPolicyComplianceScan. |
| src/PolicyInsights/PolicyInsights.Autorest/test/Backcompat/Common.ps1 | Adds back-compat-specific test bootstrap (recording path & test data path overrides). |
| src/PolicyInsights/PolicyInsights.Autorest/resources/README.md | Adds guidance for non-packaged repository resources. |
| src/PolicyInsights/PolicyInsights.Autorest/how-to.md | Adds module development guide (build, docs, tests, packing). |
| src/PolicyInsights/PolicyInsights.Autorest/examples/Update-AzPolicyAttestation.md | Adds example scenarios for updating attestations. |
| src/PolicyInsights/PolicyInsights.Autorest/examples/Stop-AzPolicyRemediation.md | Adds examples for stopping remediations. |
| src/PolicyInsights/PolicyInsights.Autorest/examples/Start-AzPolicyRemediation.md | Adds examples for starting remediations. |
| src/PolicyInsights/PolicyInsights.Autorest/examples/Start-AzPolicyComplianceScan.md | Adds examples for starting compliance scans. |
| src/PolicyInsights/PolicyInsights.Autorest/examples/Remove-AzPolicyRemediation.md | Adds examples for removing remediations. |
| src/PolicyInsights/PolicyInsights.Autorest/examples/Remove-AzPolicyAttestation.md | Adds examples for removing attestations. |
| src/PolicyInsights/PolicyInsights.Autorest/examples/New-AzPolicyAttestation.md | Adds examples for creating attestations at multiple scopes. |
| src/PolicyInsights/PolicyInsights.Autorest/examples/Get-AzPolicyStateSummary.md | Adds examples for querying policy state summaries. |
| src/PolicyInsights/PolicyInsights.Autorest/examples/Get-AzPolicyRemediation.md | Adds examples for querying remediations. |
| src/PolicyInsights/PolicyInsights.Autorest/examples/Get-AzPolicyMetadata.md | Adds examples for querying policy metadata. |
| src/PolicyInsights/PolicyInsights.Autorest/examples/Get-AzPolicyEvent.md | Adds examples for querying policy events. |
| src/PolicyInsights/PolicyInsights.Autorest/examples/Get-AzPolicyAttestation.md | Adds examples for querying attestations. |
| src/PolicyInsights/PolicyInsights.Autorest/docs/Stop-AzPolicyRemediation.md | Adds generated help markdown for Stop-AzPolicyRemediation. |
| src/PolicyInsights/PolicyInsights.Autorest/docs/Start-AzPolicyComplianceScan.md | Adds generated help markdown for Start-AzPolicyComplianceScan. |
| src/PolicyInsights/PolicyInsights.Autorest/docs/Remove-AzPolicyRemediation.md | Adds generated help markdown for Remove-AzPolicyRemediation. |
| src/PolicyInsights/PolicyInsights.Autorest/docs/Remove-AzPolicyAttestation.md | Adds generated help markdown for Remove-AzPolicyAttestation. |
| src/PolicyInsights/PolicyInsights.Autorest/docs/README.md | Adds documentation folder contract (generated, packaged, overwritten). |
| src/PolicyInsights/PolicyInsights.Autorest/docs/Get-AzPolicyRemediation.md | Adds generated help markdown for Get-AzPolicyRemediation. |
| src/PolicyInsights/PolicyInsights.Autorest/docs/Get-AzPolicyMetadata.md | Adds generated help markdown for Get-AzPolicyMetadata. |
| src/PolicyInsights/PolicyInsights.Autorest/docs/Az.PolicyInsights.md | Adds module-level help index page. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/Start-AzPolicyComplianceScan.ps1 | Adds custom wrapper cmdlet routing to the correct internal evaluation call. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/Remove-AzPolicyAttestation.ps1 | Adds custom wrapper to work around identity/resourceId parsing behavior. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/README.md | Adds guidance for custom cmdlets and supported customization mechanisms. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/Get-AzPolicyStateSummary.ps1 | Adds custom wrapper for summarize operation and output shaping. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/Get-AzPolicyState.ps1 | Adds custom wrapper with -All semantics and internal query routing. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/Get-AzPolicyMetadata.ps1 | Adds custom wrapper for list/get metadata with output shaping. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/Get-AzPolicyEvent.ps1 | Adds custom wrapper for listing policy events. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/Summary.cs | Adds model extension to surface compliant-resource counts. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/Remediation.cs | Adds model extension to carry deployment details when requested. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/PolicyState.cs | Adds model alias property for policy evaluation details. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/PolicyAssignmentSummary.cs | Adds model extension to surface compliant-resource counts in assignment summaries. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyState_List7.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyState_List6.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyState_List5.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyState_List4.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyState_List3.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyState_List2.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyState_List1.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyState_List.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyRemediationDeployment_List3.cs | Overrides paging to use POST for nextLink follow in deployments list variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyRemediationDeployment_List2.cs | Overrides paging to use POST for nextLink follow in deployments list variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyRemediationDeployment_List1.cs | Overrides paging to use POST for nextLink follow in deployments list variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyRemediationDeployment_List.cs | Overrides paging to use POST for nextLink follow in deployments list variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyMetadata_List.cs | Overrides list paging behavior to stop once Top is satisfied. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyEvent_List7.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated events query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyEvent_List6.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated events query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyEvent_List5.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated events query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyEvent_List4.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated events query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyEvent_List3.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated events query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyEvent_List2.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated events query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyEvent_List1.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated events query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/GetAzPolicyEvent_List.cs | Overrides paging behavior (Top enforcement + POST nextLink follow) for a generated events query variant. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/ExpressionEvaluationDetails.cs | Overrides JSON deserialization to preserve complex values as stringified JSON. |
| src/PolicyInsights/PolicyInsights.Autorest/custom/Az.PolicyInsights.custom.psm1 | Adds the custom module entrypoint that imports private/internal modules and dot-sources script cmdlets. |
| src/PolicyInsights/PolicyInsights.Autorest/Properties/AssemblyInfo.cs | Adds assembly metadata for the AutoRest project. |
| src/PolicyInsights/PolicyInsights.Autorest/.gitignore | Adds module-local ignore rules for generated/build artifacts. |
| src/PolicyInsights/PolicyInsights.Autorest/.gitattributes | Adds basic text normalization configuration. |
src/PolicyInsights/PolicyInsights.Autorest/custom/Remove-AzPolicyAttestation.ps1
Outdated
Show resolved
Hide resolved
src/PolicyInsights/PolicyInsights.Autorest/custom/Remove-AzPolicyAttestation.ps1
Outdated
Show resolved
Hide resolved
src/PolicyInsights/PolicyInsights.Autorest/custom/Remove-AzPolicyAttestation.ps1
Show resolved
Hide resolved
src/PolicyInsights/PolicyInsights.Autorest/custom/Start-AzPolicyComplianceScan.ps1
Show resolved
Hide resolved
src/PolicyInsights/PolicyInsights.Autorest/custom/GeneratedOverrides/PolicyAssignmentSummary.cs
Outdated
Show resolved
Hide resolved
src/PolicyInsights/PolicyInsights.Autorest/utils/Unprotect-SecureString.ps1
Show resolved
Hide resolved
Collaborator
|
/azp run |
Contributor
|
Azure Pipelines successfully started running 3 pipeline(s). |
Collaborator
|
before reviewing this PR, please create a new PR to announce breaking changes ASAP, otherwise it cannot be accepted during build event. |
Collaborator
|
/azp run |
Contributor
|
Azure Pipelines successfully started running 3 pipeline(s). |
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.
Description
Migration to autorest generation for the PolicyInsights cmdlets. Required some customization that has been implemented using the README.md, custom cmdlets, and some c# changes when needed.
Mandatory Checklist
Please choose the target release of Azure PowerShell. (⚠️ Target release is a different concept from API readiness. Please click below links for details.)
Check this box to confirm: I have read the Submitting Changes section of
CONTRIBUTING.mdand reviewed the following information:ChangeLog.mdfile(s) appropriatelysrc/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.## Upcoming Releaseheader in the past tense.ChangeLog.mdif no new release is required, such as fixing test case only.