Skip to content

Commit

Permalink
Add policy set definition workaround (#1659)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredfholgate authored Jun 5, 2024
1 parent befa244 commit 9b578dd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Alz.Tools/functions/Alz.Tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ function ProcessObjectByResourceType {
}
"microsoft.authorization/policysetdefinitions" {
$outputObject = [PolicySetDefinition]::new($ResourceObject)
# Workaround for policySetDefinitions that only have a single policyDefinition. PowerShell tires to convert to an object in that scenario.
if($outputObject.properties.policyDefinitions.GetType().ToString() -eq "PolicySetDefinitionPropertiesPolicyDefinitions") {
$outputObject.properties.policyDefinitions = @($outputObject.properties.policyDefinitions)
}
}
"microsoft.authorization/roleassignments" {
$outputObject = [RoleAssignment]::new($ResourceObject)
Expand Down

0 comments on commit 9b578dd

Please sign in to comment.