Prerequisites
- An Azure subscription.
- An existing Foundry project. You need the
Foundry Project Managerrole to create a project connection. See Hosted agent permissions reference.
The Foundry RBAC roles were recently renamed. Foundry User, Foundry Owner, Foundry Account Owner, and Foundry Project Manager were previously named Azure AI User, Azure AI Owner, Azure AI Account Owner, and Azure AI Project Manager. You might still see the previous names in some places while the rename rolls out. The role IDs and core permissions are unchanged by the rename.
- Azure CLI, installed and authenticated.
- A Bash-compatible shell.
- Azure Developer CLI, version 1.32.0 or later, installed and authenticated.
-
The Azure Developer CLI Foundry extensions, including
azure.ai.agents1.0.0-beta.13 or later. See Install the Azure Developer CLI Foundry extensions. -
For the Python SDK workflow, Python 3.10 or later and the Azure AI Projects and Azure Identity packages.
- A fully qualified prebuilt image in an authenticated container registry outside Azure or in a self-hosted Docker Distribution registry.
- Permission to configure identity trust and read-only repository access in the registry or its authentication service.
- The registry target, token audience, and token-exchange endpoint from your registry administrator.
Create an Entra application
Create an Entra application to provide the audience value used during token exchange:Configure OIDC for your registry
Configure the registry authentication service to trust the Foundry project managed identity and grant it pull access only to the repository that contains the agent image:-
Set the Foundry project resource ID.
-
Get the project managed identity object ID.
-
Give
PROJECT_PRINCIPAL_IDto your registry administrator. Bind that identity to read-only access for the repository that contains the agent image.
- JFrog Artifactory
- Docker Distribution
In JFrog Artifactory, create an OIDC integration and identity mapping that bind the project managed identity to a group with read-only repository access. Use
/access/api/v1/oidc/token as the token endpoint. Record the JFrog OIDC provider name because the connection sends it to the token endpoint as body.provider_name.Configure the Entra application ID from Step 1 as the JFrog OIDC audience. The audience in the Foundry connection must match the audience in the JFrog OIDC integration.Record these values from your JFrog administrator:Create the registry connection
Create aCustomKeys connection in the same Foundry project that hosts the agent. The connection metadata identifies it as an image registry connection that uses OAuth token exchange.
- Azure Developer CLI
- Bicep
Set the project endpoint. Include the project name in the Create the connection. Choose the command for your registry authentication service.For JFrog Artifactory:For a Docker Distribution authentication adapter:Add a The output identifies a
/api/projects/<project-name> path:body.<field-name> custom key for each extra form field that your adapter requires.Verify the connection without displaying its credentials:CustomKeys connection with the registry target and the registry_connection metadata.Configure private network access
Choose the option that matches your Foundry project network configuration.- Without VNet isolation
- With VNet isolation
When the registry target and token endpoint are available through public HTTPS endpoints, you don’t need to configure extra registry networking.
Create and deploy the agent
Create and deploy the hosted agent from the prebuilt private registry image.- Azure Developer CLI
- Python SDK
Initialize a hosted agent project with the fully qualified image and the connection name. The connection must already exist in the selected project.Review the generated An existing connection doesn’t belong in the
azure.yaml. Keep the azure.ai.project service and the agent’s uses relationship. The agent service must include the prebuilt image, docker.imagePassthrough: true, and the registry connection name:uses list. The registryConnectionId value can be the connection’s Foundry name or resource ID.If the agent requires runtime configuration, store nonsecret values in the active azd environment and reference them from the agent service’s env map. Don’t store secrets directly in azure.yaml. See Configure environment variables for a hosted agent.Deploy the agent:Verify and invoke the agent
Wait for the hosted agent to become active, and then send a test request.- Azure Developer CLI
- Python SDK
Check the agent status:Wait for the status to change to Active, and then invoke the agent: