Skip to content

Commit

Permalink
add low risk default
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinTegelaar committed Aug 16, 2023
1 parent d65a982 commit 86210c6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Standards_OauthConsentLowSec/function.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"bindings": [
{
"name": "tenant",
"type": "activityTrigger",
"direction": "in"
}
]
}
13 changes: 13 additions & 0 deletions Standards_OauthConsentLowSec/run.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
param($tenant)

try {
$State = (New-GraphGetRequest -Uri "https://graph.microsoft.com/beta/policies/authorizationPolicy/authorizationPolicy" -tenantid $tenant)
if ($State.permissionGrantPolicyIdsAssignedToDefaultUserRole -notin @("managePermissionGrantsForSelf.microsoft-user-default-low")) {
Write-Host "Going to set"
New-GraphPostRequest -tenantid $tenant -Uri "https://graph.microsoft.com/beta/policies/authorizationPolicy/authorizationPolicy" -Type PATCH -Body '{"permissionGrantPolicyIdsAssignedToDefaultUserRole":["managePermissionGrantsForSelf.microsoft-user-default-low"]}' -ContentType "application/json"
}
Write-LogMessage -API "Standards" -tenant $tenant -message "Application Consent Mode(microsoft-user-default-low) has been enabled." -sev Info
}
catch {
Write-LogMessage -API "Standards" -tenant $tenant -message "Failed to apply Application Consent Mode (microsoft-user-default-low) Error: $($_.exception.message)" -sev Error
}

0 comments on commit 86210c6

Please sign in to comment.