microsoft / microsoft/GitHub-Copilot-for-Azure
Replace microsoft-foundry skill regional quota usage probe with a script
- Dominant language
- Python
- Stars
- 250
- Forks
- 204
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 67
Description
## Summary
Copilot has identified a portion of a skill that is a good candidate for replacement with a script.
The candidate is the **regional quota usage probe** in the `microsoft-foundry` skill (`quota/`) — a fixed `az rest .../usages` query plus an `Available = limit − currentValue` projection that is repeated nearly verbatim a dozen times across five files.
## Candidate description
To answer "how much quota is left for model X in region Y", the skill runs the same deterministic three-part sequence:
1. `az account show` to get the subscription ID.
2. `az rest --method GET .../Microsoft.CognitiveServices/locations//usages` to fetch usage.
3. A JMESPath projection computing `Available:(limit - currentValue)`, varying only the model filter (`contains(name.value,'OpenAI')` vs `name.value=='OpenAI.Standard.gpt-4o'` vs `ProvisionedManaged`) and the displayed columns.
This is a strong script candidate because it is:
- **Repeated ~12 times across five files** with only the region/model/SKU and the displayed columns changing — the textbook gather-and-compute duplication signal.
- **Branch-free** — no decision logic in the query itself.
- **Output-reducing** — the raw `usages` JSON is large; only Model / Used / Limit / Available matter.
**Sketch — `get-foundry-quota.{sh,ps1}`:**
- **Input:** `--region`, `--model-filter` (optional), `--sku` (optional).
- **Output:** a self-describing table (Model / Used / Limit / Available) for the region, with the subscription resolved automatically.
> Choosing the region/model to ask about and interpreting the result ("Available = 0 → delete a deployment or try a different region") stay in prose. The script handles only the mechanical query + Available computation.
**Note — cross-skill overlap:** This probe is almost certainly duplicated in the separate `azure-quotas` skill. Any script built here should be designed as a shared asset (or explicitly reconciled with `azure-quotas`) rather than a quota-skill-private helper, to avoid two near-identical scripts.
## Affected file and lines
- [`quota/quota.md` — usage probe + Available projection (L49–L110)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/microsoft-foundry/quota/quota.md#L49-L110)
- [`quota/references/workflows.md` — same probe (L63–L72)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/microsoft-foundry/quota/references/workflows.md#L63-L72)
- [`quota/references/troubleshooting.md` — same probe (L25–L31)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/microsoft-foundry/quota/references/troubleshooting.md#L25-L31)
- [`quota/references/error-resolution.md` — same probe (L87–L91)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/microsoft-foundry/quota/references/error-resolution.md#L87-L91)
- [`quota/references/optimization.md` — same probe (L13–L20)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/microsoft-foundry/quota/references/optimization.md#L13-L20)
## Next steps
1. **Evaluate the candidate** — confirm the steps are stable and parameterizable, and that the script captures everything the skill needs.
2. **Create both a bash _and_ a PowerShell version** of the script so the skill works across platforms.
3. **Run integration tests** to verify the scripts behave correctly and the skill still completes end-to-end.
## Background Information
### Why replace regular steps with scripts
Replacing a regular, well-defined series of steps with a script can:
- **Reduce token usage** — the skill no longer needs to spell out each command and parse large command output inline; the agent invokes one script and reads a compact result.
- **Improve reliability** — the logic is written and tested once, instead of being re-derived by the agent on every run.
- **Improve determinism** — the same inputs always produce the same steps and output, removing run-to-run variation.
- **Improve speed of execution** — a single script call replaces multiple round-trips of command generation, execution, and large-output parsing.
### Authoring notes for the scripts
- **Reference scripts with markdown links**, not just a bare path to the script file.
- **Include examples** in the skill showing how to run each script (sample invocation with arguments).
- **Briefly explain what each script does** where it is referenced.
- **The script output should explain what it did**, so the agent and user can understand the result without re-inspecting raw command output.
Contributor guide
Assessment
This issue has not been assessed yet.