Azure devops 如何通过CI/CD管道创建Azure function应用程序消息队列?

Azure devops 如何通过CI/CD管道创建Azure function应用程序消息队列?,azure-devops,continuous-integration,azure-storage-queues,azure-function-app,Azure Devops,Continuous Integration,Azure Storage Queues,Azure Function App,我可以使用Azure门户创建函数应用程序和函数,并将输出绑定添加到消息队列。例如,通过在函数下使用integrate选项,我可以添加一个新的输出,在本例中为消息队列: 添加新消息队列后,function.json文件将使用门户中的新绑定进行更新 之前: { "bindings": [ { "authLevel": "function", "type": "httpTrigger", "direction": "in", "name":

我可以使用Azure门户创建函数应用程序和函数,并将输出绑定添加到消息队列。例如,通过在函数下使用integrate选项,我可以添加一个新的输出,在本例中为消息队列:

添加新消息队列后,function.json文件将使用门户中的新绑定进行更新

之前:

{
  "bindings": [
    {
      "authLevel": "function",
      "type": "httpTrigger",
      "direction": "in",
      "name": "Request",
      "methods": [
        "post"
      ]
    },
    {
      "type": "http",
      "direction": "out",
      "name": "Response"
    }
  ]
}
之后:

{
  "bindings": [
    {
      "authLevel": "function",
      "type": "httpTrigger",
      "direction": "in",
      "name": "Request",
      "methods": [
        "get",
        "post"
      ]
    },
    {
      "type": "http",
      "direction": "out",
      "name": "Response"
    },
    {
      "type": "queue",
      "name": "myQueueItem",
      "queueName": "myoutputqueue",
      "connection": "AzureWebJobsStorage",
      "direction": "out"
    }
  ]
}
现在我可以在Azure函数中引用消息队列

在门户中易于操作。但是,如果队列存储(或任何其他类型)还不存在,我希望通过构建管道来创建它。我认为这在发布定义中最有意义,但我无法确定如何检测帐户和队列是否已经存在,或者如果不存在,如何创建它们。我认为我可以通过Azure Powershell脚本发布定义任务使用Azure Powershell命令,并使用以下命令:


但是,当我尝试在Azure Powershell CLI中手动使用“Get-AzureStorageAccount”查看存储帐户是否存在时,我收到一个错误,指示“Get-AzureStorageAccount”不是有效的commandlet。有没有办法通过CI/CD管道管理Azure函数存储和绑定?

这对我来说并不明显,但函数应用程序将在队列不存在时创建队列,因此无需在管道中创建队列。最后,我看到了这个链接,其中提到:


使用ARM模板创建和更新Azure资源。有一项任务是将ARM模板作为管道的一部分运行。