microsoft / microsoft/GitHub-Copilot-for-Azure
Replace microsoft-foundry skill model deploy-and-poll 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 **model deploy-and-poll** sequence in the `microsoft-foundry` skill's deploy-model area — a fixed `deployment create` → poll `provisioningState` until terminal → fetch endpoint → display chain, reimplemented in three files.
## Candidate description
To deploy a model and confirm it is ready, the skill runs a deterministic chain:
1. `az cognitiveservices account deployment create ...`.
2. Loop `az cognitiveservices account deployment show --query properties.provisioningState` until `Succeeded`/`Failed`, with a 5-minute timeout (`MAX_WAIT=300`, `INTERVAL=10`).
3. `az cognitiveservices account show --query properties.endpoint` to fetch the endpoint.
4. Print a formatted deployment summary.
This is a strong script candidate because it is:
- **A textbook poll-until-terminal-state pattern** — an explicit, repeated wait loop with a fixed timeout.
- **Output-reducing** — `deployment show` returns a large object, but only `provisioningState` (then `properties.model`) matters during polling.
- **Duplicated across three files** (`preset-workflow.md`, `workflow.md`, `customize-workflow.md`), with the troubleshooting `deployment show/list` / `usage list` / `deployment delete` block in `customize/SKILL.md` L123–L137.
**Sketch — `deploy-and-wait.{sh,ps1}`:**
- **Input:** `--account`, `--resource-group`, `--deployment-name`, `--model`, `--sku`, `--capacity`, `--timeout` (default 300).
- **Output:** terminal `provisioningState`, the resolved endpoint, and a labeled summary; on failure, the failure reason.
> Deciding **whether** to deploy (the review/confirm gate) stays in prose and is passed to the script as resolved parameters. The script handles only the mechanical create → poll → report.
**Note — cross-area overlap:** This deploy+poll loop is the same archetype as the fine-tuned-model deploy/verify loop and the resource deployment monitor in this skill; the three may share one deploy-and-wait helper family.
## Affected file and lines
- [`models/deploy-model/preset/references/preset-workflow.md` — deploy + poll + endpoint (L369–L694)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/microsoft-foundry/models/deploy-model/preset/references/preset-workflow.md#L369-L694)
- [`models/deploy-model/preset/references/workflow.md` — condensed deploy + poll (L144–L174)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/microsoft-foundry/models/deploy-model/preset/references/workflow.md#L144-L174)
- [`models/deploy-model/customize/references/customize-workflow.md` — deploy + monitor + endpoint (L309–L410)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/microsoft-foundry/models/deploy-model/customize/references/customize-workflow.md#L309-L410)
- [`models/deploy-model/customize/SKILL.md` — show/list/usage/delete troubleshooting (L123–L137)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/microsoft-foundry/models/deploy-model/customize/SKILL.md#L123-L137)
## 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.