英文:
How can we add OUATH Connection Settings to Bots in the BotFramework?
问题
使用TeamsFX构建Microsoft Teams的机器人时,机器人(在开发过程中)在BotFramework内创建,并可以在此处进行管理:https://dev.botframework.com/bots
这些机器人不与任何我的Azure订阅相关联,似乎存在于我的租户之外,但我可以查看它们。
为了启用BOT SSO,我需要将OAUTH凭据添加到机器人中。
如果机器人在Azure门户(Azure Bot Service)中,可以按照以下方式操作:
然而,该机器人不在Azure门户中,它只存在于这里。
我如何为机器人添加OUATH凭据?
英文:
When using TeamsFX to build bots for Microsoft Teams, bots (during development) are provisioned inside the BotFramework and can be managed here: https://dev.botframework.com/bots
These bots are not tied to any (of my) Azure subscriptions and seem to exist outside my tenant, but they are viewable by me.
In order to enable BOT SSO, I need to add OAUTH credentials to the Bot.
If the bot were in the Azure Portal (Azure Bot Service), it is doable as follows:
However the Bot is not in the Azure Portal - it only exists here.
How can I add OUATH credentials to the bot?
答案1
得分: 1
以下是已翻译的内容:
有2种启用BOT SSO的方法:
-
使用
@microsoft/teamsfx
包中的TeamsBotSsoPrompt
提示。这将配置OAUTH凭据到您的应用程序的应用程序设置,而不是Azure Bot服务,因此您可以在没有Azure订阅的情况下测试您的机器人。您可以参考文档和示例来实施它。 -
按照您所引用的文档来启用BOT SSO。您需要执行以下手动步骤来创建Azure Bot,以便配置您的OAUTH凭据。成功使用新配置本地调试项目后,您应该能够在您的订阅中找到Azure Bot资源。这些步骤假定您使用VS Code Teams Toolkit V5来创建一个新的机器人项目。请根据需要更新路径和参数值。
-
在https://dev.botframework.com/bots上删除您的现有机器人。
-
在
infra/botRegistration/azurebot.parameters.json
中创建一个新文件,内容如下:{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "parameters": { "resourceBaseName": { "value": "bot${{RESOURCE_SUFFIX}}" }, "botAadAppClientId": { "value": "${{BOT_ID}}" }, "botAppDomain": { "value": "${{BOT_DOMAIN}}" }, "botDisplayName": { "value": "bot-sso" } } }
-
用新的内容替换
teamsapp.local.yml
中的原始片段:原始片段:
- uses: botFramework/create with: botId: ${{BOT_ID}} name: sso-bot messagingEndpoint: ${{BOT_ENDPOINT}}/api/messages description: "" channels: - name: msteams
新片段:
- uses: arm/deploy # 并行部署给定的ARM模板。 with: subscriptionId: ${{AZURE_SUBSCRIPTION_ID}} resourceGroupName: ${{AZURE_RESOURCE_GROUP_NAME}} templates: - path: ./infra/botRegistration/azurebot.bicep parameters: ./infra/botRegistration/azurebot.parameters.json deploymentName: Create-resources-for-bot bicepCliVersion: v0.9.1
-
英文:
There're 2 ways to enable BOT SSO:
-
Using the
TeamsBotSsoPrompt
prompt in@microsoft/teamsfx
package. This configures the OAUTH credentials to your app's app settings instead of the Azure Bot service, so you can test your bot without an Azure subscription. You can refer the document and the sample to implement it. -
Follow the document you're referring to enable BOT SSO. You need to take following manual steps to create an Azure Bot so you can configure your OAUTH credentials. After you successfully local debug your project with the new configuration, you should be able to find the Azure Bot resource in your subscription. The steps assume you use VS Code Teams Toolkit V5 to create a new bot project. Please update the paths and parameter values as needed.
-
Delete your existing bot at https://dev.botframework.com/bots
-
Create a new file at
infra/botRegistration/azurebot.parameters.json
with following content:{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", "contentVersion": "1.0.0.0", "parameters": { "resourceBaseName": { "value": "bot${{RESOURCE_SUFFIX}}" }, "botAadAppClientId": { "value": "${{BOT_ID}}" }, "botAppDomain": { "value": "${{BOT_DOMAIN}}" }, "botDisplayName": { "value": "bot-sso" } } }
-
Replace the original snippet in
teamsapp.local.yml
with the new one:Original snippet:
- uses: botFramework/create with: botId: ${{BOT_ID}} name: sso-bot messagingEndpoint: ${{BOT_ENDPOINT}}/api/messages description: "" channels: - name: msteams
New snippet:
- uses: arm/deploy # Deploy given ARM templates parallelly. with: subscriptionId: ${{AZURE_SUBSCRIPTION_ID}} resourceGroupName: ${{AZURE_RESOURCE_GROUP_NAME}} templates: - path: ./infra/botRegistration/azurebot.bicep parameters: ./infra/botRegistration/azurebot.parameters.json deploymentName: Create-resources-for-bot bicepCliVersion: v0.9.1
-
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论