09-02-04 — Private networking: VNet, Entra Agent Identity, Managed Identity

⏱ 12 minFontes validadas em: 2026-04-29

TL;DR

Para clientes enterprise (Vale, TIM, Michelin), networking privado não é opcional — é requisito. O AI Foundry suporta Managed VNet com Private Endpoints para isolar todo o tráfego. Entra Agent Identity dá ao agente uma identidade Entra para acessar recursos Azure sem secrets. Managed Identity (system-assigned ou user-assigned) elimina chaves hardcoded no código. Conjunto completo resolve LGPD, ISO 27001 e auditoria de acesso.

Arquitetura de networking privado

/*
Topologia típica enterprise:

Corp Network (on-prem) ──── ExpressRoute/VPN ──── Azure VNet
                                                        │
                                               ┌────────────────┐
                                               │  Subnet Foundry │
                                               │                 │
                                               │  AI Foundry Hub │
                                               │  (Private EP)   │
                                               └────────┬────────┘
                                                        │ Private Endpoints
                                        ┌───────────────┼───────────────┐
                                        ▼               ▼               ▼
                                   Azure OpenAI    Azure Search     Key Vault
                                  (Private EP)    (Private EP)    (Private EP)

Sem tráfego passando pela internet pública.
*/

Configurando Managed VNet no Hub

Três modos de isolamento:

  • Disabled: acesso público (OK para dev/teste)
  • AllowInternetOutbound: Private Endpoints para serviços Azure, mas pode acessar internet (NPM, pip)
  • AllowOnlyApprovedOutbound: só destinos aprovados — máximo isolamento para produção enterprise
// Bicep: Hub com networking privado máximo
resource hub 'Microsoft.MachineLearningServices/workspaces@2024-10-01' = {
  name: 'impar-ai-hub-prod'
  location: 'brazilsouth'
  kind: 'Hub'
  identity: { type: 'SystemAssigned' }
  properties: {
    managedNetwork: {
      isolationMode: 'AllowOnlyApprovedOutbound'
      outboundRules: {
        // Regra de saída aprovada: apenas Azure AI Search interno
        search: {
          type: 'PrivateEndpoint'
          destination: {
            serviceResourceId: aiSearchResource.id
            subresourceTarget: 'searchService'
          }
        }
      }
    }
    // Desabilita endpoint público do Hub
    publicNetworkAccess: 'Disabled'
  }
}

Private Endpoint para o Hub

// Criar Private Endpoint para acessar o Hub de dentro da VNet
resource hubPrivateEndpoint 'Microsoft.Network/privateEndpoints@2023-11-01' = {
  name: 'pe-foundry-hub'
  location: 'brazilsouth'
  properties: {
    subnet: { id: privateSubnet.id }
    privateLinkServiceConnections: [{
      name: 'foundry-hub-connection'
      properties: {
        privateLinkServiceId: hub.id
        groupIds: ['amlworkspace']
      }
    }]
  }
}

Entra Agent Identity

O Entra Agent ID cria uma identidade de workload no Microsoft Entra para cada agente. Diferente de um service principal genérico, o Agent ID é projetado para workloads de agente e aparece no Entra com tipo "Agent".

Isso habilita:

  • Audit logs no Entra mostrando ações do agente (não apenas "service xyz")
  • Conditional Access policies específicas para agentes
  • RBAC granular: o agente tem apenas as permissões que precisa, nada mais
  • Revogação imediata de acesso via Entra, sem mexer no código

Managed Identity no código .NET

using Azure.Identity;
using Azure.AI.Projects;

// DefaultAzureCredential usa automaticamente:
// - Managed Identity quando rodando em Azure (AKS, App Service, Functions)
// - Azure CLI credential quando rodando local
// - Environment variables (AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET)
var credential = new DefaultAzureCredential();

// Nenhuma chave hardcoded — identidade gerenciada pelo Azure
var client = new AgentsClient(
    endpoint: Environment.GetEnvironmentVariable("AZURE_AI_FOUNDRY_ENDPOINT"),
    credential: credential
);

// Para AKS: use Workload Identity (federated credential)
// Para App Service: ative System-Assigned Managed Identity no portal
// Para Azure Functions: mesmo — System-Assigned MI

Permissões necessárias para o agente

Atribua ao Managed Identity do seu app apenas o que precisa:

ResourceRole mínimaPara quê
AI Foundry HubAzure AI DeveloperCriar/gerenciar agents, runs, threads
Azure OpenAICognitive Services OpenAI UserInvocar inferência
Azure AI SearchSearch Index Data ReaderLer índice para RAG
Azure Blob StorageStorage Blob Data ReaderLer arquivos para file search
Key VaultKey Vault Secrets UserAcessar segredos (connection strings)
✅ Checklist segurança enterprise: ☐ Managed VNet AllowOnlyApprovedOutbound ativo; ☐ publicNetworkAccess: Disabled no Hub; ☐ Managed Identity no app, sem API Keys no código; ☐ RBAC mínimo (Azure AI Developer, não Contributor); ☐ Private Endpoints para todos os serviços dependentes; ☐ Entra Agent ID registrado; ☐ Audit logs habilitados.

Conectividade on-prem → Foundry

Para sistemas on-premises (ERPs, bancos de dados legados) precisarem ser acessados pelo agente como tool:

  • Azure VPN Gateway: túnel site-to-site para a VNet do Foundry
  • ExpressRoute: conexão dedicada, latência previsível, ideal para clientes financeiros e industriais
  • Azure Private Link: expõe serviço on-prem como Private Endpoint na VNet

Como isso se conecta

  • 09-01-02: Hub e projetos — onde a configuração de networking começa
  • 08-02-03: Entra Agent ID no contexto do Agent 365
  • 09-04-01: Evaluations em ambiente privado — funciona da mesma forma

Fontes

  1. Configure managed virtual network — Microsoft Learn
  2. Disable local authentication (key-based) — Microsoft Learn
  3. Entra Agent ID: Securing AI agents with identity — Tech Community
  4. Managed identities overview — Microsoft Learn