神刀安全网

Azure Functions (Microsoft's Version of AWS Lambda)

Overview

Azure Functions is an event-driven, compute-on-demand experience that extends the existing Azure application platform with capabilities to implement code triggered by events occurring in other Azure services, SaaS products, and on-premises systems. With Azure Functions, your applications scale based on demand and you pay only for the resources you consume. Azure Functions enables you to create scheduled or triggered units of code implemented in a variety of programming languages. To learn more about Azure Functions, see the Azure Functions Overview .

This topic shows you how to use the Azure Functions quickstart in the Azure Functions portal to create a simple "hello world" Node.js function that is invoked by an HTTP-trigger. You can also watch a short video to see how these steps are performed in the portal.

Watch the video

The following video show how to perform the basic steps in this tutorial.

Create a function from the quickstart

A function app hosts the execution of your functions in Azure. Follow these steps to create a new function app as well as the new function. Before you can create your first function, you need to have an active Azure account. If you don’t already have an Azure account, free accounts are available .

  1. Go to the Azure Functions portal and sign-in with your Azure account.

  2. Type a unique Name for your new function app or accept the generated one, select your preferred Region , then click Create + get started .

  3. In the Quickstart tab, click WebHook + API > Create a function . A new predefined Node.js function is created.

  4. (Optional) At this point in the quickstart, you can choose to take a quick tour of Azure Functions features in the portal. Once you have completed or skipped the tour, you can test your new function by using the HTTP trigger.

Test the function

Since the Azure Functions quickstarts contain functional code, you can immediately test your new function.

  1. In the Develop tab, review the Code window and notice that this Node.js code expects an HTTP request with a name value passed either in the message body or in a query string. When the function runs, this value is returned in the response message.

  2. Scroll down to the Request body text box, change the value of the name property to your name, and click Run . You will see that execution is triggered by a test HTTP request, information is written to the streaming logs, and the "hello" response is displayed in the Output .

  3. To trigger execution of the same function from another browser window or tab, copy the Function URL value from the Develop tab and paste it in a browser address bar, then append the query string value &name=yourname and press enter. The same information is written to the logs and the browser displays the "hello" response as before.

Next steps

This quickstart demonstrates a very simple execution of a basic HTTP-triggered function. See these topics for more information about leveraging the power of Azure Functions in your apps.

Need some help?

Post questions in the Azure forums. -Visit MSDN

Tag questions with the keyword azure-functions . – Visit Stack Overflow

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Azure Functions (Microsoft's Version of AWS Lambda)

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址