Azure / PSRule.Rules.Azure

Rules to validate Azure resources and infrastructure as code (IaC) using PSRule.
https://azure.github.io/PSRule.Rules.Azure/
MIT License
383 stars 84 forks source link

[BUG] Policy as rules compatibility with Az.Resources v7.x #2970

Closed BernieWhite closed 1 month ago

BernieWhite commented 1 month ago

Existing rule

No response

Description of the issue

Updates to Az.Resources in v7.x have introduced a breaking change that is not compatible with the Export-AzPolicyAssignmentData implementation.

We should rollback to v6.7.0 and update docs to reflect the issue until dependency on this module can be removed.

Error messages

ExpandPolicyAssignment: The property 'Properties' cannot be found on this object. Verify that the property exists.

Reproduction

Version of PSRule

2.9.0

Version of PSRule for Azure

1.27.0

Additional context

To work around this issue use Az.Resource v6.x. If multiple versions of Az.Resources are installed, specifically import the required version before running PSRule to prevent the latest version from being automatically imported.

For example:

Install-Module Az.Resource -RequiredVersion 6.7.0
Import-Module Az.Resources -RequiredVersion 6.7.0
Export-AzPolicyAssignmentData