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:
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?