You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Create your first serverless function from the Azure portal
2
+
title: Create your first function in the Azure portal
3
3
description: Learn how to create your first Azure Function for serverless execution using the Azure portal.
4
4
ms.assetid: 96cf87b9-8db6-41a8-863a-abb828e3d06d
5
5
ms.topic: quickstart
6
-
ms.date: 03/28/2018
6
+
ms.date: 03/06/2020
7
7
ms.custom: mvc, devcenter, cc996988-fb4f-47
8
8
---
9
9
10
10
# Create your first function in the Azure portal
11
11
12
-
Azure Functions lets you execute your code in a [serverless](https://azure.microsoft.com/solutions/serverless/) environment without having to first create a VM or publish a web application. In this article, learn how to use Functions to create a "hello world" function in the Azure portal.
13
-
14
-

12
+
Azure Functions lets you run your code in a serverless environment without having to first create a virtual machine (VM) or publish a web application. In this article, you learn how to use Azure Functions to create a "hello world" HTTP triggered function in the Azure portal.
> C# developers should consider [creating your first function in Visual Studio 2019](functions-create-your-first-function-visual-studio.md) instead of in the portal.
16
+
If you're a C# developer, consider [creating your first function in Visual Studio 2019](functions-create-your-first-function-visual-studio.md) instead of in the portal.
20
17
21
-
## Log in to Azure
18
+
## Sign in to Azure
22
19
23
-
Sign in to the Azure portal at <https://portal.azure.com> with your Azure account.
20
+
Sign in to the [Azure portal](https://portal.azure.com) with your Azure account.
24
21
25
22
## Create a function app
26
23
27
24
You must have a function app to host the execution of your functions. A function app lets you group functions as a logical unit for easier management, deployment, scaling, and sharing of resources.
28
25
29
26
[!INCLUDE [Create function app Azure portal](../../includes/functions-create-function-app-portal.md)]
30
27
31
-
Next, you create a function in the new function app.
28
+
Next, create a function in the new function app.
32
29
33
30
## <aname="create-function"></a>Create an HTTP triggered function
34
31
35
-
1. Expand your new function app, then select the **+** button next to **Functions**, choose **In-portal**, and select **Continue**.
32
+
1. Expand your new function app, select the **+** button next to **Functions**, choose **In-portal**, and then select **Continue**.
36
33
37
34

38
35
39
-
1. Choose **WebHook + API** and then select **Create**.
36
+
1. Choose **WebHook + API**, and then select **Create**.
40
37
41
38

42
39
43
-
A function is created using a language-specific template for an HTTP triggered function.
40
+
A function is created using a language-specific template for an HTTP triggered function.
44
41
45
42
Now, you can run the new function by sending an HTTP request.
46
43
47
44
## Test the function
48
45
49
-
1. In your new function, click **</> Get function URL** at the top right, select **default (Function key)**, and then click **Copy**.
46
+
1. In your new function, select **</> Get function URL** at the top right.
47
+
48
+
1. In the **Get function URL** dialog box, select **default (Function key)** from the drop-down list, and then select **Copy**.
50
49
51
50

52
51
53
-
2. Paste the function URL into your browser's address bar. Add the query string value `&name=<yourname>` to the end of this URL and press the `Enter` key on your keyboard to execute the request. You should see the response returned by the function displayed in the browser.
52
+
1. Paste the function URL into your browser's address bar. Add the query string value `&name=<your_name>` to the end of this URL and press Enterto run the request.
54
53
55
54
The following example shows the response in the browser:
56
55
57
56

58
57
59
58
The request URL includes a key that is required, by default, to access your function over HTTP.
60
59
61
-
3. When your function runs, trace information is written to the logs. To see the trace output from the previous execution, return to your function in the portal and click the arrow at the bottom of the screen to expand the **Logs**.
60
+
1. When your function runs, trace information is written to the logs. To see the trace output from the previous execution, return to your function in the portal and select the arrow at the bottom of the screen to expand the **Logs**.
62
61
63
62

64
63
@@ -68,8 +67,5 @@ Now, you can run the new function by sending an HTTP request.
68
67
69
68
## Next steps
70
69
71
-
You've created a function app with a simple HTTP triggered function.
# Quickstart: Create your first function in Azure using Visual Studio
10
10
11
-
Azure Functions lets you execute your code in a [serverless](https://azure.microsoft.com/solutions/serverless/) environment without having to first create a VM or publish a web application.
11
+
Azure Functions lets you run your code in a serverless environment without having to first create a VM or publish a web application.
12
12
13
-
In this article, you learn how to use Visual Studio 2019 to locally create and test a "hello world" function and then publish it to Azure. This quickstart is designed for Visual Studio 2019. When creating a Functions project using Visual Studio 2017, you must first install the [latest Azure Functions tools](functions-develop-vs.md#check-your-tools-version).
13
+
In this quickstart, you learn how to use Visual Studio 2019 to locally create and test a "hello world" HTTP-triggered C# function app, which you then publish to Azure.
14
14
15
15

16
16
17
+
This quickstart is designed for Visual Studio 2019.
18
+
17
19
## Prerequisites
18
20
19
-
To complete this tutorial, you must first install [Visual Studio 2019](https://azure.microsoft.com/downloads/). Make sure that the **Azure development** workload is also installed.
21
+
To complete this tutorial, first install [Visual Studio 2019](https://azure.microsoft.com/downloads/). Ensure you select the **Azure development** workload during installation. If you want to create an Azure Functions project by using Visual Studio 2017 instead, you must first install the [latest Azure Functions tools](functions-develop-vs.md#check-your-tools-version).
20
22
21
23

22
24
@@ -26,41 +28,47 @@ To complete this tutorial, you must first install [Visual Studio 2019](https://a
26
28
27
29
[!INCLUDE [Create a project using the Azure Functions template](../../includes/functions-vstools-create.md)]
28
30
29
-
Visual Studio creates a project and class that contains boilerplate code for the HTTP trigger function type. The `FunctionName`attribute on the method sets the name of the function, which by default is `Function1`. The `HttpTrigger` attribute specifies that the function is triggered by an HTTP request. The boilerplate code sends an HTTP response that includes a value from the request body or query string.
31
+
Visual Studio creates a project and class that contains boilerplate code for the HTTP trigger function type. The `FunctionName` method attribute sets the name of the function, which by default is `Function1`. The `HttpTrigger` attribute specifies that the function is triggered by an HTTP request. The boilerplate code sends an HTTP response that includes a value from the request body or query string.
30
32
31
-
You can expand the capabilities of your function using input and output bindings by applying the appropriate attributes to the method. For more information, see the [Triggers and bindings](functions-dotnet-class-library.md#triggers-and-bindings) section of the [Azure Functions C# developer reference](functions-dotnet-class-library.md).
33
+
Expand the capabilities of your function with input and output bindings by applying the appropriate attributes to the method. For more information, see the [Triggers and bindings](functions-dotnet-class-library.md#triggers-and-bindings) section of the [Azure Functions C# developer reference](functions-dotnet-class-library.md).
32
34
33
35
Now that you've created your function project and an HTTP-triggered function, you can test it on your local computer.
34
36
35
37
## Run the function locally
36
38
37
-
Visual Studio integrates with Azure Functions Core Tools so that you can test your functions locally using the full Functions runtime.
39
+
Visual Studio integrates with Azure Functions Core Tools so that you can test your functions locally using the full Azure Functions runtime.
After you have verified that the function runs correctly on your local computer, it's time to publish the project to Azure.
43
+
After you've verified that the function runs correctly on your local computer, it's time to publish the project to Azure.
42
44
43
45
## Publish the project to Azure
44
46
45
-
You must have a function app in your Azure subscription before you can publish your project. Visual Studio publishing creates a function app for you the first time you publish your project.
47
+
Before you can publish your project, you must have a function app in your Azure subscription. Visual Studio publishing creates a function app for you the first time you publish your project.
46
48
47
49
[!INCLUDE [Publish the project to Azure](../../includes/functions-vstools-publish.md)]
48
50
49
51
## Test your function in Azure
50
52
51
-
1. Copy the base URL of the function app from the Publish profile page. Replace the `localhost:port` portion of the URL you used when testing the function locally with the new base URL. As before, make sure to append the query string `?name=<YOUR_NAME>` to this URL and execute the request.
53
+
1. Copy the base URL of the function app from the **Publish** profile page. Replace the `localhost:port` portion of the URL you used to test the function locally with the new base URL. Append the query string `?name=<YOUR_NAME>` to this URL and run the request.
52
54
53
-
The URL that calls your HTTP triggered function should be in the following format:
55
+
The URL that calls your HTTP triggered function is in the following format:
2. Paste this new URL for the HTTP request into your browser's address bar. The following shows the response in the browser to the remote GET request returned by the function:
59
+
2. Paste this new URL for the HTTP request into your browser's address bar. The following image shows the response in the browser to the remote GET request returned by the function:
58
60
59
61

You have used Visual Studio to create and publish a C# function app in Azure with a simple HTTP triggered function. To learn more about developing functions as .NET class libraries, see [Azure Functions C# developer reference](functions-dotnet-class-library.md).
69
+
In this quickstart, you used Visual Studio to create and publish a C# function app in Azure with a simple HTTP triggered function.
64
70
71
+
Advance to the next article to learn how to add an Azure Storage queue binding to your function:
65
72
> [!div class="nextstepaction"]
66
73
> [Add an Azure Storage queue binding to your function](functions-add-output-binding-storage-queue-vs.md)
1. On the **Basics** page, use the function app settings as specified in the following table.
22
18
23
19
| Setting | Suggested value | Description |
24
20
| ------------ | ---------------- | ----------- |
25
21
|**Subscription**| Your subscription | The subscription under which this new function app is created. |
26
22
|**[Resource Group](../articles/azure-resource-manager/management/overview.md)**|*myResourceGroup*| Name for the new resource group in which to create your function app. |
27
23
|**Function App name**| Globally unique name | Name that identifies your new function app. Valid characters are `a-z` (case insensitive), `0-9`, and `-`. |
28
24
|**Publish**| Code | Option to publish code files or a Docker container. |
29
-
|**Runtime stack**| Preferred language | Choose a runtime that supports your favorite function programming language. Choose **.NET** for C# and F# functions. |
25
+
|**Runtime stack**| Preferred language | Choose a runtime that supports your favorite function programming language. Choose **.NET Core** for C# and F# functions. |
26
+
|**Version**| Version number | Choose the version of your installed runtime. |
30
27
|**Region**| Preferred region | Choose a [region](https://azure.microsoft.com/regions/) near you or near other services your functions access. |
1. Select **Next : Hosting**. On the **Hosting** page, enter the following settings.
37
32
38
33
| Setting | Suggested value | Description |
39
34
| ------------ | ---------------- | ----------- |
40
-
|**[Storage account](../articles/storage/common/storage-account-create.md)**| Globally unique name | Create a storage account used by your function app. Storage account names must be between 3 and 24 characters in length and may contain numbers and lowercase letters only. You can also use an existing account, which must meet the [storage account requirements](../articles/azure-functions/functions-scale.md#storage-account-requirements). |
35
+
|**[Storage account](../articles/storage/common/storage-account-create.md)**| Globally unique name | Create a storage account used by your function app. Storage account names must be between 3 and 24 characters in length and can contain numbers and lowercase letters only. You can also use an existing account, which must meet the [storage account requirements](../articles/azure-functions/functions-scale.md#storage-account-requirements). |
41
36
|**Operating system**| Preferred operating system | An operating system is pre-selected for you based on your runtime stack selection, but you can change the setting if necessary. |
42
-
|**[Plan](../articles/azure-functions/functions-scale.md)**| Consumption plan | Hosting plan that defines how resources are allocated to your function app. In the default **Consumption Plan**, resources are added dynamically as required by your functions. In this [serverless](https://azure.microsoft.com/overview/serverless-computing/) hosting, you only pay for the time your functions run. When you run in an App Service plan, you must manage the [scaling of your function app](../articles/azure-functions/functions-scale.md). |
43
-
44
-
Select the **Next : Monitoring >** button.
37
+
|**[Plan](../articles/azure-functions/functions-scale.md)**|**Consumption (Serverless)**| Hosting plan that defines how resources are allocated to your function app. In the default **Consumption** plan, resources are added dynamically as required by your functions. In this [serverless](https://azure.microsoft.com/overview/serverless-computing/) hosting, you pay only for the time your functions run. When you run in an App Service plan, you must manage the [scaling of your function app](../articles/azure-functions/functions-scale.md). |
1. Select **Next : Monitoring**. On the **Monitoring** page, enter the following settings.
49
42
50
43
| Setting | Suggested value | Description |
51
44
| ------------ | ---------------- | ----------- |
52
45
|**[Application Insights](../articles/azure-functions/functions-monitoring.md)**| Default | Creates an Application Insights resource of the same *App name* in the nearest supported region. By expanding this setting, you can change the **New resource name** or choose a different **Location** in an [Azure geography](https://azure.microsoft.com/global-infrastructure/geographies/) where you want to store your data. |
53
46
54
-
Select **Review + Create** to review the app configuration selections.
1. Select **Go to resource** to view your new function app. You can also select **Pin to dashboard**. Pinning makes it easier to return to this function app resource from your dashboard.
0 commit comments