首页 > 解决方案 > 通过 Azure ARM Rest API 创建机器人连接

问题描述

所以,我一直在尝试使用 Azure Rest API 来创建一些资源。更具体地说,我正在尝试使用 Insomnia 创建一个机器人连接。请求和响应是这样的:

失眠截图

我正在使用 PUT 方法(如您所见),URL(敏感数据已编辑)如下:

https://management.azure.com/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.BotService/botServices/bot-poc-myweb/Connections/mywebbot?api-version=2018-07-12

该错误表示未找到连接资源。好吧..这里没有惊喜,因为我有点想创造它。有谁知道可能出了什么问题?

标签: azurerestazure-resource-manager

解决方案


尝试这个:

请求网址:

PUT https://management.azure.com/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.BotService/botServices/<bot_name>/Connections/<conn_name>?api-version=2018-07-12

请求正文:

{
    "location": "global",
    "properties": {
        "scopes": "<scopes>",
        "serviceProviderId": "30dd229c-58e3-4a48-bdfd-91ec48eb906c",
        "clientId": "<client id>",
        "clientSecret": "<secret>",
        "parameters": [
            {
                "key": "clientId",
                "value": "<client id>"
            },
            {
                "key": "clientSecret",
                "value": "<secret>"
            },
            {
                "key": "tokenExchangeUrl",
                "value": "<token exchange URL>"
            },
            {
                "key": "tenantId",
                "value": "<tenant id>"
            }
        ]
    }
}

结果:

在此处输入图像描述

在此处输入图像描述


推荐阅读