Currently the expression properties field, name, or type can be used. In PowerShell the source file for the object can be referenced using $PSRule.Source.
For example:
# Synopsis: Policy exemptions must be stored under designated paths for review.
Rule 'Org.Azure.Policy.Path' -Type 'Microsoft.Authorization/policyExemptions' {
$Assert.WithinPath($PSRule.Source['Parameter'], '.', @(
'deployments/policy/'
));
}
Currently $PSRule.Source is not available within expressions, neither is an equivalent of $Assert.WithinPath.
It would be helpful to provide both options to allow suppression groups to exclude objects based on their origin path.
For example:
---
apiVersion: github.com/microsoft/PSRule/v1
kind: SuppressionGroup
metadata:
name: Local.IgnoreACRTests
spec:
if:
source: 'file'
withinPath: 'modules/**/*.tests.bicep'
Currently the expression properties
field,name, ortypecan be used. In PowerShell the source file for the object can be referenced using$PSRule.Source.For example:
Currently
$PSRule.Sourceis not available within expressions, neither is an equivalent of$Assert.WithinPath.It would be helpful to provide both options to allow suppression groups to exclude objects based on their origin path.
For example: