Prerequisites and AKS requirements (preview)

Important

Hosted agent on your own AKS cluster is currently in preview. See the Supplemental Terms of Use for Microsoft Azure Previews for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.

Review the required tools, supported regions, AKS and node-pool configuration, networking, identities, permissions, storage, and Azure Container Registry before onboarding.

1. Install the local tools

Tool Used for Installation
Azure CLI (az) Azure authentication and resource configuration Install
Azure Developer CLI (azd) Foundry configuration and deployment Install
Python 3.13 or later Running the sample locally. The quickstart's remote container build doesn't require local Python. Install
kubectl Kubernetes validation Install
Azure kubelogin Authentication to Microsoft Entra-enabled AKS Install. On Windows, you can install it with winget install --id Microsoft.Azure.Kubelogin.
Git Clone the sample Install

2. Prepare the extensions

PowerShell

az extension add --name aks-preview --upgrade
az extension add --name application-insights --upgrade
azd extension install microsoft.foundry --source azd

Bash

az extension add --name aks-preview --upgrade
az extension add --name application-insights --upgrade
azd extension install microsoft.foundry --source azd

Confirm that the extensions are installed:

PowerShell / Bash

az extension show --name aks-preview --output table
azd extension list

AKS and node pool requirements

AKS cluster requirements

Area Requirement
Cluster type and version AKS Standard, Kubernetes 1.31+. AKS Automatic and Azure Arc-enabled Kubernetes aren't supported in this preview. Use the latest product-qualified GA version, currently AKS 1.36.3.
Network plugin Azure CNI Overlay or Azure CNI Pod Subnet. Kubenet and Azure CNI Node Subnet aren't supported.
Network policy Enable network policy on the AKS cluster.
Cluster identity Support both system-assigned and user-assigned managed identity. Service-principal-based clusters aren't supported.
Workload federation OpenID Connect (OIDC) issuer and Workload Identity enabled.
System node pool System mode. Runs critical Kubernetes and AKS system services. A VM size with at least 1 vCPU and 4 GiB memory is recommended; prefer Standard_D4ds_v5 when available.
Dedicated agent node pool User mode, Azure Linux, KataVmIsolation, and at least one node. This sandbox pool runs Foundry-hosted agent workloads. A VM size with at least 1 vCPU and 4 GiB memory is recommended; prefer Standard_D8as_v5 when available. Agent performance isn't guaranteed with a lower-specification VM size.
Node image AKSAzureLinux-V3katagen2-202608.14.0 or later.
Node label agents.ai.azure.com/sandbox-node=true. Foundry uses nodes with this label to run agent workloads.
Provisioning readiness Cluster and agent pool must both report Succeeded.

Networking, storage, and registry requirements

Resource Requirements
Storage account Use a dedicated StorageV2 account with Hot tier, HTTPS only, TLS 1.2 or later, shared-key access disabled, anonymous blob access disabled, and hierarchical namespace disabled. Authenticate through a dedicated AKS Workload Identity with least-privilege Storage Blob Data Contributor RBAC. The account must be reachable from the AKS agent-pool subnet over TCP 443.
Registry Don't install or rely on private trusted root certificates in the hosted-agent image.
Network • Allow outbound TCP 443 from the AKS workload network to required Azure services.
• Ensure routing and DNS between the delegated subnet, AKS agent pool, Azure Container Registry, Storage, and monitoring endpoints.
• Use private endpoints and private DNS for Storage and Azure Container Registry when required by your network design.

Prepare resources

Use the following process to choose an AKS cluster and prepare the Azure resources required for customer-managed AKS hosting.

Clone the sample repository

Clone the sample repository before you run the setup script.

git clone https://github.com/Azure-Samples/foundry-hosted-agents-on-your-aks
cd foundry-hosted-agents-on-your-aks

Setup script

The sample repository provides the following setup script:

Script What it does
provision_aks Creates or reuses an AKS cluster with Azure CNI Overlay, Microsoft Entra authentication, Azure RBAC, OIDC, and Workload Identity. It also creates a dedicated Azure Linux sandbox node pool with Kata isolation and the Foundry scheduling label.

1. Choose an AKS cluster

Do you want to use an existing AKS cluster?

  • Existing AKS cluster: Confirm that the cluster meets the AKS and node-pool requirements in this article, then record its Azure resource ID.
  • No AKS cluster: Use provision_aks to create a compatible cluster and dedicated sandbox node pool.

Run provision_aks

The script reads AZURE_SUBSCRIPTION_ID, AZURE_LOCATION, RESOURCE_GROUP, AKS_NAME, and KUBERNETES_VERSION from your environment. Run it once to review the planned changes, then rerun it with Apply.

PowerShell

$env:AZURE_SUBSCRIPTION_ID = "<approved-subscription-id>"
$env:AZURE_LOCATION = "westus2"
$env:RESOURCE_GROUP = "<new-resource-group-name>"
$env:AKS_NAME = "<new-aks-cluster-name>"
$env:KUBERNETES_VERSION = "1.36.3"

az account set --subscription "$env:AZURE_SUBSCRIPTION_ID"
az group create --name "$env:RESOURCE_GROUP" --location "$env:AZURE_LOCATION" --output none

.\provision_aks.ps1
.\provision_aks.ps1 -Apply

Bash

export AZURE_SUBSCRIPTION_ID="<approved-subscription-id>"
export AZURE_LOCATION="westus2"
export RESOURCE_GROUP="<new-resource-group-name>"
export AKS_NAME="<new-aks-cluster-name>"
export KUBERNETES_VERSION="1.36.3"

az account set --subscription "$AZURE_SUBSCRIPTION_ID"
az group create --name "$RESOURCE_GROUP" --location "$AZURE_LOCATION" --output none

bash ./provision_aks.sh
bash ./provision_aks.sh --apply

2. Create or select an azd environment

PowerShell / Bash

azd env new "<environment-name>" --subscription "<approved-subscription-id>" --location "westus2"

If the environment already exists, use azd env select "<environment-name>" instead.

The Projects extension creates the Application Insights component and connects it to the Foundry project during azd provision. Don't precreate a component or set APPLICATIONINSIGHTS_RESOURCE_ID or APPLICATIONINSIGHTS_CONNECTION_STRING for this path.

3. Prepare supporting resources

Besides AKS, you need to create the following supporting resources:

Resource Required configuration or permissions
Hosting user-assigned managed identity Reader and Kubernetes Extension Contributor on the AKS cluster; Managed Identity Federated Identity Credential Contributor on the workload identity.
Workload user-assigned managed identity A separate identity for session snapshots, with Storage Blob Data Contributor on the storage account.
Storage account A dedicated StorageV2 account with Hot tier, HTTPS only, TLS 1.2 or later, shared-key access disabled, anonymous blob access disabled, and hierarchical namespace disabled.

Foundry provisioning creates these supporting resources and assigns their required permissions automatically, which requires your account has either of these role combinations on your subscription:

Please note that The Foundry account, the AKS cluster, and the storage account must be in the same Azure subscription, and the AKS cluster must be in the same region as the Foundry account. Apply the selected role configuration at the scope of that subscription.

For the full Azure RBAC matrix covering IT administrator onboarding options (broad and least-privilege pre-provisioned roles) and runtime role assignments for the hosting, workload, and AKS kubelet managed identities, see Hosted agents on your own AKS cluster (preview) in the Administrator guide.

Plan for model access

The sample's agent instance identity needs model access on the Foundry account that hosts gpt-oss-120b. The Cognitive Services OpenAI User role at the account scope is sufficient.

Deployment creates the agent instance identity. It's separate from the hosting management identity and the workload identity used for session snapshots. Make sure an authorized administrator can assign the role after deployment.

Next step

After you prepare the prerequisites, continue to Quickstart: Deploy a hosted agent to AKS.