Skip to content

azure.ai.agents - azd down behavior in existing project scenarios #6215

Description

@JeffreyCA

There are some opportunities to improve the azd down experience for existing project scenarios (using azd ai agent init with --project-id flag). Here are a set of repro steps highlighting one issue:

Part 1 - In /workspaces/calculator-new:

  1. azd init -t Azure-Samples/azd-ai-starter-basic with environment name calculator-new
  2. azd ai agent init -m https://github.com/azure-ai-foundry/foundry-samples/blob/main/samples/microsoft/python/getting-started-agents/hosted-agents/calculator-agent/agent.yaml
  3. azd up

This creates a resource group rg-calculator-new with following resources:

  • AI Foundry account
  • AI Foundry project - /subscriptions/sub-a/resourceGroups/rg-calculator-new/providers/Microsoft.CognitiveServices/accounts/ai-account-qunquemu56q76/projects/ai-project-calculator-new
  • Application Insights
  • Container registry - crqunquemu56q76.azurecr.io
  • Log Analytics workspace

Both the resource group and its child resources have the Azure tag applied: azd-env-name: calculator-new.

Part 2 - In a different directory /workspaces/calculator-existing:

  1. azd init -t Azure-Samples/azd-ai-starter-basic with environment name calculator-existing
  2. azd ai agent init -m https://github.com/azure-ai-foundry/foundry-samples/blob/main/samples/microsoft/python/getting-started-agents/hosted-agents/calculator-agent/agent.yaml --project-id /subscriptions/sub-a/resourceGroups/rg-calculator-new/providers/Microsoft.CognitiveServices/accounts/ai-account-qunquemu56q76/projects/ai-project-calculator-new and choose existing model deployment.
    • This sets the following environment variables in .azure/calculator-existing/.env:
    AZURE_AI_ACCOUNT_NAME="ai-account-qunquemu56q76"
    AZURE_AI_PROJECT_ENDPOINT="https://ai-account-qunquemu56q76.services.ai.azure.com/api/projects/ai-project-calculator-new"
    AZURE_AI_PROJECT_ID="/subscriptions/sub-a/resourceGroups/rg-calculator-new/providers/Microsoft.CognitiveServices/accounts/ai-account-qunquemu56q76/projects/ai-project-calculator-new"
    AZURE_AI_PROJECT_NAME="ai-project-calculator-new"
    AZURE_CONTAINER_REGISTRY_ENDPOINT="crqunquemu56q76.azurecr.io"
    AZURE_ENV_NAME="calculator-existing"
    AZURE_LOCATION="southcentralus"
    AZURE_OPENAI_ENDPOINT="https://ai-account-qunquemu56q76.openai.azure.com/"
    AZURE_RESOURCE_GROUP="rg-calculator-new"
    AZURE_SUBSCRIPTION_ID="sub-a"
    
  3. azd up
    • This doesn't provision any new resources. There is no new rg-calculator-existing resource group created either, as AZURE_RESOURCE_GROUP was set to rg-calculator-new in the previous step.
    • During provision, the tag azd-env-name on the rg-calculator-new resource group and its resources gets changed to calculator-existing.
  4. azd down
    • azd finds the resource group rg-calculator-new has the tag azd-env-name with value calculator-existing and prompts for deletion:
    Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvementext-agentsazure.ai.agents extension

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions