Open lassehastrup opened 3 months ago
@lassehastrup Thanks for reporting the issue. Let me see if I understand the issue correctly.
Microsoft.Authorization/roleAssignments
resource you get a failure with reason Path properties.principalType: The field 'properties.principalType' does not exist.
if the property is not set in Bicep.properties.principalType
defaults to ServicePrincipal
when not set so the reason The field 'properties.principalType' does not exist.
is unexpected.Have I understood the issue correctly?
Hi @BernieWhite ,
The default value of properties.principalType is default 'user' according to this documentation:
You understood the issue correctly
Description of the issue
Using a custom rule of type 'Microsoft.Authorization/roleAssignments' with a condition that specifies that the field: 'properties.principalType' should be equal to 'xyz' we receive an error that the property does not exist.
However, when specifying the 'properties.PrincipalType' in a bicep file, and running the custom rule, everything works as expected. So it seems to only be an issue when the bicep property is not set.
To Reproduce
Steps to reproduce the issue:
PSRule rule:
Bicep file:
Error output
When adding the properties.PrincipalType to the bicep file:
Everything works as expected.
Expected behaviour
As the property clearly exist in bicep, as is working as expected in ARM, we had hoped that PSRule would process the property correctly even when the property is not set in the bicep file.
Module in use and version:
Captured output from
$PSVersionTable
:Additional context