gpt4 book ai didi

Azure - 使用replyUrlsWithType创建应用程序注册

转载 作者:行者123 更新时间:2023-12-02 08:20:47 31 4
gpt4 key购买 nike

我们只是想运行一个命令来在 Azure AD 中创建应用程序注册。这是一个 SPA,显然我们需要设置一个重定向 URL,以便在用户进行身份验证后将其发送回我们的应用程序。

我试过了

az ad app create --display-name appName --reply-urls '[{\"url\":\"http://localhost:3000\",\"type\":\"温泉\"}]',

但是失败了

为资源“Application”的属性“replyUrls”指定的值无效。

看起来这将是一个非常常见的操作,但我找不到实现此目的的文档。 Theseaz ad app create 文档。

最佳答案

对于遇到此问题的其他人,这是我在尝试以多种不同方式完成此任务后提出的解决方案(感谢提及 az rest Gaurav Mantri)。

我创建了以下 bash 脚本

创建应用程序注册.sh

#Create App Registration
response=$(az ad app create --display-name $appName)

#Get the ObjectId of the newly created app registration
objectId=$(echo $response| cut -d'/' -f 3)

# Update app for SPA redirect
az rest --method PATCH --uri 'https://graph.microsoft.com/v1.0/applications/'$objectId \
--headers 'Content-Type=application/json' \
--body '{"spa":{"redirectUris":["'$redirectUri'"]}}'

关于Azure - 使用replyUrlsWithType创建应用程序注册,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68744719/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com