Skip to content

Commit

Permalink
#75 Add redirect URIs to existing CM app registration
Browse files Browse the repository at this point in the history
  • Loading branch information
bb-froggy committed Apr 9, 2024
1 parent b410d4b commit b2767d2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions SCEPman/Private/appregistrations.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,25 @@ function RegisterAzureADApp($name, $appRoleAssignments, $replyUrls = $null, $hom
# Reload app registration with new roles
$azureAdAppReg = Convert-LinesToObject -lines $(az ad app show --id $azureAdAppReg.id)
}

if ($null -ne $replyUrls) {
$existingReplyUrls = $azureAdAppReg.web.redirectUris
$newReplyUrls = $replyUrls -split " "
$replyUrlsToAdd = $newReplyUrls | Where-Object { $existingReplyUrls -notcontains $_ }
if ($replyUrlsToAdd.Count -gt 0) {
Write-Information "Adding reply URLs to app registration $name"
$azCommandToAddReplyUrls = @("ad", "app", "update", "--id", $azureAdAppReg.appId)
if (AzUsesAADGraph) {
$azCommandToAddReplyUrls += "--reply-urls"
} else {
$azCommandToAddReplyUrls += "--web-redirect-uris"
# ExecuteAzCommandRobustly -callAzNatively -azCommand @("ad", "app", "update", "--id", $azureAdAppReg.appId, "--web-home-page-url", $homepage, "--web-redirect-uris", $allReplyUrls)
}
$azCommandToAddReplyUrls += $existingReplyUrls + $replyUrlsToAdd
ExecuteAzCommandRobustly -callAzNatively -azCommand $azCommandToAddReplyUrls
}
}
$azureAdAppReg.web.redirectUris
}

return $azureAdAppReg
Expand Down

0 comments on commit b2767d2

Please sign in to comment.