简体   繁体   English

使用Azure CLI使用Blob存储触发器创建Azure函数

[英]Create azure function with blob storage trigger using Azure CLI

How can i create a function in Azure using Azure CLI which will have blob storage trigger. 如何使用Azure CLI在Azure中创建具有Blob存储触发器的功能。

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 https://docs.microsoft.com/zh-cn/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 提前致谢

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 . 据我所知,如果要通过azure-cli创建azure函数,则可以在--deployment-source-url之后更改部署资源--deployment-source-url So you are able to create several kinds of triggers, including the blob storage trigger. 因此,您可以创建多种触发器,包括Blob存储触发器。 For example, you could create a C# blob storage trigger with my github repository . 例如,您可以使用github存储库创建一个C# blob storage trigger

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. 此外,我建议您使用Azure Functions核心工具来编写代码和测试Azure函数,也可以使用它来发布Azure函数。

In order to generate trigger programmatically you have to describe it in function.json file that you provide together with your source code. 为了以编程方式生成触发器,您必须在与源代码一起提供的function.json文件中对其进行描述。 Azure then will recognise it when both files are deployed as zip or via git and make corresponding changes. 然后,当两个文件都以zip或通过git部署并进行相应更改时,Azure就会识别出它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM