Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Deploy, evaluate, and manage AI agents end-to-end on Microsoft Azure AI Foundry
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
resource/private-network/references/end-to-end-test.md
1# End-to-End Test (VNet Access Required)23Continues from [post-deployment-validation.md](post-deployment-validation.md). Steps 1–3 there must be complete first.45## 4. VNet Access Setup67> ⚠️ The remaining tests require connectivity to the VNet.89Use `AskUserQuestion`: **"Steps 1-3 are done. The remaining tests need VNet access. How do you want to proceed?"**10Options:11- `I have a Bastion VM / jump box`12- `Set up a point-to-site VPN for me` — read [vpn-dns-setup.md](vpn-dns-setup.md)13- `I have VPN / ExpressRoute already`14- `Skip testing for now`1516**Bastion VM:** User has direct access to all private endpoints from the VM. Setup is complete — do NOT proceed to Step 5.1718---1920## 5. End-to-End Test (VPN users only)2122Three phases:231. **Network** — DNS resolution + port 443 reachability242. **Agent Lifecycle** — Create agent, thread, run, verify, cleanup253. **Isolation Proof** — Repeat with VPN off — expect 4032627> ⚠️ Chromium browsers may bypass VPN DNS via Secure DNS (DoH). If portal shows "Error loading agents" but CLI works, disable Secure DNS.2829### Requirements3031```bash32pip install azure-ai-projects azure-identity azure-ai-agents33```3435### Phase 1: Network Validation3637Resolve DNS and test port 443 for all private endpoints. Substitute actual resource names from the deployment.3839PowerShell:4041```powershell42$endpoints = @(43'<ai-account>.services.ai.azure.com',44'<ai-account>.openai.azure.com',45'<ai-account>.cognitiveservices.azure.com',46'<cosmos-account>.documents.azure.com',47'<storage-account>.blob.core.windows.net',48'<search-service>.search.windows.net'49)50foreach ($h in $endpoints) {51$ip = (Resolve-DnsName $h | Where-Object {$_.IPAddress}).IPAddress52$reach = Test-NetConnection $h -Port 443 -WarningAction SilentlyContinue53Write-Host "$h -> $ip (reachable: $($reach.TcpTestSucceeded))"54}55```5657Bash:5859```bash60endpoints=(61'<ai-account>.services.ai.azure.com'62'<ai-account>.openai.azure.com'63'<ai-account>.cognitiveservices.azure.com'64'<cosmos-account>.documents.azure.com'65'<storage-account>.blob.core.windows.net'66'<search-service>.search.windows.net'67)68for h in "${endpoints[@]}"; do69ip=$(dig +short "$h" | tail -n1)70nc -z -w 3 "$h" 443 >/dev/null 2>&1 && reach=yes || reach=no71echo "$h -> $ip (reachable: $reach)"72done73```7475All should resolve to private IPs and be reachable.7677Report results to the user (✅/❌ per endpoint) before proceeding to Phase 2.7879### Phase 2: Agent Lifecycle Test8081Create agent, thread, send message, verify response, cleanup. This exercises all 4 PEs (AI Services, Cosmos DB, Storage, AI Search).8283```python84from azure.identity import DefaultAzureCredential85from azure.ai.projects import AIProjectClient8687endpoint = "https://<ai-account>.services.ai.azure.com/api/projects/<project-name>"88client = AIProjectClient(endpoint=endpoint, credential=DefaultAzureCredential())89agents = client.agents9091agent = agents.create_agent(model="<deployment-name>", name="vnet-test", instructions="Reply with 'OK'")92thread = agents.threads.create()93agents.messages.create(thread_id=thread.id, role="user", content="test")94run = agents.runs.create_and_process(thread_id=thread.id, agent_id=agent.id)95msgs = agents.messages.list(thread_id=thread.id)96print(f"Response: {msgs.data[0].content[0].text.value}")97agents.threads.delete(thread.id)98agents.delete_agent(agent.id)99```100101Report results to the user (which PEs passed, any failures) before proceeding to Phase 3.102103Ask user to disconnect VPN. Repeat Phase 2 — it should fail with 403. Report whether isolation is confirmed before proceeding to cross-check.104105### Requirements Cross-Check106107After testing, compare each requirement gathered in [intake.md](intake.md) against the deployed state. Flag any mismatches with remediation steps.108109### Cleanup (VPN users only)110111Ask if user wants to delete VPN Gateway (~$140/month) and DNS Resolver (~$180/month), or keep for ongoing access.112113```bash114az network vnet-gateway delete --resource-group <rg> --name vpn-gateway-<suffix> --no-wait115az network dns-resolver delete --resource-group <rg> --name dns-resolver-<suffix> --yes116az network public-ip delete --resource-group <rg> --name vpn-gateway-pip-<suffix>117```118