Skip to content

Commit e9a3a6f

Browse files
committed
Update app reg scripts
- Removed superfluous output. - Added new required permission to assign app roles in app-only script
1 parent ca4d0bb commit e9a3a6f

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

app-auth/RegisterAppForAppOnlyAuth.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ param(
2121
$graphAppId = "00000003-0000-0000-c000-000000000000"
2222

2323
# Requires an admin
24-
Connect-MgGraph -Scopes "Application.ReadWrite.All User.Read" -UseDeviceAuthentication -ErrorAction Stop
24+
Connect-MgGraph -Scopes "Application.ReadWrite.All AppRoleAssignment.ReadWrite.All User.Read" -UseDeviceAuthentication -ErrorAction Stop
2525

2626
# Get context for access to tenant ID
2727
$context = Get-MgContext -ErrorAction Stop
@@ -71,7 +71,6 @@ Write-Host -ForegroundColor Cyan "Added application permissions to app registrat
7171
# Add admin consent
7272
foreach ($appRole in $resourceAccess)
7373
{
74-
$appServicePrincipal
7574
New-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $appServicePrincipal.Id `
7675
-PrincipalId $appServicePrincipal.Id -ResourceId $graphServicePrincipal.Id `
7776
-AppRoleId $appRole.Id -ErrorAction SilentlyContinue -ErrorVariable SPError | Out-Null
@@ -101,7 +100,7 @@ Write-Host -ForegroundColor Yellow $clientSecret.EndDateTime
101100

102101
if ($StayConnected -eq $false)
103102
{
104-
Disconnect-MgGraph
103+
Disconnect-MgGraph | Out-Null
105104
Write-Host "Disconnected from Microsoft Graph"
106105
}
107106
else

user-auth/RegisterAppForUserAuth.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Write-Host -ForegroundColor Yellow $authTenant
7777

7878
if ($StayConnected -eq $false)
7979
{
80-
Disconnect-MgGraph
80+
Disconnect-MgGraph | Out-Null
8181
Write-Host "Disconnected from Microsoft Graph"
8282
}
8383
else

0 commit comments

Comments
 (0)