Skip to content

Commit ffad79a

Browse files
committed
Update authentication instructions to disable key-based access for MCP servers
1 parent 02a6ecb commit ffad79a

3 files changed

Lines changed: 89 additions & 61 deletions

File tree

articles/azure-functions/functions-mcp-foundry-tools.md

Lines changed: 67 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@ This article follows this basic process for configuring the MCP server connectio
2121
> * Create and deploy an MCP server to your function app in Azure.
2222
> * Get the MCP server endpoint URL.
2323
> * Get the authentication credentials (as required).
24+
> * Disable key-based authentication (when not needed).
2425
> * Add an MCP server tool connection to an existing agent.
2526
2627
## Prerequisites
2728

2829
Before you begin, make sure you have these resources in place:
2930

30-
* Deploy an MCP server to a function app in Azure by using one of these supported hosting options:
31+
* An MCP server hosted as a function app. You can create your MCP server by completing the quickstart for one of these supported hosting options:
3132
* [Using the Azure Functions MCP extension](scenario-custom-remote-mcp-server.md).
3233
* [Self-host a server that uses standard MCP SDKs](scenario-host-mcp-server-sdks.md).
33-
* [Configure built-in authentication](./functions-mcp-tutorial.md#configure-authentication-on-server-app), when using Microsoft Entra ID-based authentication.
34+
* [Configure built-in authentication in your function app](./functions-mcp-tutorial.md#configure-authentication-on-server-app), when using Microsoft Entra ID-based authentication.
3435
* [An existing Foundry project and model](/azure/ai-foundry/tutorials/quickstart-create-foundry-resources?view=foundry&tabs=portal&preserve-view=true).
3536
* [An existing agent](/azure/ai-foundry/quickstarts/get-started-code?view=foundry&preserve-view=true#create-an-agent).
3637

@@ -40,7 +41,7 @@ This table summarizes the currently supported options for authenticating your ag
4041

4142
| Method | Description | Use case | Additional setup | Functions supports |
4243
| ------ | ----------- | -------- | ---------------- | ------------------- |
43-
| **Key-based**<sup>*</sup> | Agent authenticates by passing a shared [function access key](./function-keys-how-to.md) in the request header. | During development or when the MCP server doesn't require Microsoft Entra authentication. | None | Yes |
44+
| **Key-based**<sup>*</sup> | Agent authenticates by passing a shared [function access key](./function-keys-how-to.md) in the request header. This is the default authentication for HTTP endpoints in Functions. | During development or when the MCP server doesn't require Microsoft Entra authentication. | None | Yes |
4445
| **Microsoft Entra** | Agent authenticates using either its own identity (*agent identity*) or the shared identity of the Foundry project (*project managed identity*). | Agent identity supports production scenarios, but shared identity should be limited to development. | [Disable key-based authentication](functions-mcp-tutorial.md?tabs=mcp-extension#disable-key-based-authentication) and [configure built-in server authorization and authentication](functions-mcp-tutorial.md?tabs=mcp-extension#enable-built-in-server-authorization-and-authentication). | Project managed (shared) identity |
4546
| **OAuth identity passthrough** | Agent prompts users to sign in and authorize access, using the provided token to authenticate. | Production when each user must authenticate with their own identity and user context must be persisted. | [Disable key-based authentication](functions-mcp-tutorial.md?tabs=mcp-extension#disable-key-based-authentication) and [configure built-in server authorization and authentication](functions-mcp-tutorial.md?tabs=mcp-extension#enable-built-in-server-authorization-and-authentication). | Yes |
4647
| **Unauthenticated access** | Agent makes unauthenticated calls. | During development or when your MCP server accesses only public information. | [Disable key-based authentication](functions-mcp-tutorial.md?tabs=mcp-extension#disable-key-based-authentication). | Yes |
@@ -69,7 +70,7 @@ The credentials that your agent needs to connect to the MCP server depend on the
6970
When you use an access key to connect to your MCP server endpoint, you use a shared secret key to make it more difficult for random agents to connect to your server.
7071

7172
>[!IMPORTANT]
72-
>While access keys can help prevent unwanted endpoint access, consider using Microsoft Entra ID authentication to secure your MCP server endpoints in production.
73+
>While access keys can help prevent unwanted endpoint access by default, consider using Microsoft Entra ID or OAuth identity authentication to provide enhanced security to your MCP server endpoints in production.
7374
7475
The name of the access key you need depends on your MCP server deployment:
7576

@@ -89,19 +90,35 @@ For more information, see [Work with access keys in Azure Functions](function-ke
8990

9091
### [Microsoft Entra](#tab/entra)
9192

92-
Both **Agent Identity** and **Project Managed Identity** use Microsoft Entra authentication. Currently, Functions only supports **Project managed identity**, which requires your server to be configured by using built-in authentication and authorization. The required audience is the Application ID URI from your function app's Entra app registration. You get this value during the [built-in authentication configuration](functions-mcp-tutorial.md?tabs=mcp-extension#configure-protected-resource-metadata-preview).
93+
Both **Agent Identity** and **Project Managed Identity** use Microsoft Entra authentication. Currently, Functions only supports **Project managed identity**, which requires your server to use built-in authentication and authorization.
9394

94-
To get the Application ID URI from the Azure portal:
95+
1. Connect a user-assigned managed identity from your function app to your Foundry project. If you don't have a user-assigned managed identity, you must [first create one](../app-service/overview-managed-identity.md#add-a-user-assigned-identity).
9596

96-
1. Go to your function app resource in the [Azure portal](https://portal.azure.com).
97-
98-
1. Select **Settings** > **Authentication** from the left menu.
97+
1. In the [Azure portal](https://portal.azure.com), search for `Foundry` and in Microsoft Foundry select your Foundry resource from **All resources**.
98+
99+
1. In **Resource management** > **Identity** > **User assigned** select **+ Add**, select the user-assigned managed identity used by your function app, and then select **Add**.
100+
101+
1. Select the newly added identity and copy the **Client ID** value.
102+
103+
1. Use the client ID of the identity to make it an allowed client application in your [function app's Entra app registration](functions-mcp-tutorial.md?tabs=mcp-extension#configure-protected-resource-metadata-preview):
99104

100-
1. Select the name of the Entra app next to **Microsoft**. This selection takes you to the Entra app resource.
105+
1. Go to your function app resource in the [Azure portal](https://portal.azure.com).
106+
107+
1. Select **Settings** > **Authentication** from the left menu.
108+
109+
1. Select the **Edit** icon for your registered Entra identity provider.
110+
111+
1. In your provider, set **Client application requirement** to **Allow requests from specific client applications** and select the edit button next to **Allowed client applications**.
112+
113+
1. Add the client ID of your managed identity, and select **OK** and then **Save**.
101114

102-
1. In the left menu, select **Manage** > **Expose an API**.
115+
1. Get the **Application ID URI** from your function app's Entra app registration, which you need to complete the Entra authentication registration in your agent:
103116

104-
1. Copy the **Application ID URI** at the top of the page. This ID value looks like `api://00001111-aaaa-2222-bbbb-3333cccc4444`.
117+
1. Select the name of the registered Entra identity provider. This selection takes you to the Entra app resource page.
118+
119+
1. In the left menu, select **Manage** > **Expose an API**.
120+
121+
1. Copy the **Application ID URI** at the top of the page. This ID value looks like `api://00001111-aaaa-2222-bbbb-3333cccc4444`.
105122

106123
### [OAuth identity](#tab/oauth-id)
107124

@@ -147,6 +164,44 @@ Because unauthenticated access requires no shared secrets or authentication, you
147164
148165
---
149166

167+
## Disable key-based authentication
168+
169+
When you choose to use a different authentication method than the default key-based authentication, you don't need Functions to enforce key-based access to your MCP endpoints. You can disable key-based access requirement by changing the access setting from `system` (key-based) to `anonymous` (unauthenticated). How you make this change depends on the type of MCP server you're hosting:
170+
171+
### [MCP extension server](#tab/mcp-extension/key-based)
172+
173+
When you are using the default key-based authentication, no changes are required.
174+
175+
### [MCP extension server](#tab/mcp-extension/entra)
176+
177+
[!INCLUDE [functions-mcp-extension-disable-key-access](../../includes/functions-mcp-extension-disable-key-access.md)]
178+
179+
### [MCP extension server](#tab/mcp-extension/oauth-id)
180+
181+
[!INCLUDE [functions-mcp-extension-disable-key-access](../../includes/functions-mcp-extension-disable-key-access.md)]
182+
183+
### [MCP extension server](#tab/mcp-extension/unauthenticated)
184+
185+
[!INCLUDE [functions-mcp-extension-disable-key-access](../../includes/functions-mcp-extension-disable-key-access.md)]
186+
187+
### [Self-hosted server](#tab/self-hosted/key-based)
188+
189+
Skip this section when using key-based authentication.
190+
191+
### [Self-hosted server](#tab/self-hosted/entra)
192+
193+
[!INCLUDE [functions-mcp-custom-handler-disable-key-access](../../includes/functions-mcp-custom-handler-disable-key-access.md)]
194+
195+
### [Self-hosted server](#tab/self-hosted/oauth-id)
196+
197+
[!INCLUDE [functions-mcp-custom-handler-disable-key-access](../../includes/functions-mcp-custom-handler-disable-key-access.md)]
198+
199+
### [Self-hosted server](#tab/self-hosted/unauthenticated)
200+
201+
[!INCLUDE [functions-mcp-custom-handler-disable-key-access](../../includes/functions-mcp-custom-handler-disable-key-access.md)]
202+
203+
---
204+
150205
## Add your MCP server
151206

152207
The process for creating the agent connection to the MCP server depends on your specific endpoint authentication options.
@@ -206,18 +261,6 @@ To connect to your MCP server endpoint:
206261

207262
1. Select **Save** to save the MCP tool configuration in your agent.
208263

209-
1. Beause you are using built-in authentication, you should also disable the default key-based authentication. The way you disable key access depends on your hosting method:
210-
211-
### [MCP extension server](#tab/mcp-extension/entra)
212-
213-
[!INCLUDE [functions-mcp-extension-disable-key-access](../../includes/functions-mcp-extension-disable-key-access.md)]
214-
215-
### [Self-hosted server](#tab/self-hosted/entra)
216-
217-
[!INCLUDE [functions-mcp-custom-handler-disable-key-access](../../includes/functions-mcp-custom-handler-disable-key-access.md)]
218-
219-
---
220-
221264
### [OAuth identity](#tab/oauth-id)
222265

223266
When you use OAuth identity passthrough, the agent prompts the user to sign in and then uses the returned access token when connecting to the server.
@@ -254,18 +297,6 @@ When you use OAuth identity passthrough, the agent prompts the user to sign in a
254297

255298
1. Go back to the agent window, select **Close** > **Save** to save the MCP tool configuration in your agent.
256299

257-
1. Beause you are using built-in authentication, you should also disable the default key-based authentication. The way you disable key access depends on your hosting method:
258-
259-
### [MCP extension server](#tab/mcp-extension/entra)
260-
261-
[!INCLUDE [functions-mcp-extension-disable-key-access](../../includes/functions-mcp-extension-disable-key-access.md)]
262-
263-
### [Self-hosted server](#tab/self-hosted/entra)
264-
265-
[!INCLUDE [functions-mcp-custom-handler-disable-key-access](../../includes/functions-mcp-custom-handler-disable-key-access.md)]
266-
267-
---
268-
269300
### [Unauthenticated](#tab/unauthenticated)
270301

271302
Use unauthenticated access only when your MCP server doesn't require authentication and accesses only public information.

includes/functions-mcp-custom-handler-disable-key-access.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
author: ggailey777
33
ms.service: azure-functions
44
ms.topic: include
5-
ms.date: 02/03/2026
5+
ms.date: 02/12/2026
66
ms.author: glenga
77
---
88

9-
To disable host-based authentication for self-hosted MCP servers, add the following code in the `customHandler` section of the `host.json` file:
9+
To disable host-based authentication in your MCP server, add a setting named `AzureFunctionsJobHost__customHandler__http__DefaultAuthorizationLevel` with a value of `anonymous` to your application settings. You can add this setting in the portal or use the following Azure CLI command:
1010

11-
```json
12-
"customHandler": {
13-
...
14-
"http": {
15-
"DefaultAuthorizationLevel": "anonymous"
16-
}
17-
}
18-
```
11+
```azurecli
12+
az functionapp config appsettings set --name <APP_NAME> --resource-group <RESOURCE_GROUP> \
13+
--settings "AzureFunctionsJobHost__customHandler__http__DefaultAuthorizationLevel=anonymous"
14+
```
15+
16+
In this example, replace `<APP_NAME>` and `<RESOURCE_GROUP>` with the name of your function app and resource group.
17+
18+
>[!TIP]
19+
>This setting is equivalent to setting `http.DefaultAuthorizationLevel` to `anonymous` in the custom handler section of the `host.json` file. That approach requires you to republish your server project.

includes/functions-mcp-extension-disable-key-access.md

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@
22
author: ggailey777
33
ms.service: azure-functions
44
ms.topic: include
5-
ms.date: 02/03/2026
5+
ms.date: 02/12/2026
66
ms.author: glenga
77
---
88

9-
To disable host-based authentication in your MCP server, set `system.webhookAuthorizationLevel` to `Anonymous` in the `host.json` file:
9+
To disable host-based authentication in your MCP server, add a setting named `AzureFunctionsJobHost__extensions__mcp__system__webhookAuthorizationLevel` with a value of `Anonymous` to your application settings. You can add this setting in the portal or use the following Azure CLI command:
1010

11-
```json
12-
{
13-
"version": "2.0",
14-
"extensions": {
15-
"mcp": {
16-
...
17-
"system": {
18-
"webhookAuthorizationLevel": "Anonymous"
19-
}
20-
}
21-
}
22-
}
23-
```
11+
```azurecli
12+
az functionapp config appsettings set --name <APP_NAME> --resource-group <RESOURCE_GROUP> \
13+
--settings "AzureFunctionsJobHost__extensions__mcp__system__webhookAuthorizationLevel=Anonymous"
14+
```
15+
16+
In this example, replace `<APP_NAME>` and `<RESOURCE_GROUP>` with the name of your function app and resource group.
17+
18+
>[!TIP]
19+
>This setting is equivalent to setting `system.webhookAuthorizationLevel` to `Anonymous` in the MCP Extension section of the `host.json` file. However, that method requires you to republish your server project.

0 commit comments

Comments
 (0)