如何在 Azure DevOps 中为 QnAMaker ChatBot 虚拟助手模板创建 CI/CD 管道

时间:2021-03-25 10:52:46

标签: powershell azure-devops botframework

我正在使用 Bot Framework Virtual Assistant 模板在 Azure 中创建和配置 Bot, 对于这个过程,我有 ARM 模板来创建资源, Deploy PS 脚本用于创建知识库和 (Deploy.ps1) 一旦创建了 qnamaker 资源。

在当前实现中,如果我从本地 Powershell 工具执行脚本,一切正常:

  1. 创建资源
  2. 创建知识库
  3. 知识库配置

我一直坚持在 Azure DevOps 中配置此设置,如何在 CI/CD 管道中配置 ARM 部署和 PowerShell 脚本执行。 这样一旦通过 ARM 部署创建资源,知识库创建应该自动触发?

感谢任何帮助

1 个答案:

答案 0 :(得分:1)

首先您需要将 ARM 模板放在源存储库(Github 或 Azure Repos)中。请参阅文档 Create a new Git repo in your project

然后创建管道(Yaml 或 Classic)。请参阅 YAML 示例 here。对于经典 UI 管道,请查看 this example

在部署到 Azure 订阅之前。您需要创建一个 azure Resource Manager service connection 以将您的 Azure 订阅连接到 Azure DevOps。请参阅this thread 以获取示例

在您的管道中使用 ARM template deployment task 部署 ARM 模板。并使用 Azure powershell task 执行 Deploy PS 脚本。看下面的例子

trigger:
- master

pool:
  vmImage: windows-latest

steps:
- task: AzureResourceManagerTemplateDeployment@3
  displayName: 'ARM Template deployment: Subscription scope'
  inputs:
    azureResourceManagerConnection: 'my-azure-sub'
    resourceGroupName: 'azrue resource group'
    location: 'West Europe'
    csmFile: **/template.json
    csmParametersFile: **/parameter.json
    deploymentMode: Incremental

- task: AzurePowerShell@5
  displayName: 'Azure PowerShell script: FilePath'
  inputs:
    azureSubscription: 'my-azure-sub'
    ScriptPath: **/Deploy.ps1
    azurePowerShellVersion: LatestVersion

有关详细信息,请参阅 this tutorial

相关问题