Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for selectors and overrides in Azure Policy CRUD cmdlets #26031

Merged
merged 5 commits into from
Sep 18, 2024

Conversation

mentat9
Copy link
Member

@mentat9 mentat9 commented Sep 5, 2024

Description

Implement ResourceSelector and Override parameters for New/Update-AzPolicyAssignment
Implement ResourceSelector parameter for New/Update-AzPolicyExemption
Add new tests for selectors and overrides
Add new examples for selectors and overrides

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • For SDK-based development mode, update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • For autorest-based development mode, include the changelog in the PR description.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

…olicyAssignment

Implement ResourceSelector parameter for New/Update-AzPolicyExemption
Add new tests for selectors and overrides
Add new examples for selectors and overrides
Copy link

azure-client-tools-bot-prd bot commented Sep 5, 2024

️✔️Az.Accounts
️✔️Build
️✔️PowerShell Core - Windows
⚠️Az.Resources
️✔️Build
️✔️PowerShell Core - Windows
️✔️Breaking Change Check
️✔️PowerShell Core - Windows
⚠️Signature Check
⚠️PowerShell Core - Windows
Type Cmdlet Description Remediation
⚠️ Get-AzADGroupOwner Get-AzADGroupOwner Changes the ConfirmImpact but does not set the SupportsShouldProcess property to true in the cmdlet attribute. Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue
⚠️ Get-AzADGroupOwner Get-AzADGroupOwner changes the confirm impact. Please ensure that the change in ConfirmImpact is justified Verify that ConfirmImpact is changed appropriately by the cmdlet. It is very rare for a cmdlet to change the ConfirmImpact.
⚠️ Get-AzADServicePrincipalAppRoleAssignment Get-AzADServicePrincipalAppRoleAssignment Changes the ConfirmImpact but does not set the SupportsShouldProcess property to true in the cmdlet attribute. Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue
⚠️ Get-AzADServicePrincipalAppRoleAssignment Get-AzADServicePrincipalAppRoleAssignment changes the confirm impact. Please ensure that the change in ConfirmImpact is justified Verify that ConfirmImpact is changed appropriately by the cmdlet. It is very rare for a cmdlet to change the ConfirmImpact.
⚠️ Get-AzPolicyAssignment Get-AzPolicyAssignment Changes the ConfirmImpact but does not set the SupportsShouldProcess property to true in the cmdlet attribute. Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue
⚠️ Get-AzPolicyAssignment Get-AzPolicyAssignment changes the confirm impact. Please ensure that the change in ConfirmImpact is justified Verify that ConfirmImpact is changed appropriately by the cmdlet. It is very rare for a cmdlet to change the ConfirmImpact.
⚠️ Get-AzPolicyDefinition Get-AzPolicyDefinition Changes the ConfirmImpact but does not set the SupportsShouldProcess property to true in the cmdlet attribute. Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue
⚠️ Get-AzPolicyDefinition Get-AzPolicyDefinition changes the confirm impact. Please ensure that the change in ConfirmImpact is justified Verify that ConfirmImpact is changed appropriately by the cmdlet. It is very rare for a cmdlet to change the ConfirmImpact.
⚠️ Get-AzPolicyExemption Get-AzPolicyExemption Changes the ConfirmImpact but does not set the SupportsShouldProcess property to true in the cmdlet attribute. Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue
⚠️ Get-AzPolicyExemption Get-AzPolicyExemption changes the confirm impact. Please ensure that the change in ConfirmImpact is justified Verify that ConfirmImpact is changed appropriately by the cmdlet. It is very rare for a cmdlet to change the ConfirmImpact.
⚠️ Get-AzPolicySetDefinition Get-AzPolicySetDefinition Changes the ConfirmImpact but does not set the SupportsShouldProcess property to true in the cmdlet attribute. Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue
⚠️ Get-AzPolicySetDefinition Get-AzPolicySetDefinition changes the confirm impact. Please ensure that the change in ConfirmImpact is justified Verify that ConfirmImpact is changed appropriately by the cmdlet. It is very rare for a cmdlet to change the ConfirmImpact.
⚠️Help Example Check
⚠️PowerShell Core - Windows
Type Cmdlet Example Line RuleName Description Extent Remediation
⚠️ New-AzPolicyAssignment 9 3 Mismatched_Parameter_Value_Type New-AzPolicyAssignment -PolicyDefinition $Policy is not an expected parameter value type. -PolicyDefinition Use correct parameter value type. Expected Type is psobject. Now the type is Microsoft.Azure.PowerShell.Cmdlets.Policy.Models.IPolicyDefinition.(Command).
⚠️ New-AzPolicyAssignment 10 4 Mismatched_Parameter_Value_Type New-AzPolicyAssignment -PolicyDefinition $Policy is not an expected parameter value type. -PolicyDefinition Use correct parameter value type. Expected Type is psobject. Now the type is Microsoft.Azure.PowerShell.Cmdlets.Policy.Models.IPolicyDefinition.(Command).
⚠️ New-AzPolicyAssignment 11 5 Mismatched_Parameter_Value_Type New-AzPolicyAssignment -PolicyDefinition $Policy is not an expected parameter value type. -PolicyDefinition Use correct parameter value type. Expected Type is psobject. Now the type is Microsoft.Azure.PowerShell.Cmdlets.Policy.Models.IPolicyDefinition.(Command).
⚠️ New-AzPolicyAssignment 12 13 Mismatched_Parameter_Value_Type New-AzPolicyAssignment -PolicyDefinition $Policy is not an expected parameter value type. -PolicyDefinition Use correct parameter value type. Expected Type is psobject. Now the type is Microsoft.Azure.PowerShell.Cmdlets.Policy.Models.IPolicyDefinition.(Command).
⚠️ New-AzPolicyExemption 3 3 Mismatched_Parameter_Value_Type New-AzPolicyExemption -PolicyAssignment $Assignment is not an expected parameter value type. -PolicyAssignment Use correct parameter value type. Expected Type is psobject. Now the type is Microsoft.Azure.PowerShell.Cmdlets.Policy.Models.IPolicyAssignment.(Command).
⚠️ New-AzPolicyExemption 4 3 Mismatched_Parameter_Value_Type New-AzPolicyExemption -PolicyAssignment $Assignment is not an expected parameter value type. -PolicyAssignment Use correct parameter value type. Expected Type is psobject. Now the type is Microsoft.Azure.PowerShell.Cmdlets.Policy.Models.IPolicyAssignment.(Command).
⚠️ New-AzPolicyExemption 4 3 Unassigned_Variable New-AzPolicyExemption -Scope $SpecialVM.Id is a null-valued parameter value. -Scope Assign value for $SpecialVM.Id.
⚠️ New-AzPolicyExemption 5 3 Mismatched_Parameter_Value_Type New-AzPolicyExemption -PolicyAssignment $Assignment is not an expected parameter value type. -PolicyAssignment Use correct parameter value type. Expected Type is psobject. Now the type is Microsoft.Azure.PowerShell.Cmdlets.Policy.Models.IPolicyAssignment.(Command).
⚠️ Update-AzPolicyAssignment 10 3 Is_Alias Set-AzPolicyAssignment is an alias of 'Update-AzPolicyAssignment'. Set-AzPolicyAssignment -Id $PolicyAssignment.ResourceId -EnforcementMode Default Use formal name 'Update-AzPolicyAssignment' of the alias 'Set-AzPolicyAssignment'.
⚠️ Update-AzPolicyAssignment 10 3 Mismatched_Parameter_Value_Type Set-AzPolicyAssignment -Id $PolicyAssignment.ResourceId is not an expected parameter value type. -Id Use correct parameter value type. Expected Type is string. Now the type is .(Command).
⚠️ Update-AzPolicyExemption 6 2 Is_Alias Set-AzPolicyExemption is an alias of 'Update-AzPolicyExemption'. Set-AzPolicyExemption -Id $PolicyExemption.ResourceId -ClearExpiration Use formal name 'Update-AzPolicyExemption' of the alias 'Set-AzPolicyExemption'.
⚠️ Update-AzPolicyExemption 6 2 Mismatched_Parameter_Value_Type Set-AzPolicyExemption -Id $PolicyExemption.ResourceId is not an expected parameter value type. -Id Use correct parameter value type. Expected Type is string. Now the type is .(Command).
️✔️Help File Existence Check
️✔️PowerShell Core - Windows
⚠️File Change Check
⚠️PowerShell Core - Windows
Type Cmdlet Description Remediation
⚠️ It is required to update ChangeLog.md if you want to release a new version for Az.Resources. Add a changelog record under Upcoming Release section with past tense.
️✔️UX Metadata Check
️✔️PowerShell Core - Windows
⚠️Test
⚠️ - Linux
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 0.00 % Test coverage for the module cannot be lower than 50%.
⚠️ - MacOS
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 0.00% Test coverage for the module cannot be lower than 50%.
⚠️PowerShell Core - Windows
Type Title Current Coverage Description
⚠️ Test Coverage Less Than 50% 0.00% Test coverage for the module cannot be lower than 50%.

Copy link

github-actions bot commented Sep 9, 2024

This PR was labeled "needs-revision" because it has unresolved review comments or CI failures.
Please resolve all open review comments and make sure all CI checks are green. Refer to our guide to troubleshoot common CI failures.

@mentat9
Copy link
Member Author

mentat9 commented Sep 10, 2024

/azp run

Copy link
Contributor

Commenter does not have sufficient privileges for PR 26031 in repo Azure/azure-powershell

@mentat9
Copy link
Member Author

mentat9 commented Sep 10, 2024

@msJinLei - I've applied your feedback and removed the needs-revision label. Can you take another look? The CI check failures seem to be from checkers crashing: not sure how to debug that.

@msJinLei
Copy link
Contributor

@msJinLei - I've applied your feedback and removed the needs-revision label. Can you take another look? The CI check failures seem to be from checkers crashing: not sure how to debug that.

You the files of doc folder is generated. Please fix what of examples folder and regenerate the module

Copy link

This PR was labeled "needs-revision" because it has unresolved review comments or CI failures.
Please resolve all open review comments and make sure all CI checks are green. Refer to our guide to troubleshoot common CI failures.

@mentat9
Copy link
Member Author

mentat9 commented Sep 13, 2024

@msJinLei - My last change should fix the test failures. Please take another look when you get a chance.

@mentat9
Copy link
Member Author

mentat9 commented Sep 16, 2024

@msJinLei - My last change should fix the test failures. Please take another look when you get a chance.

@msJinLei - I also removed the needs-revision label. Please take a look: this PR is ready for merge/release.

```powershell
{
'{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the non-powershell content in the examples first and re-generate the module again

```powershell
{
'{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these lines

@msJinLei msJinLei merged commit c9fb1b8 into Azure:generation Sep 18, 2024
8 checks passed
jaskisin pushed a commit to jaskisin/azure-powershell that referenced this pull request Oct 8, 2024
…zure#26031)

* Implement ResourceSelector and Override parameters for New/Update-AzPolicyAssignment
Implement ResourceSelector parameter for New/Update-AzPolicyExemption
Add new tests for selectors and overrides
Add new examples for selectors and overrides

* Rerecord tests

* Fix two examples to contain only powershell commands

* Rebuild docs

* Switch tag new tests as -LiveOnly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants