Skip to content

Instantly share code, notes, and snippets.

@TiloGit
Last active February 9, 2023 16:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TiloGit/33e95c5afe3acfc959e953db532abc72 to your computer and use it in GitHub Desktop.
Save TiloGit/33e95c5afe3acfc959e953db532abc72 to your computer and use it in GitHub Desktop.
Check Azure AD enterprise apps
Get-AzureADServicePrincipal -All:$true | ? {$_.Tags -eq "WindowsAzureActiveDirectoryIntegratedApp"} | Foreach-Object{
$AppObjectId = $_
$AppUser = Get-AzureADServiceAppRoleAssignment -ObjectId $AppObjectId.ObjectId #-All $true
New-Object -TypeName PSObject -Property @{
AppDisplayName = $AppObjectId.DisplayName
AppDisplayName2 = $AppObjectId.AppDisplayName
AppPublisherName = $AppObjectId.PublisherName
AppObjectId = $AppObjectId.ObjectId
AppAppId = $AppObjectId.AppId
AppReplyUrls = $AppObjectId.ReplyUrls
UserUPN = $AppUser.PrincipalDisplayName
UserCreation = $AppUser.CreationTimestamp
#UserAndDate= "$($AppUser.PrincipalDisplayName) at $($AppUser.CreationTimestamp)"
}
} | select AppDisplayName,AppDisplayName2,AppPublisherName,AppObjectId,AppAppId,@{ n='AppReplyUrls'; e={ $_.AppReplyUrls -join ' ' } },@{ n='User'; e={ $_.UserUPN -join ' ' } },@{ n='UserCreated'; e={ $_.UserCreation -join ' ' } } | Export-Csv -Path .\AppsO365.csv -NoTypeInformation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment