Skip to content

Commit a7d8075

Browse files
authored
Merge pull request #104273 from craigshoemaker/crs-functions-http-restructure
Restructure HTTP binding ref
2 parents 8dcc9e0 + 957fe43 commit a7d8075

22 files changed

+962
-907
lines changed

articles/api-management/import-function-app-as-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Import of an Azure Function App automatically generates:
115115
* Host key inside the Function App with the name apim-{*your Azure API Management service instance name*},
116116
* Named value inside the Azure API Management instance with the name {*your Azure Function App instance name*}-key, which contains the created host key.
117117

118-
For APIs created after April 4th 2019, the host key is passed in HTTP requests from API Management to the Function App in a header. Older APIs pass the host key as [a query parameter](../azure-functions/functions-bindings-http-webhook.md#api-key-authorization). This behavior may be changed through the `PATCH Backend` [REST API call](https://docs.microsoft.com/rest/api/apimanagement/2019-01-01/backend/update#backendcredentialscontract) on the *Backend* entity associated with the Function App.
118+
For APIs created after April 4th 2019, the host key is passed in HTTP requests from API Management to the Function App in a header. Older APIs pass the host key as [a query parameter](../azure-functions/functions-bindings-http-webhook-trigger.md#api-key-authorization). This behavior may be changed through the `PATCH Backend` [REST API call](https://docs.microsoft.com/rest/api/apimanagement/2019-01-01/backend/update#backendcredentialscontract) on the *Backend* entity associated with the Function App.
119119

120120
> [!WARNING]
121121
> Removing or changing value of either the Azure Function App host key or Azure API Management named value will break the communication between the services. The values do not sync automatically.

articles/azure-functions/TOC.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,13 @@
351351
- name: IoT Hub
352352
href: functions-bindings-event-iot.md
353353
- name: HTTP and webhooks
354-
href: functions-bindings-http-webhook.md
354+
items:
355+
- name: Overview
356+
href: functions-bindings-http-webhook.md
357+
- name: Trigger
358+
href: functions-bindings-http-webhook-trigger.md
359+
- name: Output
360+
href: functions-bindings-http-webhook-output.md
355361
- name: Microsoft Graph
356362
href: functions-bindings-microsoft-graph.md
357363
- name: Mobile Apps

articles/azure-functions/durable/quickstart-js-vscode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
5353
| Select a version | Azure Functions v2 | You only see this option when the Core Tools aren't already installed. In this case, Core Tools are installed the first time you run the app. |
5454
| Select a template for your project's first function | HTTP trigger | Create an HTTP triggered function in the new function app. |
5555
| Provide a function name | HttpTrigger | Press Enter to use the default name. |
56-
| Authorization level | Function | The `function` authorization level requires you to supply an access key when calling your function's HTTP endpoint. This makes it more difficult to access an unsecured endpoint. To learn more, see [Authorization keys](../functions-bindings-http-webhook.md#authorization-keys). |
56+
| Authorization level | Function | The `function` authorization level requires you to supply an access key when calling your function's HTTP endpoint. This makes it more difficult to access an unsecured endpoint. To learn more, see [Authorization keys](../functions-bindings-http-webhook-trigger.md#authorization-keys). |
5757
| Select how you would like to open your project | Add to workspace | Creates the function app in the current workspace. |
5858

5959
Visual Studio Code installs the Azure Functions Core Tools, if needed. It also creates a function app project in a new workspace. This project contains the [host.json](../functions-host-json.md) and [local.settings.json](../functions-run-local.md#local-settings-file) configuration files. It also creates an HttpExample folder that contains the [function.json definition file](../functions-reference-node.md#folder-structure) and the [index.js file](../functions-reference-node.md#exporting-a-function), a Node.js file that contains the function code.

articles/azure-functions/functions-best-practices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ For C# functions, you can change the type to a strongly-typed array. For exampl
109109

110110
The `host.json` file in the function app allows for configuration of host runtime and trigger behaviors. In addition to batching behaviors, you can manage concurrency for a number of triggers. Often adjusting the values in these options can help each instance scale appropriately for the demands of the invoked functions.
111111

112-
Settings in the host.json file apply across all functions within the app, within a *single instance* of the function. For example, if you had a function app with two HTTP functions and [`maxConcurrentRequests`](functions-bindings-http-webhook.md#hostjson-settings) requests set to 25, a request to either HTTP trigger would count towards the shared 25 concurrent requests. When that function app is scaled to 10 instances, the two functions effectively allow 250 concurrent requests (10 instances * 25 concurrent requests per instance).
112+
Settings in the host.json file apply across all functions within the app, within a *single instance* of the function. For example, if you had a function app with two HTTP functions and [`maxConcurrentRequests`](functions-bindings-http-webhook-output.md#hostjson-settings) requests set to 25, a request to either HTTP trigger would count towards the shared 25 concurrent requests. When that function app is scaled to 10 instances, the two functions effectively allow 250 concurrent requests (10 instances * 25 concurrent requests per instance).
113113

114114
Other host configuration options are found in the [host.json configuration article](functions-host-json.md).
115115

articles/azure-functions/functions-bindings-event-grid.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ http://{functionappname}.azurewebsites.net/admin/host/systemkeys/eventgrid_exten
482482
http://{functionappname}.azurewebsites.net/admin/host/systemkeys/eventgridextensionconfig_extension?code={masterkey}
483483
```
484484

485-
This is an admin API, so it requires your function app [master key](functions-bindings-http-webhook.md#authorization-keys). Don't confuse the system key (for invoking an Event Grid trigger function) with the master key (for performing administrative tasks on the function app). When you subscribe to an Event Grid topic, be sure to use the system key.
485+
This is an admin API, so it requires your function app [master key](functions-bindings-http-webhook-trigger.md#authorization-keys). Don't confuse the system key (for invoking an Event Grid trigger function) with the master key (for performing administrative tasks on the function app). When you subscribe to an Event Grid topic, be sure to use the system key.
486486

487487
Here's an example of the response that provides the system key:
488488

@@ -504,7 +504,7 @@ You can get the master key for your function app from the **Function app setting
504504
> [!IMPORTANT]
505505
> The master key provides administrator access to your function app. Don't share this key with third parties or distribute it in native client applications.
506506
507-
For more information, see [Authorization keys](functions-bindings-http-webhook.md#authorization-keys) in the HTTP trigger reference article.
507+
For more information, see [Authorization keys](functions-bindings-http-webhook-trigger.md#authorization-keys) in the HTTP trigger reference article.
508508

509509
Alternatively, you can send an HTTP PUT to specify the key value yourself.
510510

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: Azure Functions HTTP output bindings
3+
description: Learn how to return HTTP responses in Azure Functions.
4+
author: craigshoemaker
5+
6+
ms.topic: reference
7+
ms.date: 02/21/2020
8+
ms.author: cshoe
9+
---
10+
11+
# Azure Functions HTTP output bindings
12+
13+
Use the HTTP output binding to respond to the HTTP request sender. This binding requires an HTTP trigger and allows you to customize the response associated with the trigger's request.
14+
15+
The default return value for an HTTP-triggered function is:
16+
17+
- `HTTP 204 No Content` with an empty body in Functions 2.x and higher
18+
- `HTTP 200 OK` with an empty body in Functions 1.x
19+
20+
## Configuration
21+
22+
The following table explains the binding configuration properties that you set in the *function.json* file. For C# class libraries, there are no attribute properties that correspond to these *function.json* properties.
23+
24+
|Property |Description |
25+
|---------|---------|
26+
| **type** |Must be set to `http`. |
27+
| **direction** | Must be set to `out`. |
28+
| **name** | The variable name used in function code for the response, or `$return` to use the return value. |
29+
30+
## Usage
31+
32+
To send an HTTP response, use the language-standard response patterns. In C# or C# script, make the function return type `IActionResult` or `Task<IActionResult>`. In C#, a return value attribute isn't required.
33+
34+
For example responses, see the [trigger example](./functions-bindings-http-webhook-trigger.md#example).
35+
36+
## host.json settings
37+
38+
This section describes the global configuration settings available for this binding in versions 2.x and higher. The example host.json file below contains only the version 2.x+ settings for this binding. For more information about global configuration settings in versions 2.x and beyond, see [host.json reference for Azure Functions](functions-host-json.md).
39+
40+
> [!NOTE]
41+
> For a reference of host.json in Functions 1.x, see [host.json reference for Azure Functions 1.x](functions-host-json-v1.md#http).
42+
43+
```json
44+
{
45+
"extensions": {
46+
"http": {
47+
"routePrefix": "api",
48+
"maxOutstandingRequests": 200,
49+
"maxConcurrentRequests": 100,
50+
"dynamicThrottlesEnabled": true,
51+
"hsts": {
52+
"isEnabled": true,
53+
"maxAge": "10"
54+
},
55+
"customHeaders": {
56+
"X-Content-Type-Options": "nosniff"
57+
}
58+
}
59+
}
60+
}
61+
```
62+
63+
|Property |Default | Description |
64+
|---------|---------|---------|
65+
| customHeaders|none|Allows you to set custom headers in the HTTP response. The previous example adds the `X-Content-Type-Options` header to the response to avoid content type sniffing. |
66+
|dynamicThrottlesEnabled|true<sup>\*</sup>|When enabled, this setting causes the request processing pipeline to periodically check system performance counters like `connections/threads/processes/memory/cpu/etc` and if any of those counters are over a built-in high threshold (80%), requests will be rejected with a `429 "Too Busy"` response until the counter(s) return to normal levels.<br/><sup>\*</sup>The default in a Consumption plan is `true`. The default in a Dedicated plan is `false`.|
67+
|hsts|not enabled|When `isEnabled` is set to `true`, the [HTTP Strict Transport Security (HSTS) behavior of .NET Core](/aspnet/core/security/enforcing-ssl?view=aspnetcore-3.0&tabs=visual-studio#hsts) is enforced, as defined in the [`HstsOptions` class](/dotnet/api/microsoft.aspnetcore.httpspolicy.hstsoptions?view=aspnetcore-3.0). The above example also sets the [`maxAge`](/dotnet/api/microsoft.aspnetcore.httpspolicy.hstsoptions.maxage?view=aspnetcore-3.0#Microsoft_AspNetCore_HttpsPolicy_HstsOptions_MaxAge) property to 10 days. Supported properties of `hsts` are: <table><tr><th>Property</th><th>Description</th></tr><tr><td>excludedHosts</td><td>A string array of host names for which the HSTS header isn't added.</td></tr><tr><td>includeSubDomains</td><td>Boolean value that indicates whether the includeSubDomain parameter of the Strict-Transport-Security header is enabled.</td></tr><tr><td>maxAge</td><td>String that defines the max-age parameter of the Strict-Transport-Security header.</td></tr><tr><td>preload</td><td>Boolean that indicates whether the preload parameter of the Strict-Transport-Security header is enabled.</td></tr></table>|
68+
|maxConcurrentRequests|100<sup>\*</sup>|The maximum number of HTTP functions that are executed in parallel. This value allows you to control concurrency, which can help manage resource utilization. For example, you might have an HTTP function that uses a large number of system resources (memory/cpu/sockets) such that it causes issues when concurrency is too high. Or you might have a function that makes outbound requests to a third-party service, and those calls need to be rate limited. In these cases, applying a throttle here can help. <br/><sup>*</sup>The default for a Consumption plan is 100. The default for a Dedicated plan is unbounded (`-1`).|
69+
|maxOutstandingRequests|200<sup>\*</sup>|The maximum number of outstanding requests that are held at any given time. This limit includes requests that are queued but have not started executing, as well as any in progress executions. Any incoming requests over this limit are rejected with a 429 "Too Busy" response. That allows callers to employ time-based retry strategies, and also helps you to control maximum request latencies. This only controls queuing that occurs within the script host execution path. Other queues such as the ASP.NET request queue will still be in effect and unaffected by this setting. <br/><sup>\*</sup>The default for a Consumption plan is 200. The default for a Dedicated plan is unbounded (`-1`).|
70+
|routePrefix|api|The route prefix that applies to all routes. Use an empty string to remove the default prefix. |
71+
72+
## Next steps
73+
74+
- [Run a function from an HTTP request](./functions-bindings-http-webhook-trigger.md)

0 commit comments

Comments
 (0)