我想以编程方式在Azure AD中的应用manifest上设置replyUrlsWithType
。但是,用于更新manifest的REST API似乎仅支持设置replyUrls属性,该属性不能设置type属性。是否可以通过编程方式设置replyUrlsWithType
?
我正在与之合作的团队使用Fiddler来研究Azure门户如何设置type属性,并破解了以下内容以使其起作用,但如果有一种方法,我们正在寻找一种受支持的方法:
$UpdateAppResponse = Invoke-WebRequest -Uri "https://graph.windows.net/myorganization/applications/$appId?api-version=2.0" `
-Method "PATCH" `
-Headers @{"Authorization"="$($Response.token_type) $($Response.access_token)"; "Accept"="*/*"; } `
-ContentType "application/json" `
-Body "{`"id`":`"$appId`",`"replyUrlsWithType`":[{`"url`":`"https://$HostName`",`"type`":`"Web`"},{`"url`":`"msauth://$ReversedHostName`",`"type`":`"InstalledClient`"}, {`"url`":`"msauth.$ReversedHostName://auth`",`"type`":`"InstalledClient`"}]}"
答案 0 :(得分:1)
过去,在Azure门户中注册的应用程序只能是一种类型。因此,Azure AD Graph API能够设置replyUrls
。
但是,在Azure门户中注册的新应用程序可以同时支持两种类型。根据提琴手的踪迹,Azure AD Graph似乎已更新以支持该功能。
URL https://graph.windows.net/myorganization/applications/$appId?api-version=2.0
是AAD Graph API的典型URL。也许只是文档尚未更新。
但是,我们建议您使用Microsoft Graph API。它是用于管理大量Microsoft Cloud资源的统一中心。
您可以使用Microsoft Graph API Get application和Update application。
例如,您可以使用以下正文发出PATCH
请求:
{
"publicClient": {
"redirectUris": [
"myapp://auth"
]
},
"web": {
"redirectUris": [
"https://devchat.com/",
"http://localhost/",
"https://mytest.com/"
],
"implicitGrantSettings": {
"enableAccessTokenIssuance": false,
"enableIdTokenIssuance": false
}
}
}
然后将添加所有平台:
答案 1 :(得分:0)
对于希望像 SPA 一样进行类似配置的任何人,您可以将该属性设置为 "spa"
而不是 "web"
。这让我很头疼,所以希望对其他人有帮助:
代替:
"web": {
"redirectUris": [
使用
"spa": {
"redirectUris": [
Azure Cloud Shell (bash) 的单层:
az rest --method PATCH --uri 'https://graph.microsoft.com/v1.0/applications/<APP REG OBJECT GUID (object ID not the App ID)>' --headers 'Content-Type=application/json' --body '{"spa":{"redirectUris":["https:<APP DOMAIN (and port if needed)>"]}}'