Your subscription has insufficient quota for this resource when creating a new environment and trying to provision hosted agent
- Dominant language
- Go
- Stars
- 569
- Forks
- 364
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 136
Description
## Goal
Run an agent in a different subscription, region, model, etc.
## Context
The `init` flow guides you through selection of a subscription, region, and defaults new resource group, and allows you to pick a model or deploy a new one. However, `azd env new` creates a new environment and doesn't guide you through selecting all the necessary configs like `init` does which can result in errors.
## Current Behavior
I started a new project with `init` and picked my subscription, region, model, etc. That worked.
Then I need to test it in another subscription, region, etc. so I created a new env with `azd env new `. I ran `azd up` and it asks me to pick my subscription and region - but it does not have me go through the same flow of verifying the model / quota is still valid in that new selection so I end up with:
```
(x) Failed: Validating deployment
ERROR: Your subscription has insufficient quota for this resource.
Suggestion: Check current usage with 'az vm list-usage --location ' or request a quota increase in the Azure portal.
• Increase Azure subscription quotas
error executing step command 'provision': deployment failed: error deploying infrastructure: validating deployment to subscription:
Validation Error Details:
InvalidTemplateDeployment: The template deployment '' is not valid according to the validation procedure. The tracking id is '317d1c7e-fb7f-4c52-915b-6a8195232acd'. See inner errors for details.
InsufficientQuota: Insufficient quota. Cannot create/update/move resource 'ai-account-'.
```
## Desired Behavior
I would be prompted and able to provide new values for the other options like a model too. However, we currently put that in the `deployment` section of the azure.yaml, so its not a per-environment setting.
## Implementation Notes (optional but powerful)
To make this per-environment, follow the advice below: "write the deployment section of azure.yaml using expandable_string (which can be mapped to env vars) and write the values to the azd env. That way, in a new env, you would re-prompt for the values".
## Acceptance Criteria
- [ ] Unit tests added or updated
- [ ] Existing test suite passes
- [ ] Lint or format passes
## How to Test
1. `azd ai agent init -m "https://[raw.githubusercontent.com/microsoft-foundry/foundry-samples/refs/heads/main/samples/python/hosted-agents/agent-framework/echo-agent/agent.yaml](https://raw.githubusercontent.com/microsoft-foundry/foundry-samples/refs/heads/main/samples/python/hosted-agents/agent-framework/echo-agent/agent.yaml)"
2. `azd up` - pick a model, etc.
3. `azd env new`
4. `azd up` pick a different model, etc.
Contributor guide
Assessment
This issue has not been assessed yet.