0
votes

How can i create a function in Azure using Azure CLI which will have blob storage trigger.

Tried creating function with below command found at below link but it does not have trigger option. https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function-azure-cli

az functionapp create --deployment-source-url https://github.com/Azure-Samples/functions-quickstart  --resource-group myResourceGroup --consumption-plan-location westeurope --name <app_name> --storage-account  <storage_name> 

Thanks in advance

2

2 Answers

0
votes

As far as I know, if you want to create azure function via azure-cli, you could change the deployment resource url after --deployment-source-url. So you are able to create several kinds of triggers, including the blob storage trigger. For example, you could create a C# blob storage trigger with my github repository.

az functionapp create --deployment-source-url https://github.com/Joyw1/Azure-Function-Trigger  --resource-group myResourceGroup --consumption-plan-location westeurope --name <app_name> --storage-account  <storage_name>

Besides, I recommend you to use a Azure Functions Core Tool to code and test the azure functions, also you can use it to publish the function to azure.

0
votes

In order to generate trigger programmatically you have to describe it in function.json file that you provide together with your source code. Azure then will recognise it when both files are deployed as zip or via git and make corresponding changes.