Azure active directory 如何以编程方式指定replyUrlsWithType

Azure active directory 如何以编程方式指定replyUrlsWithType,azure-active-directory,Azure Active Directory,我想在Azure AD中的应用程序上以编程方式设置replyUrlsWithType。但是,用于更新only的REST API似乎支持设置replyUrls属性,这不允许设置type属性。是否有支持的方法以编程方式设置replyUrlsWithType 我正在与之合作的团队使用Fiddler查看Azure门户如何设置type属性,并通过黑客攻击以下内容使其正常工作,但我们正在寻找一种受支持的方法(如果有的话): $UpdateAppResponse = Invoke-WebRequest -Ur

我想在Azure AD中的应用程序上以编程方式设置
replyUrlsWithType
。但是,用于更新only的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`"}]}"

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

但是,在Azure portal中注册的新应用程序可以同时支持这两种类型。基于fiddler跟踪,Azure广告图似乎已更新以支持这一点

url
https://graph.windows.net/myorganization/applications/$appId?api version=2.0
是AAD图形api的典型url。可能只是文档没有更新


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

您可以使用Microsoft Graph API和

例如,您可以使用以下主体发出
补丁
请求:

{
    "publicClient": {
        "redirectUris": [
            "myapp://auth"
        ]
    },
    "web": {
        "redirectUris": [
            "https://devchat.com/",
            "http://localhost/",
            "https://mytest.com/"
        ],
        "implicitGrantSettings": {
            "enableAccessTokenIssuance": false,
            "enableIdTokenIssuance": false
        }
    }
}
然后将添加所有平台:


对于希望类似配置为SPA的任何人,可以将属性设置为
“SPA”
,而不是
“web”
。这让我很头疼,希望对其他人有所帮助:

而不是:

"web": {
    "redirectUris": [
使用

Azure云Shell(bash)的一行代码:

azrest——方法补丁——uri'https://graph.microsoft.com/v1.0/applications/'--headers'Content Type=application/json'--body'{“spa”:{“redirectUris”:[“https:]}

谢谢贾杰克。这看起来是一个很好的解决方案。嗨,杰克,我正在尝试通过SPA支持以编程方式创建一个应用程序注册。据我所知,这不能使用当前(v1)图形API来完成。我尝试过打电话,但收到了一个错误的请求,请求的版本代码为INVALIDDATACCORT。从Azure门户(编辑清单页面)执行相同的调用时成功。有什么办法让它工作吗?
"spa": {
    "redirectUris": [
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)>"]}}'