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:
azd init -t Azure-Samples/azd-ai-starter-basic with environment name calculator-new
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
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:
azd init -t Azure-Samples/azd-ai-starter-basic with environment name calculator-existing
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"
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.
azd down
- azd finds the resource group
rg-calculator-new has the tag azd-env-name with value calculator-existing and prompts for deletion:
There are some opportunities to improve the
azd downexperience for existing project scenarios (usingazd ai agent initwith--project-idflag). Here are a set of repro steps highlighting one issue:Part 1 - In
/workspaces/calculator-new:azd init -t Azure-Samples/azd-ai-starter-basicwith environment namecalculator-newazd 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.yamlazd upThis creates a resource group
rg-calculator-newwith following resources:/subscriptions/sub-a/resourceGroups/rg-calculator-new/providers/Microsoft.CognitiveServices/accounts/ai-account-qunquemu56q76/projects/ai-project-calculator-newcrqunquemu56q76.azurecr.ioBoth 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:azd init -t Azure-Samples/azd-ai-starter-basicwith environment namecalculator-existingazd 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-newand choose existing model deployment..azure/calculator-existing/.env:azd uprg-calculator-existingresource group created either, asAZURE_RESOURCE_GROUPwas set torg-calculator-newin the previous step.azd-env-nameon therg-calculator-newresource group and its resources gets changed tocalculator-existing.azd downrg-calculator-newhas the tagazd-env-namewith valuecalculator-existingand prompts for deletion: