Secure your AI Foundry environment with private endpoints, managed VNets, managed identity, and Key Vault integration.
Azure AI Foundry provides three networking modes:
| Mode | Internet Access | Use Case |
|---|---|---|
| Public | Full internet access | Development, learning, POCs |
| Private Endpoint | No public access; accessed via VNet | Production workloads |
| Managed VNet | Azure manages the VNet for you | Simplified production security |
📖 Docs: Configure Private Link
Private endpoints place your AI Foundry hub on a private IP address within your VNet:
resource privateEndpoint 'Microsoft.Network/privateEndpoints@2023-11-01' = {
name: '${hubName}-pe'
location: location
properties: {
subnet: {
id: subnetId
}
privateLinkServiceConnections: [
{
name: '${hubName}-connection'
properties: {
privateLinkServiceId: hub.id
groupIds: ['amlworkspace']
}
}
]
}
}
Required private endpoints for a fully private deployment:
amlworkspace)blob, file)vault)registry)account)searchService)💡 Tip: In production, always use private endpoints. The initial setup is more complex, but it eliminates the attack surface from public internet exposure.
Managed VNet simplifies networking — Azure creates and manages the VNet for you:
az ml workspace update \
--name my-ai-hub \
--resource-group rg-ai-foundry \
--managed-network allow-internet-outbound
Three outbound modes:
📖 Docs: Configure Managed Network
Always use managed identity for service-to-service authentication:
from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient
# No API keys needed — uses managed identity
credential = DefaultAzureCredential()
client = AIProjectClient(
credential=credential,
endpoint="https://<hub>.api.azureml.ms",
project_name="my-project"
)
| Type | Lifecycle | Use Case |
|---|---|---|
| System-Assigned | Tied to the resource | Simple setups, single-resource identity |
| User-Assigned | Independent of resource | Multiple resources sharing one identity |
💡 Tip: Use system-assigned managed identity for hubs and projects. Use user-assigned only when you need the same identity across multiple resources or when policy requires it.
Hub automatically creates a Key Vault for storing:
Access secrets in your code:
from azure.keyvault.secrets import SecretClient
from azure.identity import DefaultAzureCredential
client = SecretClient(
vault_url="https://my-keyvault.vault.azure.net/",
credential=DefaultAzureCredential()
)
secret = client.get_secret("my-api-key")
💡 Tip: Never store secrets in code or environment variables in production. Always use Key Vault with managed identity.
Enable diagnostic logging to track all API calls and operations:
# Create Log Analytics workspace
az monitor log-analytics workspace create \
--resource-group rg-ai-foundry \
--workspace-name ai-foundry-logs
# Enable diagnostics on the hub
az monitor diagnostic-settings create \
--name hub-diagnostics \
--resource <hub-resource-id> \
--workspace <log-analytics-id> \
--logs '[{"categoryGroup":"allLogs","enabled":true}]'