-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddAppRole.ps1
64 lines (49 loc) · 1.96 KB
/
addAppRole.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
60
61
62
63
64
# App Role Generator
# Jonathan Reynes - MISA - MCS 11/29/17
Connect-AzureAD
Class AppRole
{
[String[]]$allowedMemberTypes = @("user");
[String]$displayName;
static [Boolean]$isEnabled = $true;
[String]$id
[String]$description;
[String]$value;
}
Write-Host " _ ____ _ ____ _ "
Write-Host " / \ _ __ _ __ | _ \ ___ | | ___ / ___| ___ _ __ ___ _ __ __ _| |_ ___ _ __ "
Write-Host " / _ \ | '_ \| '_ \ | |_) / _ \| |/ _ \ | | _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \| '__|"
Write-Host " / ___ \| |_) | |_) | | _ < (_) | | __/ | |_| | __/ | | | __/ | | (_| | || (_) | | "
Write-Host " /_/ \_\ .__/| .__/ |_| \_\___/|_|\___| \____|\___|_| |_|\___|_| \__,_|\__\___/|_| "
Write-Host " |_| |_| "
Write-Host "This App Role Generator will generate the App Role portion of the manifest when"
Write-Host "groups are needed to be added to expose role claims for those groups"
Write-Host "ACTIONS WILL BE DISPLAYED AT THE END"
Write-Host " "
Write-Host "Please enter the group names when prompted. Press ENTER when done"
[String[]]$groups;
$in_ = "#PLACEHOLDER";
while($in_ -ne ""){
$in_ = Read-Host "Enter the Group Name"
if ($in_ -ne ""){
$groups.Add($in_)
}
}
$roles = New-Object System.Collections.ArrayList
foreach ($g in $groups)
{
$temp_role = New-Object AppRole;
$temp_role.displayName = $g;
$temp_role.description = $g;
$temp_role.value = $g;
$temp_role.id = New-Guid
$roles.Add($temp_role)
}
$roles | ConvertTo-Json | Write-Host
Write-Host "_________________________________________________________________________________"
Write-Host "ACTIONS: Once complete, "
Write-Host "1) copy and paste the json within the appRoles attribute of the application registration manifest in Azure AD"
foreach ($g in $groups) {
Write-Host $g
}
$groups.Clear()