microsoft / microsoft/GitHub-Copilot-for-Azure
Replace azure-deploy skill Container Apps two-phase image deployment 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 **Container Apps two-phase image deployment** in the `azure-deploy` skill — capture infrastructure outputs, build the image in ACR, link the registry via managed identity, then update the Container App. The sequence already ships as parallel bash and PowerShell.
## Candidate description
For Container Apps deployments the skill runs a fixed, linear command chain with no branching:
1. Capture four values via `terraform output -raw` (`acr_name`, `acr_login_server`, `container_app_name`, `resource_group_name`).
2. `az acr build --registry --image : .` — build the image.
3. `az containerapp registry set --identity system ...` — link the registry using the system-assigned managed identity.
4. `az containerapp update --image /: ...` — roll out the new image.
This is a strong script candidate because it is:
- **Already shipped as twin bash + PowerShell blocks**, i.e. effectively an un-extracted script.
- **A fixed, ordered chain** — capture outputs, then four `az` calls in sequence; nothing to decide while running.
- **Output-reducing** — the captured `terraform output -raw` values feed straight into the next commands; a script wraps the whole flow into one call that reports "built image X, linked registry Y via managed identity, updated app Z."
- **Partially echoed** — the `az containerapp update --image` tail of the same flow also appears in `recipes/azcli/README.md`.
**Sketch — `deploy-containerapp-image.{sh,ps1}`:**
- **Input:** `--acr-name`, `--app-name`, `--resource-group`, `--image-tag` (or `--from-terraform-output` to capture all four automatically).
- **Output:** a summary of the built image reference, the registry-identity link, and the updated revision.
> The RBAC-propagation caveat (step 2 can fail until the `AcrPull` assignment propagates, 1–5 min) is interpreted in prose — the mechanical wait/retry can be scripted, but the decision to proceed vs. abort stays with the agent/user. (See also the AcrPull RBAC propagation health-check candidate.)
## Affected file and lines
- [`references/recipes/terraform/README.md` — Container Apps two-phase deployment (L70–L112)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/azure-deploy/references/recipes/terraform/README.md#L70-L112)
- [`references/recipes/azcli/README.md` — containerapp image update tail (L48–L53)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/azure-deploy/references/recipes/azcli/README.md#L48-L53)
## 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.