-1

I can use the Azure portal to create a function app and functions, and add bindings for output to a message queue. For example, by using the integrate option under the function I can add a new output, in this case a message queue:

Azure function "Integrate" option

After adding a new message queue, the function.json file is updated with the new binding in the portal.

Before:

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

After:

{
  "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"
    }
  ]
}

Now I can reference the message queue in my Azure function.

Easy to do in the portal. But I would like to create the queue storage (or any other kind) via the build pipeline if it does not already exist. I think this makes the most sense in the release definition, but I am not able to determine how to detect if the account and queue exist already or create them if they do not. I thought I could use Azure Powershell commands via an Azure Powershell Script release definition task with the commands described here:

Perform Azure Queue storage operations with Azure PowerShell

but when I tried to use "Get-AzureStorageAccount" in the Azure Powershell CLI manually to see if the storage account existed, I got an error indicating "Get-AzureStorageAccount" is not a valid commandlet. Is there a way to manage Azure function storage and bindings via the CI/CD pipeline?

John
  • 431
  • 1
  • 5
  • 10
  • Use ARM templates to create and update Azure resources. There's a task to run an ARM template as part of a pipeline. – Daniel Mann Jul 07 '19 at 03:25

1 Answers1

0

It wasn't obvious to me but the function app will create the queue if it doesn't exist, so no need to create one in the pipeline. Finally came across this link that mentions it:

Azure Queue storage bindings for Azure Functions

John
  • 431
  • 1
  • 5
  • 10