Description
When initializing a hosted container agent against an existing Foundry project, azd ai agent init automatically selects the project's sole ContainerRegistry connection.
The connection target is persisted without verifying that the referenced Azure Container Registry still exists. A stale connection therefore allows init to succeed, but azd up later fails during container publishing.
Reproduction
-
Use an existing Foundry project with a ContainerRegistry connection whose ACR has been deleted.
-
Run:
azd ai agent init -m <manifest> --project-id <project-resource-id> --deploy-mode container
-
Run:
Actual behavior
Init automatically persists the stale connection:
AZURE_AI_PROJECT_ACR_CONNECTION_NAME=acr6d86728b-conn
AZURE_CONTAINER_REGISTRY_ENDPOINT=acr6d86728b.azurecr.io
Publishing later fails because the registry cannot be found:
cannot find registry with name 'acr6d86728b'
The failure may be obscured by the local-build fallback:
failed retrieving package result details
Expected behavior
Before selecting a discovered ACR connection, init should verify that its target exists in the selected subscription.
- Valid connections should remain selectable.
- Stale connections should be skipped.
- If no valid connections remain, init should prompt for another ACR or offer create-on-provision.
- Authorization or ARM service failures should be surfaced rather than treated as a missing registry.
- Stale ACR environment values should be cleared when falling back.
Environment
- azd:
1.28.0
- azure.ai.agents:
1.0.0-beta.6
- Existing Foundry project
- Hosted container deployment
Description
When initializing a hosted container agent against an existing Foundry project,
azd ai agent initautomatically selects the project's soleContainerRegistryconnection.The connection target is persisted without verifying that the referenced Azure Container Registry still exists. A stale connection therefore allows init to succeed, but
azd uplater fails during container publishing.Reproduction
Use an existing Foundry project with a
ContainerRegistryconnection whose ACR has been deleted.Run:
Run:
Actual behavior
Init automatically persists the stale connection:
Publishing later fails because the registry cannot be found:
The failure may be obscured by the local-build fallback:
Expected behavior
Before selecting a discovered ACR connection, init should verify that its target exists in the selected subscription.
Environment
1.28.01.0.0-beta.6