Skip to content

Commit 9c3dcd9

Browse files
committed
update scripts
1 parent fb2ed1d commit 9c3dcd9

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

5-AccessControl/2-call-api-groups/AppCreationScripts/Configure.ps1

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ Function AddResourcePermission($requiredAccess, `
3737
}
3838
}
3939

40-
#
4140
# Example: GetRequiredPermissions "Microsoft Graph" "Graph.Read|User.Read"
4241
# See also: http://stackoverflow.com/questions/42164581/how-to-configure-a-new-azure-ad-application-through-powershell
4342
Function GetRequiredPermissions([string] $applicationDisplayName, [string] $requiredDelegatedPermissions, [string]$requiredApplicationPermissions, $servicePrincipal)
@@ -70,7 +69,6 @@ Function GetRequiredPermissions([string] $applicationDisplayName, [string] $requ
7069
return $requiredAccess
7170
}
7271

73-
7472
Function ReplaceInLine([string] $line, [string] $key, [string] $value)
7573
{
7674
$index = $line.IndexOf($key)
@@ -101,6 +99,24 @@ Function ReplaceInTextFile([string] $configFilePath, [System.Collections.HashTab
10199

102100
Set-Content -Path $configFilePath -Value $lines -Force
103101
}
102+
103+
<#.Description
104+
This function creates a new Azure AD scope (OAuth2Permission) with default and provided values
105+
#>
106+
Function CreateScope( [string] $value, [string] $userConsentDisplayName, [string] $userConsentDescription, [string] $adminConsentDisplayName, [string] $adminConsentDescription)
107+
{
108+
$scope = New-Object Microsoft.Graph.PowerShell.Models.MicrosoftGraphPermissionScope
109+
$scope.Id = New-Guid
110+
$scope.Value = $value
111+
$scope.UserConsentDisplayName = $userConsentDisplayName
112+
$scope.UserConsentDescription = $userConsentDescription
113+
$scope.AdminConsentDisplayName = $adminConsentDisplayName
114+
$scope.AdminConsentDescription = $adminConsentDescription
115+
$scope.IsEnabled = $true
116+
$scope.Type = "User"
117+
return $scope
118+
}
119+
104120
Function CreateOptionalClaim([string] $name)
105121
{
106122
<#.Description
@@ -311,8 +327,8 @@ Function UpdateTextFile([string] $configFilePath, [System.Collections.HashTable]
311327
Write-Host "IMPORTANT: Please follow the instructions below to complete a few manual step(s) in the Azure portal":
312328
Write-Host "- For client"
313329
Write-Host " - Navigate to $clientPortalUrl"
314-
Write-Host " - This script has created a group named GroupAdmin for you. On Azure portal, assign some users to it, and configure your ID and Access token to emit GroupID in your app registration." -ForegroundColor Red
315-
Write-Host " - This script has created a group named GroupMember for you. On Azure portal, assign some users to it, and configure your ID and Access token to emit GroupID in your app registration." -ForegroundColor Red
330+
Write-Host " - On Azure portal, create a group named GroupAdmin and assign some users to it, then configure your ID and Access token to emit GroupID in your app registration." -ForegroundColor Red
331+
Write-Host " - On Azure portal, create a group named GroupMember and assign some users to it, then configure your ID and Access token to emit GroupID in your app registration." -ForegroundColor Red
316332
Write-Host -ForegroundColor Green "------------------------------------------------------------------------------------------------"
317333
if($isOpenSSL -eq 'Y')
318334
{

5-AccessControl/2-call-api-groups/AppCreationScripts/sample.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858
},
5959
"ManualSteps": [
6060
{
61-
"Comment": "This script has created a group named GroupAdmin for you. On Azure portal, assign some users to it, and configure your ID and Access token to emit GroupID in your app registration."
61+
"Comment": "On Azure portal, create a group named GroupAdmin and assign some users to it, then configure your ID and Access token to emit GroupID in your app registration."
6262
},
6363
{
64-
"Comment": "This script has created a group named GroupMember for you. On Azure portal, assign some users to it, and configure your ID and Access token to emit GroupID in your app registration."
64+
"Comment": "On Azure portal, create a group named GroupMember and assign some users to it, then configure your ID and Access token to emit GroupID in your app registration."
6565
}
6666
]
6767
}

0 commit comments

Comments
 (0)