Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
Use this guide to manually create the following supporting resources for Foundry hosted agents on AKS.
| 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. |
If your account can't create the supporting resources or assign their required roles, ask your subscription administrator to prepare the resources and permissions listed in the preceding table and provide the resource IDs. Your account still needs permission to provision the Foundry account.
1. Update the hosting configuration
In azure.yaml, add the three supporting-resource properties under services.ai-project.agentHosting. Keep the existing clusterResourceId property:
services:
ai-project:
host: azure.ai.project
agentHosting:
clusterResourceId: ${AKS_RESOURCE_ID}
hostingManagementIdentityResourceId: ${HOSTING_IDENTITY_RESOURCE_ID}
storageAccountResourceId: ${STORAGE_ACCOUNT_RESOURCE_ID}
workloadIdentityResourceId: ${WORKLOAD_IDENTITY_RESOURCE_ID}
This is a partial configuration example. Preserve the other properties and services in the file.
2. Configure the environment
Use the resource IDs supplied by your administrator.
PowerShell
$env:AKS_RESOURCE_ID = "<aks-resource-id>"
$env:AZURE_RESOURCE_GROUP = "<foundry-resource-group-name>"
$env:AZURE_SUBSCRIPTION_ID = "<approved-subscription-id>"
$env:AZURE_LOCATION = "<foundry-location>"
$env:HOSTING_IDENTITY_RESOURCE_ID = "<hosting-managed-identity-resource-id>"
$env:STORAGE_ACCOUNT_RESOURCE_ID = "<storage-account-resource-id>"
$env:WORKLOAD_IDENTITY_RESOURCE_ID = "<workload-managed-identity-resource-id>"
azd env set AKS_RESOURCE_ID "$env:AKS_RESOURCE_ID"
azd env set AZURE_RESOURCE_GROUP "$env:AZURE_RESOURCE_GROUP"
azd env set AZURE_SUBSCRIPTION_ID "$env:AZURE_SUBSCRIPTION_ID"
azd env set AZURE_LOCATION "$env:AZURE_LOCATION"
azd env set HOSTING_IDENTITY_RESOURCE_ID "$env:HOSTING_IDENTITY_RESOURCE_ID"
azd env set STORAGE_ACCOUNT_RESOURCE_ID "$env:STORAGE_ACCOUNT_RESOURCE_ID"
azd env set WORKLOAD_IDENTITY_RESOURCE_ID "$env:WORKLOAD_IDENTITY_RESOURCE_ID"
Bash
export AKS_RESOURCE_ID="<aks-resource-id>"
export AZURE_RESOURCE_GROUP="<foundry-resource-group-name>"
export AZURE_SUBSCRIPTION_ID="<approved-subscription-id>"
export AZURE_LOCATION="<foundry-location>"
export HOSTING_IDENTITY_RESOURCE_ID="<hosting-managed-identity-resource-id>"
export STORAGE_ACCOUNT_RESOURCE_ID="<storage-account-resource-id>"
export WORKLOAD_IDENTITY_RESOURCE_ID="<workload-managed-identity-resource-id>"
azd env set AKS_RESOURCE_ID "$AKS_RESOURCE_ID"
azd env set AZURE_RESOURCE_GROUP "$AZURE_RESOURCE_GROUP"
azd env set AZURE_SUBSCRIPTION_ID "$AZURE_SUBSCRIPTION_ID"
azd env set AZURE_LOCATION "$AZURE_LOCATION"
azd env set HOSTING_IDENTITY_RESOURCE_ID "$HOSTING_IDENTITY_RESOURCE_ID"
azd env set STORAGE_ACCOUNT_RESOURCE_ID "$STORAGE_ACCOUNT_RESOURCE_ID"
azd env set WORKLOAD_IDENTITY_RESOURCE_ID "$WORKLOAD_IDENTITY_RESOURCE_ID"
If you use your own container registry, enable reuse by setting the process environment
variable. Run subsequent azd commands in the same terminal session.
$env:AZD_ALPHA_ENABLE_FOUNDRY_ACR_REUSE = "true"
3. Provision Foundry
Provisioning uses the supplied supporting resources instead of creating replacements.
Enable the preview feature for hosted agents on your own AKS cluster by setting the environment variable in your shell. Don't use azd env set for this flag.
PowerShell
$env:AZD_ALPHA_ENABLE_AGENTS_BYO_AKS = "true"
Bash
export AZD_ALPHA_ENABLE_AGENTS_BYO_AKS=true
Run azd provision in the same shell.
PowerShell / Bash
azd provision