简体   繁体   中英

Set Tenant ID on Bot Channels Registration Connection using Arm Template

When using an ARM template to create a new Connection for a bot channels registration I use the following resource as part of Microsoft.BotService/botServices ;

    {
      "type": "Microsoft.BotService/botServices/Connections",
      "apiVersion": "2018-07-12",
      "name": "[concat(parameters('botName'), '/ActiveDirectory')]",
      "dependsOn": [
        "[resourceId('Microsoft.BotService/botServices', parameters('botName'))]"
      ],
      "location": "global",
      "tags": "[parameters('resourceTags')]",
      "properties": {
        "clientId": "[parameters('appId')]",
        "clientSecret": "[parameters('appSecret')]",
        "scopes": "[parameters('scopes')]",
        "serviceProviderId": "30dd229c-58e3-4a48-bdfd-91ec48eb906c",
        "serviceProviderDisplayName": "Azure Active Directory v2",
        "parameters": []
      }
    }

That gets me all the fields except Token Exchange Url & Tenant ID, which I do need to fill in; 在此处输入图片说明

I checked the documentation and could not find anything about this. I tried adding the following parameter to test;

       "parameters": [
          {
            "key": "tenantID",
            "value": "customValue"
          }
        ]

That did not do anything, also just guessing here what the key should be..

How can I set these two fields using an Arm template?

The parameters were the way to go. However when using parameters, the clientID & clientSecret also need to be a parameter, as they are not picked up anymore as properties when a parameter is present. Below the resource Json the way it worked for me;

    {
      "type": "Microsoft.BotService/botServices/Connections",
      "apiVersion": "2018-07-12",
      "name": "[concat(parameters('botName'), '/ActiveDirectory')]",
      "condition": "[equals(parameters('oauthEnabled'), 'True')]",
      "dependsOn": [
        "[resourceId('Microsoft.BotService/botServices', parameters('botName'))]"
      ],
      "location": "global",
      "tags": "[parameters('resourceTags')]",
      "properties": {
        "serviceProviderId": "30dd229c-58e3-4a48-bdfd-91ec48eb906c",
        "serviceProviderDisplayName": "Azure Active Directory v2",
        "parameters": [
          {
            "key": "clientId",
            "value": "[parameters('appId')]"
          },
          {
            "key": "clientSecret",
            "value": "[parameters('appSecret')]"
          },
          {
            "key": "scopes",
            "value": "[parameters('scopes')]"
          },
          {
            "key": "tenantID",
            "value": "common"
          },
          {
            "key": "tokenExchangeUrl",
            "value": "[concat('api://botid-', parameters('appId'))]"
          }
        ]
      }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM