microsoft / microsoft/GitHub-Copilot-for-Azure
Replace azure-deploy skill missing container registry variable population 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 **missing container-registry variable population** in the `azure-deploy` skill — query ACR and the managed identity, then feed each result into `azd env set` for a fixed set of variables. The flow appears in two files.
## Candidate description
When a .NET Aspire / Container Apps deployment is in "limited mode" because its registry variables are unset, the skill repopulates them with a deterministic query-then-set sequence:
1. `az acr list -g --query "[0].loginServer" -o tsv` → `azd env set AZURE_CONTAINER_REGISTRY_ENDPOINT `
2. `az identity list -g --query "[0].id" -o tsv` → `azd env set AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID `
3. `az identity list -g --query "[0].clientId" -o tsv` → `azd env set MANAGED_IDENTITY_CLIENT_ID `
This is a strong script candidate because it is:
- **Already shipped as parallel bash _and_ PowerShell**, proving the logic is mechanical.
- **A fixed get-then-set loop** over three known variable names — the only input is the resource-group name; no branching to run.
- **Output-reducing** — each `az ... list` call returns a full object, but only one field is needed; the script extracts and sets in one step, far more reliably than the agent chaining three command substitutions correctly.
- **Duplicated** — the same three-variable population appears in both `references/troubleshooting.md` and `recipes/azd/errors.md`.
**Sketch — `populate-acr-env.{sh,ps1}`:**
- **Input:** `--resource-group` (default `rg-`).
- **Output:** a summary listing which variables were set to which values, so the agent knows the env is now complete without re-querying.
> Diagnosing that the app is in Aspire "limited mode" in the first place is the judgment call and stays in prose; the remediation is mechanical.
**Note — cross-skill overlap:** This is the same *query-Azure-then-`azd env set`* pattern already tracked for the `azure-prepare` skill (#2500) and the `azure-validate` skill (#2504). The three skills may be able to share the same script family rather than each authoring its own.
## Affected file and lines
- [`references/troubleshooting.md` — .NET Aspire limited mode env-var population (L151–L175)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/azure-deploy/references/troubleshooting.md#L151-L175)
- [`references/recipes/azd/errors.md` — Missing Container Registry Variables (L197–L226)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/azure-deploy/references/recipes/azd/errors.md#L197-L226)
## 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.