existing model deployments can show a warning on quota during provision
- Dominant language
- Go
- Stars
- 569
- Forks
- 364
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 136
Description
## Goal
## Context
Copilot investigation:
```
Why the quota warning appears for existing deployments
The preflight quota check in bicep_provider.go:2572-2736 has a double-counting bug for existing deployments:
1. Azure's quota API returns remaining = Limit - CurrentValue, where CurrentValue already includes capacity consumed by your existing deployment (~1425 units of gpt-4.1-mini).
2. The preflight check extracts deployments from the compiled ARM template and sums up their requested capacity (1425).
3. It compares: remaining (562) < requested (1425) → warning!
The problem is that since the deployment already exists, its 1425 capacity is already counted in CurrentValue. The Bicep deployment is an idempotent PUT — it won't allocate additional capacity. The check treats the full template capacity as new demand, but it's
actually already allocated.
In short: remaining=562 is low precisely because the existing deployment already consumed 1425 of the quota. The check should subtract existing deployment capacity that the template is re-declaring, but it doesn't.
The fix would be to query existing deployments on the cognitive account and exclude their already-allocated capacity from the "requested" total when the template is re-declaring the same deployment.
```
## Current Behavior
## Desired Behavior
When using an existing deployment, provision doesnt do anything or produce any warnings.
## Implementation Notes
Consider any impact to the infra templates used: https://github.com/Azure-Samples/azd-ai-starter-basic/tree/main/infra
## Acceptance Criteria
- [ ] Unit tests added or updated
- [ ] Existing test suite passes
- [ ] Lint or format passes
Contributor guide
Assessment
This issue has not been assessed yet.