Skip to content

Commit

Permalink
Fix user assigned identity export (#694)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Watherston <[email protected]>
  • Loading branch information
anwather and Anthony Watherston authored Jul 2, 2024
1 parent 9b593e7 commit be227cb
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions Scripts/Operations/Export-AzPolicyResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -697,11 +697,21 @@ foreach ($pacSelector in $globalSettings.pacEnvironmentSelectors) {
}
if ($identityType -eq "UserAssigned") {
$userAssignedIdentities = $policyAssignment.identity.userAssignedIdentities
$identityProperty = $userAssignedIdentities.psobject.Properties
$identity = $identityProperty.Name
$identityEntry = @{
userAssigned = $identity
location = $location
# $identityProperty = $userAssignedIdentities.psobject.Properties
$identity = $userAssignedIdentities.GetEnumerator().Name
if ($identity.Count -gt 1) {
$identityEntry = $identity | ForEach-Object {
@{
userAssigned = $PSItem
location = $location
}
}
}
else {
$identityEntry = @{
userAssigned = $identity
location = $location
}
}
}
elseif ($identityType -eq "SystemAssigned") {
Expand Down

0 comments on commit be227cb

Please sign in to comment.