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
A hands-on lab demonstrating secure agent consumption through private networking with Azure AI Foundry, API Management, and Front Door. Features MCP (Model Context Protocol) integration, private endpoints, and agent-based interactions. MCP servers are only accessible through the frontdoor.
4
+
5
+
6
+
## 🏗️ Architecture
7
+
8
+
This lab demonstrates a fully private AI infrastructure:
9
+
10
+

11
+
12
+
Core Components:
13
+
-**Azure AI Foundry**: AI Services account with private endpoint access only
14
+
-**Azure API Management (APIM)**: Deployed in VNet, manages traffic to AI services via private endpoints
15
+
-**Azure Front Door**: Premium tier with Private Link to APIM - the only publicly accessible endpoint
16
+
-**Azure Key Vault**: Stores secrets, accessible only from private network
17
+
-**Jumpbox VM**: Ubuntu VM with managed identity for testing from private network
18
+
-**MCP Integration**: Model Context Protocol server exposed through APIM
19
+
20
+
**Network Flow**: Client → Front Door (Public) → Private Link → APIM (Private VNet) → Private Endpoint → AI Foundry
21
+
22
+
## 📋 Prerequisites
23
+
24
+
-[Python 3.11 or later](https://www.python.org/) installed locally
25
+
-[VS Code](https://code.visualstudio.com/) with [Jupyter extension](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) enabled
26
+
-[Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) installed and authenticated
27
+
-[An Azure Subscription](https://azure.microsoft.com/free/) with Contributor permissions
28
+
29
+
## 🚀 Deployment
30
+
31
+
### 1. Clone and Setup
32
+
33
+
```bash
34
+
git clone <repository-url>
35
+
cd AI-Gateway
36
+
pip install -r requirements.txt
37
+
```
38
+
39
+
### 2. Deploy Infrastructure
40
+
41
+
Open the [Jupyter notebook](./foundry-private-mcp.ipynb) and execute the cells to:
42
+
43
+
1.**Initialize variables** - Set deployment name, locations, and model configurations
44
+
2.**Create resource group** - Provision the Azure resource group
45
+
3.**Deploy Bicep template** - Deploy all infrastructure (15-20 minutes):
46
+
- Virtual Network with subnets
47
+
- Azure AI Foundry with private endpoint
48
+
- APIM integrated in VNet
49
+
- Front Door with Private Link
50
+
- Key Vault with secrets
51
+
- Jumpbox VM with managed identity
52
+
- MCP API configuration
53
+
54
+
4.**Approve Private Link** - Approve Front Door connection to APIM
55
+
5.**Disable APIM public access** - Lock down APIM to private network only
56
+
57
+
### 3. Verify Deployment Outputs
58
+
59
+
The deployment provides:
60
+
-`frontDoorEndpointHostName` - Public endpoint for testing
61
+
-`apimResourceGatewayURL` - Private APIM URL (inaccessible from internet)
62
+
-`keyVaultUrl` - Key Vault URL for secrets
63
+
-`aiFoundryProjectEndpoint` - AI Foundry project endpoint
64
+
65
+
## 🧪 Testing from Jumpbox
66
+
67
+
### Connect to Jumpbox
68
+
69
+
Use Azure Bastion to connect to the VM:
70
+
71
+
```bash
72
+
az network bastion ssh \
73
+
--name bastion-host \
74
+
--resource-group <resource-group> \
75
+
--target-resource-id <vm-resource-id> \
76
+
--auth-type password \
77
+
--username azureuser
78
+
```
79
+
80
+
Or connect via the Azure Portal: Navigate to the VM → Connect → Bastion
81
+
82
+
### Create Python Scripts
83
+
84
+
Once connected to the jumpbox, create the required scripts:
85
+
86
+
#### 1. Create `scripts/load_env_from_kv.py`
87
+
```bash
88
+
cat >~/scripts/load_env_from_kv.py << 'EOF'
89
+
# Paste content of agent/load_env_from_kv.py here
90
+
EOF
91
+
```
92
+
93
+
#### 2. Create `scripts/sample_agents_mcp.py`
94
+
```bash
95
+
cat >~/scripts/sample_agents_mcp.py << 'EOF'
96
+
# Paste content of agent/sample_agents_mcp.py here
0 commit comments