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
An azd environment variable is stored by the azd CLI for each environment. It is passed to the "azd up" command and can configure both provisioning options and application settings.
6
+
7
+
When adding new azd environment variables, update these files:
8
+
9
+
1.**infra/main.parameters.json**: Add the new parameter mapping from azd env variable to Bicep parameter
10
+
- Use format `${ENV_VAR_NAME}` for required values
11
+
- Use format `${ENV_VAR_NAME=default}` for optional values with defaults
Copy file name to clipboardExpand all lines: README.md
+81Lines changed: 81 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ A demonstration project showcasing Model Context Protocol (MCP) implementations
16
16
-[Deploy to Azure](#deploy-to-azure)
17
17
-[Deploy to Azure with private networking](#deploy-to-azure-with-private-networking)
18
18
-[Deploy to Azure with Keycloak authentication](#deploy-to-azure-with-keycloak-authentication)
19
+
-[Deploy to Azure with Entra OAuth Proxy](#deploy-to-azure-with-entra-oauth-proxy)
19
20
20
21
## Getting started
21
22
@@ -360,3 +361,83 @@ This project supports deploying with OAuth 2.0 authentication using Keycloak as
360
361
| DCR | Open (anonymous) | Require initial access token | Any client can register without auth |
361
362
362
363
> **Note:** Keycloak must be publicly accessible because its URL is dynamically generated by Azure. Token issuer validation requires a known URL, but the mcproutes URL isn't available until after deployment. Using a custom domain would fix this.
364
+
365
+
---
366
+
367
+
## Deploy to Azure with Entra OAuth Proxy
368
+
369
+
This project supports deploying with Microsoft Entra ID (Azure AD) authentication using FastMCP's built-in Azure OAuth proxy. This is an alternative to Keycloak that uses Microsoft Entra with your Azure tenant for identity management.
370
+
371
+
### What gets deployed with Entra OAuth
372
+
373
+
| Component | Description |
374
+
|-----------|-------------|
375
+
|**Microsoft Entra App Registration**| Created automatically during provisioning with redirect URIs for local development, VS Code, and production |
376
+
|**OAuth-protected MCP Server**| FastMCP with AzureProvider for OAuth authentication |
377
+
|**CosmosDB OAuth Client Storage**| Persists OAuth client registrations across server restarts |
378
+
379
+
### Deployment steps for Entra OAuth
380
+
381
+
1. Enable Entra OAuth proxy:
382
+
383
+
```bash
384
+
azd env set USE_FASTMCP_AUTH true
385
+
```
386
+
387
+
2. Deploy to Azure:
388
+
389
+
```bash
390
+
azd up
391
+
```
392
+
393
+
During deployment:
394
+
-**Preprovision hook**: Creates a Microsoft Entra App Registration with a client secret, and stores the credentials in azd environment variables
395
+
-**Postprovision hook**: Updates the App Registration with the deployed server URL as an additional redirect URI
396
+
397
+
3. Verify deployment by checking the outputs:
398
+
399
+
```bash
400
+
azd env get-value MCP_SERVER_URL
401
+
azd env get-value FASTMCP_AUTH_AZURE_CLIENT_ID
402
+
```
403
+
404
+
### Environment variables
405
+
406
+
The following environment variables are automatically set by the deployment hooks:
407
+
408
+
| Variable | Description |
409
+
|----------|-------------|
410
+
|`FASTMCP_AUTH_AZURE_CLIENT_ID`| The App Registration's client ID |
411
+
|`FASTMCP_AUTH_AZURE_CLIENT_SECRET`| The App Registration's client secret |
412
+
|`FASTMCP_AUTH_AZURE_TENANT_ID`| Your Azure tenant ID |
413
+
414
+
These are written to `.env` by the postprovision hook for local development.
415
+
416
+
### Testing locally
417
+
418
+
After deployment, you can test locally with OAuth enabled:
419
+
420
+
```bash
421
+
# Run the MCP server
422
+
cd servers && uvicorn deployed_mcp:app --host 0.0.0.0 --port 8000
423
+
```
424
+
425
+
The server will use the Entra App Registration for OAuth and CosmosDB for client storage.
426
+
427
+
### Connecting VS Code MCP client
428
+
429
+
The App Registration includes redirect URIs for VS Code:
0 commit comments