Created
August 10, 2020 15:42
-
-
Save SvenHamers/880c9a8e5a588ccfcbc69652bfb31cef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$urls = @("https://test123.com/callback","https://test123.com/silent") | |
$appObjId = "f" | |
$app = az rest --method get --headers "Content-Type=application/json" --uri "https://graph.microsoft.com/beta/applications/$appObjId" | |
$app = $app | ConvertFrom-Json | |
if(!$app.spa){ | |
Write-Host "api respone does not contain spa" | |
exit 1 | |
} | |
foreach ($url in $urls) { | |
if($app.spa.redirectUris -notcontains $url) | |
{ | |
Write-Host -ForegroundColor Green "adding $url" | |
$app.spa.redirectUris += $url | |
} | |
} | |
$redirectUris = $app.spa.redirectUris | ConvertTo-Json | |
$json = @" | |
{ | |
"spa":{"redirectUris":$redirectUris} | |
} | |
"@ | |
$escapedBody = $json | ConvertFrom-Json | ConvertTo-Json -Compress | ConvertTo-Json | |
az rest --method patch --headers "Content-Type=application/json" --uri "https://graph.microsoft.com/beta/applications/$appObjId" --body $escapedBody |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$urls = @("https://test123.com/callback","https://test123.com/silent") | |
$appObjId = "f" | |
$app = az rest --method get --headers "Content-Type=application/json" --uri "https://graph.microsoft.com/beta/applications/$appObjId" | |
$app = $app | ConvertFrom-Json | |
if(!$app.spa){ | |
Write-Host "api respone does not contain spa" | |
exit 1 | |
} | |
foreach ($url in $urls) { | |
if($app.spa.redirectUris -notcontains $url) | |
{ | |
Write-Host -ForegroundColor Green "adding $url" | |
$app.spa.redirectUris += $url | |
} | |
} | |
$redirectUris = $app.spa.redirectUris | ConvertTo-Json | |
$json = @" | |
{ | |
"spa":{"redirectUris":$redirectUris} | |
} | |
"@ | |
$escapedBody = $json | ConvertFrom-Json | ConvertTo-Json -Compress | ConvertTo-Json | |
az rest --method patch --headers "Content-Type=application/json" --uri "https://graph.microsoft.com/beta/applications/$appObjId" --body $escapedBody |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment