Azure / azure-cli

Azure Command-Line Interface
MIT License
3.97k stars 2.95k forks source link

Azure Bot Channel Deployment with Azure CLI - not able to create bot channels Ask Question #5565

Closed krystiangw closed 5 years ago

krystiangw commented 6 years ago

Environment summary

Install Method: brew CLI version: azure-cli (2.0.26) OS version: macOS Shell Type: bash

I'm able to deploy Azure Bot registration channel using Azure CLI template

https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-deploy-cli

But I can't figure out how to set Facebook Channel credentials for new-created channel in the same script. https://docs.microsoft.com/en-us/bot-framework/bot-service-manage-channels

I can't find any informations in the official docs

Here is part of my deployment template:

{
    "resources": [
        {
            "type": "Microsoft.BotService/botServices",
            "sku": {
                "name": "[parameters('sku')]"
            },
            "kind": "[parameters('kind')]",
            "name": "[parameters('botId')]",
            "apiVersion": "2017-12-01",
            "location": "global",
            "properties": {
                "name": "[parameters('botId')]",
                "displayName": "[parameters('botId')]",
                "endpoint": "[variables('botEndpoint')]",
                "msaAppId": "[parameters('appId')]",
                "developerAppInsightsApplicationId": "[variables('insightsName')]",
                "developerAppInsightKey": "[reference(resourceId('microsoft.insights/components/', variables('insightsName')), '2015-05-01').InstrumentationKey]",
                "enabledChannels": [
                    "webchat",
                    "directline",
                    "facebook"
                ],
                "configuredChannels": [
                    "webchat",
                    "facebook"
                ]
            },
            "dependsOn": [
                "[resourceId('microsoft.insights/components/', variables('insightsName'))]"
            ]
        }
    ]
}

Any ideas here?

tjprescott commented 6 years ago

Hi @krystiangw the best resource would be: https://docs.microsoft.com/en-us/bot-framework/rest-api/bot-framework-rest-overview

This service currently doesn't have a Python SDK and thus not directly supported within the CLI. The Rest API might give you the information you seek.

You might also try configuring the Facebook credentials within the Portal and then exporting the template.

komikoni commented 6 years ago

Thank you for a wonderful post.

I was also experimenting with "Automation", but I did not know how to write channel properties. So, I could only create a Bot Service by default. (I knew the property name in "Find - AzureRmResource - ExpandProperties"),

But with your post, I solved a part. I also want to know how to set the channel's credential information.

(For Skyper for bussiness, credentials are unnecessary so it may be used as it is)

For reference, list the ID names of each channel.

Direct Line : "directline" Skype for Business: "skypeforbusiness" Web Chat : "webchat" Cortana : "cortana" MSTeams : "msteams" Skype : "skype" Bing : "bing" Email : "email" GroupMe : "groupme" Slack : "slack" Twilio (SMS) : "sms" Kik : "kik" Facebook Messenger: "facebook" Telegram : "telegram"

carlosscastro commented 6 years ago

@krystiangw Hello!

Were you able to fix this? For Facebook, here is how you get the information you need to pass to create a Facebook channel: https://docs.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-facebook?view=azure-bot-service-3.0.

For all the channels, the fields required are the same fields that you need if you were to enable the channel manually in the Azure Portal.

carlosscastro commented 6 years ago

Note that channels can't be created with ARM templates. In the CLI you should use the bot extension by typing

az extension add -n botservice

and then create the channel through CLI:

az bot facebook create ...

abhinav12 commented 6 years ago

Hi @carlosscastro, I see the last comment by you on this was on May 30. Is configuring channels in ARM template supported now? If not, what would be the best way to automate configuring a direct line channel for the bot? Thanks in advance

swagatmishra2007 commented 6 years ago

channel support in arm templates isnt there yet. you can use az bot directline -h to configure the channel for a bot

TomRyder commented 5 years ago

Any update on this?

yochay commented 5 years ago

@TomRyder you can configure channels via Az bot operations. Here is an example - https://docs.microsoft.com/en-us/cli/azure/bot/facebook?view=azure-cli-latest

sgellock commented 5 years ago

The issues has been resolved