This repository has been archived by the owner on Dec 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 525
/
Copy pathget-all-appproxy-apps-by-connectorgroup.ps1
59 lines (39 loc) · 2.02 KB
/
get-all-appproxy-apps-by-connectorgroup.ps1
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# This sample script gets all Azure AD Application Proxy Connector groups with the assigned applications.
#
# This script requires PowerShell 5.1 (x64) and one of the following modules:
# AzureAD 2.0.2.52
# AzureADPreview 2.0.2.53
#
# Before you begin:
# Run Connect-AzureAD to connect to the tenant domain.
# Required Azure AD role: Global Administrator or Application Administrator
Write-Host "Reading service principals. This operation might take longer..." -BackgroundColor "Black" -ForegroundColor "Green"
$aadapServPrinc = Get-AzureADServicePrincipal -Top 100000 | where-object {$_.Tags -Contains "WindowsAzureActiveDirectoryOnPremApp"}
Write-Host "Reading Azure AD applications. This operation might take longer..." -BackgroundColor "Black" -ForegroundColor "Green"
$allApps = Get-AzureADApplication -Top 100000
Write-Host "Reading application. This operation might take longer..." -BackgroundColor "Black" -ForegroundColor "Green"
$aadapApp = $aadapServPrinc | ForEach-Object { $allApps -match $_.AppId}
Write-Host "Reading connector groups. This operation might take longer..." -BackgroundColor "Black" -ForegroundColor "Green"
$aadapConnectorGroups=Get-AzureADApplicationProxyConnectorGroup -Top 100000
Write-Host "Displaying connector groups and assigned applications..." -BackgroundColor "Black" -ForegroundColor "Green"
Write-Host " "
foreach ($item in $aadapConnectorGroups)
{
If ($item.ConnectorGroupType -eq "applicationProxy")
{
"Connector group: " + $item.Name+ " (Id: " + $item.Id+ ")";
" ";
foreach ($item2 in $aadapApp)
{
$connector = Get-AzureADApplicationProxyApplicationConnectorGroup -ObjectId $item2.ObjectID;
If ($item.Id -eq $connector.Id)
{
$name = $aadapServPrinc -match $item2.AppId
$name.DisplayName + " (AppId: " + $item2.AppId+ ")"}
}
" ";
}
}
Write-Host ("")
Write-Host ("Finished.") -BackgroundColor "Black" -ForegroundColor "Green"
Write-Host ("")