Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astaykov/65ad0833cdfbdfb94512827ba9f4348f to your computer and use it in GitHub Desktop.
Save astaykov/65ad0833cdfbdfb94512827ba9f4348f to your computer and use it in GitHub Desktop.
Connect-AzureAD
$roles = Get-AzureADDirectoryRole
foreach ($role in $roles)
{
$members = Get-AzureADDirectoryRoleMember -ObjectId $role.ObjectId
Write-Host "--- Service Principals members of " $role.DisplayName " ---"
foreach ($member in $members)
{
if($member.ObjectType -eq "ServicePrincipal")
{
Write-Host $member.ObjectId " / " $member.AppDisplayName " / " $member.ServicePrincipalType
}
}
Write "---------------------------------------------------------"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment