Skip to content

azd ai agent init selects a stale ACR connection without validating the registry #9224

Description

@hund030

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

  1. Use an existing Foundry project with a ContainerRegistry connection whose ACR has been deleted.

  2. Run:

    azd ai agent init -m <manifest> --project-id <project-resource-id> --deploy-mode container
  3. Run:

    azd up

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions