Bot框架中的自动化部署(Bot + LUIS + QnA +表存储) [英] Automating Deployment in Bot Framework (Bot + LUIS+ QnA + Table Storage)

查看:133
本文介绍了Bot框架中的自动化部署(Bot + LUIS + QnA +表存储)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Azure上部署了一个机器人,但我们希望将其提供给客户端,以便他可以使用自己的资源来部署它并运行它.我们需要为他们提供一个Powershell脚本,该脚本神奇地创建和部署了机器人正常工作所需的所有资源.我的机器人架构包括以下部分:

We have a bot deployed on Azure but we want to give it to a client so he can deploy it run it using his own resources. We need to give them a Powershell script that magically create and deploy all the resources needed for the bot to work. My bot architecture consists on the following parts:

  • Bot的逻辑(通过 Azure应用服务部署的ASP.NET Web API项目)
  • LUIS模型(通过认知服务帐户发布)
  • 由QnA Maker完成的QnA服务知识库(直接从QnaMaker门户发布(不知道将其部署在何处)
  • 天蓝色表存储
  • Bot's Logic (ASP.NET Web API Project deployed over an Azure App Service)
  • LUIS Model (published over a Cognitive Services Account)
  • QnA Service Knowledge Base done with QnA Maker (published directly from the QnaMaker Portal (have no idea where it's deployed)
  • Azure Table Storage

我的问题是:

1)如何配置Bots Web API的连接字符串参数? (表存储,luis和qna服务在重新部署时将有所不同)目前,我正在定义conn. web.config上的字符串和api键,但是正如我所说,这必须是动态的.

1) How to configure bots web api to connection strings parameters? (table storage, luis and qna service will be different when they re redeployed) Currently I am defining the conn. strings and api keys on the web.config, but as I said, this needs to be dynamic.

2)如何为LUIS自动化部署? Luis需要具有认知服务帐户"的密钥,该密钥应首先创建.我假设我有导出的模型json文件.我当时在考虑使用LUIS API进行应用程序的导出和发布.够了吗?

2) How to automate deployment for LUIS? Luis needs to have the Key of the Cognitive Services Account that should be created first. And I assume I have the exported model json file. I was thinking of using the LUIS API to do the app export and the publishing part. Would that be enough?

3)如何部署QNA服务?我认为当前部署在神奇的地方,所以也许我不需要做任何事情.

3) How to deploy qna services? I think currently is deployed somewhere magically so maybe I won't need to do anything with it.

谢谢!

推荐答案

也许有点晚了,但是我只需要实现同样的事情,所以这里是您的问题的答案,希望它们对其他人有用. :

Maybe a little bit late, but I just had to implement the very same thing, so here are the answers to your questions in hope they could be useful to others:

1)如上面提到的JoyrexJ9一样,您可以通过设置应用服务的应用程序设置(将覆盖Web.config中的值)来通过ARM模板执行此操作. 此处

1) As JoyrexJ9 mentioned above, you can do this via an ARM template by setting the Application Settings of your App Service which will override the values in your Web.config. More about this here.

  • 您可以像这样在ARM模板中放在一起并设置存储帐户的连接字符串:

{
  "type": "Microsoft.Web/sites",
  "kind": "app",
  "name": "MyWebApp",
  "apiVersion": "2015-08-01",
  "location": "westeurope",
  "properties": {
    "name": "MyWebApp",
    "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'MyAppServicePlanName')]",
    "siteConfig": {
      "appSettings": [{
        "name": "StorageConnectionString",
        "value": "[concat('DefaultEndpointsProtocol=https;AccountName=','MyStorageAccountName',';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', 'MyStorageAccountName'), '2017-10-01').keys[0].value,';EndpointSuffix=core.windows.net')]"
      }],
      "cors": {
        "allowedOrigins": [
          "*"
        ]
      }
    }
  },
  "dependsOn": [
    "[resourceId('Microsoft.Storage/storageAccounts/', 'MyStorageAccountName')]",
    "[resourceId('Microsoft.Web/serverfarms', 'MyAppServicePlanName')]"
  ]
}

  • 对于LUIS和QnA制造商,您需要手动从相应的门户获取值,或者在手动部署ARM之后更新应用程序设置,或者使用传递给它的手动获取值作为参数重新运行ARM部署.后者之所以有效,是因为您第一次可以在ARM模板中将这些值保留为空,而在第二次使用适当的参数值进行部署时,ARM会简单地更新那些应用程序设置"值.有关此主题的更多信息,请此处. (提示:如果通过程序的API-s以编程方式配置QnA Maker和LUIS应用程序,则只需手动获取LUIS的订阅密钥,因为您将从QnA Maker的API获取知识库的凭据.)
  • For LUIS and QnA maker you will need to get the values from the respective portals manually and either update the App Settings after the ARM deployment manually, or re-run the ARM deployment with the manually acquired values passed to it as parameters. The latter works because for the first time you can leave those values empty in your ARM template, and when you deploy it the second time with the parameter values in place, ARM will simply update those App Settings values. More on this topic here. (Hint: if you provision the QnA Maker and LUIS apps programmatically through their API-s, then you'll only need to get the subscription key for LUIS manually, because you'll get the knowledge base's credentials from QnA Maker's API.)

2)不幸的是,您目前无法完全自动完成LUIS应用的配置.您可以通过ARM模板在Azure中创建资源,并且可以通过LUIS API完成其余的大部分工作,但是例如,您不能以编程方式将ARM模板创建的订阅密钥分配给LUIS应用程序,因为该API方法已被弃用.

2) Unfortunately you cannot automate the provisioning of a LUIS app completely at the moment. You can create the resource in Azure via an ARM template and you can do the bulk of the rest of the work through the LUIS API, but for example you cannot assign the subscription key created by the ARM template to a LUIS app programmatically, because that API method is deprecated.

3)自您提交问题以来,QnA Maker服务及其托管模式发生了重大变化.我写了完整的博客文章关于如何做在新系统中进行配置.

3) The QnA Maker service and it's hosting model changed significantly since you've submitted your questions. I wrote a full blog post about how to do the provisioning of it in the new system.

如上所述,JoyrexJ9非常重要,要指出的是,即使使用脚本,您也无法完全自动化机器人注册,因为没有用于在

As JoyrexJ9 mentioned above, it's very important to point out that you won't be able to automate the bot registration fully even with a script, because there's no API for registering an application at https://apps.dev.microsoft.com/. You'll have to do that manually as well. Everything else (besides the things I mentioned above) can be fully automated either via ARM templates or scripts.

这篇关于Bot框架中的自动化部署(Bot + LUIS + QnA +表存储)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆