-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWhere Enterprise Application.ps1
More file actions
32 lines (24 loc) · 997 Bytes
/
Where Enterprise Application.ps1
File metadata and controls
32 lines (24 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#Requires -Modules @{ ModuleName="Microsoft.Graph.Authentication"; ModuleVersion="2.3.0" }
#Requires -Modules @{ ModuleName="Microsoft.Graph.Applications"; ModuleVersion="2.3.0" }
$ErrorActionPreference = 'stop'
<#
.SYNOPSIS
Finding all Enterprise Application Service Principals.
.NOTES
AUTHOR: https://github.com/dwarfered/msgraph-sdk-powershell-examples
UPDATED: 12-10-2023
#>
$requiredScopes = @('Application.Read.All')
$currentScopes = (Get-MgContext).Scopes
if ($null -eq $currentScopes) {
Connect-MgGraph -Scopes $requiredScopes | Out-Null
} elseif (($currentScopes -match ([string]::Join('|', $requiredScopes))).Count -ne $requiredScopes.Count) {
Connect-MgGraph -Scopes $requiredScopes | Out-Null
}
$params = @{
'All' = $true;
'Filter' = "tags/Any(x: x eq 'WindowsAzureActiveDirectoryIntegratedApp')";
'PageSize' = '999';
}
$enterpriseApplications = Get-MgServicePrincipal @params
$enterpriseApplications | Format-List