如何以编程方式指定 replyUrlsWithType

Nic*_*ick 2 azure-active-directory

我想在 Azure AD 中replyUrlsWithType的应用程序清单上以编程方式设置。但是,用于更新清单的 REST API似乎只支持设置 replyUrls 属性,而不能设置 type 属性。是否有支持以replyUrlsWithType编程方式设置的方法?

我正在与之合作的团队使用 Fiddler 来查看 Azure 门户如何设置类型属性,并修改了以下内容以使其工作,但我们正在寻找一种受支持的方法(如果有的话):

$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`"}]}"
Run Code Online (Sandbox Code Playgroud)

Jac*_*Jia 7

过去,Azure 门户中注册的应用程序只能是一种类型。因此,Azure AD Graph API 能够设置replyUrls.

但是,在 Azure 门户中注册的新应用程序可以同时支持这两种类型。根据提琴手的踪迹,Azure AD Graph 似乎已更新以支持这一点。

该 urlhttps://graph.windows.net/myorganization/applications/$appId?api-version=2.0是 AAD Graph API 的典型 url。也许只是文档没有更新。


但是,我们建议您使用Microsoft Graph API。它是管理大量微软云资源的统一中心。

您可以使用 Microsoft Graph API获取应用程序更新应用程序

例如,您可以PATCH使用以下正文发出请求:

{
    "publicClient": {
        "redirectUris": [
            "myapp://auth"
        ]
    },
    "web": {
        "redirectUris": [
            "https://devchat.com/",
            "http://localhost/",
            "https://mytest.com/"
        ],
        "implicitGrantSettings": {
            "enableAccessTokenIssuance": false,
            "enableIdTokenIssuance": false
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

然后将添加所有平台:

在此处输入图片说明