Skip to content

Commit

Permalink
updates for groups
Browse files Browse the repository at this point in the history
  • Loading branch information
dagarwal-mitre committed Dec 18, 2024
1 parent 7200154 commit e715335
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions PowerShell/ScubaGear/Modules/Providers/ExportAADProvider.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -448,20 +448,20 @@ function LoadObjectDataIntoPrivilegedUserHashtable {
$PrivilegedUsers[$GroupMember.Id].roles += $RoleName
}
}
elseif ($Objecttype -eq "serviceprincipal") {
elseif ($Membertype -eq "serviceprincipal") {

# In this section we need to add the service principal information to the "service principal" hashtable
if (-Not $PrivilegedUsers.ContainsKey($ObjectId)) {
$AADServicePrincipal = Get-MgBetaServicePrincipal -ServicePrincipalId $ObjectId -ErrorAction Stop
$PrivilegedUsers[$ObjectId] = @{
if (-Not $PrivilegedUsers.ContainsKey($GroupMember.Id)) {
$AADServicePrincipal = Get-MgBetaServicePrincipal -ServicePrincipalId $GroupMember.Id -ErrorAction Stop
$PrivilegedUsers[$GroupMember.Id] = @{
"DisplayName" = $AADServicePrincipal.DisplayName
"ServicePrincipalId" = $AADServicePrincipal.Id
"AppId" = $AADServicePrincipal.AppId
"roles" = @()
}
}
if ($PrivilegedUsers[$ObjectId].roles -notcontains $RoleName) {
$PrivilegedUsers[$ObjectId].roles += $RoleName
if ($PrivilegedUsers[$GroupMember.Id].roles -notcontains $RoleName) {
$PrivilegedUsers[$GroupMember.Id].roles += $RoleName
}
}
}
Expand Down

0 comments on commit e715335

Please sign in to comment.