Fix azure-prepare to use azd init --from-code for .NET Aspire projects#957
Fix azure-prepare to use azd init --from-code for .NET Aspire projects#957
Conversation
Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com>
Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com>
Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com>
Test Report: agent-metadata-2026-02-21T00-07-18-573ZDate: 2026-02-21 📝 Test Prompt📊 Result Summary
🎯 Confidence LevelOverall Confidence: 🟢 HIGH (85%)
Confidence Indicators:
|
| Category | Count | Why It Didn't Matter |
|---|---|---|
| Tool Errors | 3 | Failed reads/searches for non-critical paths; agent adapted successfully |
| Version Warnings | 4 | azd version outdated warning; functionality unaffected |
Warning Details
Tool Errors (Path Not Found)
Why it didn't block success: Agent successfully adapted by using alternative approaches to gather required information.
Cannot find path 'Program.cs'- Agent found AppHost.cs insteadPath does not existfor functions.module.bicep - Agent found alternative pathserror: Parent directory does not exist- Agent created directory and retried successfully
Version Warnings
Why it didn't block success: azd 1.23.3 has all required functionality; 1.23.5 update is cosmetic.
WARNING: your version of azd is out of date, you have 1.23.3 and the latest version is 1.23.5- ...and 3 more
🎯 Success Artifacts
📄 Generated Files & Reports
| Path | Type | Skill |
|---|---|---|
.azure/plan.md |
Deployment Plan | azure-prepare |
samples/aspire-with-azure-functions/azure.yaml |
AZD Configuration | azure-prepare |
samples/aspire-with-azure-functions/infra/main.bicep |
Infrastructure (Bicep) | azure-prepare |
samples/aspire-with-azure-functions/infra/main.parameters.json |
Parameters | azure-prepare |
samples/aspire-with-azure-functions/infra/storage/storage.module.bicep |
Storage Module | azure-prepare |
samples/aspire-with-azure-functions/infra/env/env.module.bicep |
Environment Module | azure-prepare |
samples/aspire-with-azure-functions/infra/env-acr/env-acr.module.bicep |
ACR Module | azure-prepare |
samples/aspire-with-azure-functions/.azure/imagegallery-prod/.env |
Environment Config | azure-prepare |
🔧 Configuration Applied
| Setting | Value | Status |
|---|---|---|
| Azure Region | eastus2 | ✅ |
| Environment Name | imagegallery-prod | ✅ |
| Storage SKU | Standard_LRS | ✅ (optimized) |
| Container Registry SKU | Basic | ✅ |
| Deployment Approach | AZD + Aspire | ✅ |
🎯 Skills Invoked
| Skill | Type | Category |
|---|---|---|
azure-prepare |
Custom | Azure Deployment |
🔧 Tools Invoked
| Tool | Count | Actions |
|---|---|---|
powershell |
15x | Directory navigation, azd commands, file checks, environment configuration |
view |
10x | File/directory inspection, code analysis |
glob |
6x | File pattern matching (*.csproj, *.sln, *.json, etc.) |
create |
2x | Created .azure/plan.md |
edit |
2x | Updated plan status, optimized storage SKU |
report_intent |
2x | "Preparing Azure deployment", "Analyzing application structure" |
azure-subscription_list |
1x | Subscription enumeration |
🔌 Azure MCP Tools Used
| Tool | Type | Category |
|---|---|---|
azure-subscription_list |
MCP | Azure Resource Management |
📈 Token Usage
| Metric | Value |
|---|---|
| Input Tokens | ~8,500 (estimated) |
| Output Tokens | ~3,200 (estimated) |
| Total Tokens | ~11,700 (estimated) |
🔐 Azure Authentication
- Azure CLI: ✅ Authenticated (subscription access verified)
Note: Agent successfully queried subscriptions via MCP tool, confirming active authentication context.
🚀 Further Optimization
Recommended Actions
| Priority | Action | Benefit | Effort |
|---|---|---|---|
| 🟡 Medium | Update azd to 1.23.5 | Remove version warnings | Low (1 command) |
| 🟢 Low | Add explicit subscription parameter | Avoid ambiguity in multi-sub environments | Low |
| 🟢 Low | Pre-validate .NET 10 SDK installation | Catch dependency issues earlier | Low |
Details
-
Update Azure Developer CLI
- Run
winget upgrade Microsoft.Azdto eliminate version warnings - Ensures access to latest features and bug fixes
- Run
-
Explicit Subscription Handling
- Current approach relies on default subscription
- Consider adding
azd env set AZURE_SUBSCRIPTION_ID <id>for clarity - Reduces risk in multi-subscription scenarios
-
Pre-Flight Dependency Check
- Validate .NET 10 SDK before azd init
- Check Docker availability for local testing
- Add to planning phase checklist
📚 Learnings
What Worked
- ✅ Skill invocation pattern correct (azure-prepare for deployment tasks)
- ✅ Plan-first approach successful (created
.azure/plan.mdbefore execution) - ✅ Agent correctly identified .NET Aspire project type
- ✅
azd init --from-codeauto-detected AppHost successfully - ✅ Infrastructure generation and SKU optimization completed
- ✅ Error recovery excellent (adapted to missing files gracefully)
- ✅ Region and environment configuration applied correctly
Areas for Improvement
⚠️ Multiple failed file reads could be avoided with better path handling⚠️ Consider checking azd version before execution⚠️ Subscription confirmation step could be more explicit
Aspire-Specific Learnings
Agent correctly followed Aspire best practices:
- Used
azd init --from-codeinstead of manual azure.yaml creation- Let Aspire AppHost drive infrastructure generation
- Generated Bicep from AppHost definitions
- Avoided common "Could not find infra/main.bicep" error
Generated at 2026-02-21T00:17:47Z
|
Ran it locally as it placed the test inside of azure-prepare which only lets you run all the azure-prepare tests. (Only deploy lets you run by test name) |
🔍 Token Analysis Report
📊 Token Change ReportComparing Summary
Changed Files
📊 Token Limit Check ReportChecked: 391 files
|
| File | Tokens | Limit | Over By |
|---|---|---|---|
.github/skills/file-test-bug/SKILL.md |
613 | 500 | +113 |
.github/skills/sensei/README.md |
3428 | 1000 | +2428 |
.github/skills/sensei/SKILL.md |
1958 | 500 | +1458 |
.github/skills/sensei/references/EXAMPLES.md |
3328 | 1000 | +2328 |
.github/skills/sensei/references/LOOP.md |
3441 | 1000 | +2441 |
.github/skills/sensei/references/SCORING.md |
1690 | 1000 | +690 |
.github/skills/sensei/references/TOKEN-INTEGRATION.md |
1094 | 1000 | +94 |
.github/skills/skill-authoring/SKILL.md |
732 | 500 | +232 |
plugin/skills/appinsights-instrumentation/SKILL.md |
952 | 500 | +452 |
plugin/skills/azure-ai/SKILL.md |
835 | 500 | +335 |
plugin/skills/azure-aigateway/SKILL.md |
6329 | 500 | +5829 |
plugin/skills/azure-compliance/SKILL.md |
1238 | 500 | +738 |
plugin/skills/azure-compliance/references/azqr-recommendations.md |
1447 | 1000 | +447 |
plugin/skills/azure-compliance/references/azqr-remediation-patterns.md |
1987 | 1000 | +987 |
plugin/skills/azure-compliance/references/azure-keyvault-expiration-audit.md |
1286 | 1000 | +286 |
plugin/skills/azure-compliance/references/azure-quick-review.md |
1268 | 1000 | +268 |
plugin/skills/azure-cost-optimization/SKILL.md |
3456 | 500 | +2956 |
plugin/skills/azure-deploy/SKILL.md |
961 | 500 | +461 |
plugin/skills/azure-deploy/references/pre-deploy-checklist.md |
1004 | 1000 | +4 |
plugin/skills/azure-deploy/references/troubleshooting.md |
1123 | 1000 | +123 |
plugin/skills/azure-diagnostics/SKILL.md |
876 | 500 | +376 |
plugin/skills/azure-kusto/SKILL.md |
2167 | 500 | +1667 |
plugin/skills/azure-messaging/SKILL.md |
857 | 500 | +357 |
plugin/skills/azure-messaging/references/service-troubleshooting.md |
1044 | 1000 | +44 |
plugin/skills/azure-observability/SKILL.md |
939 | 500 | +439 |
plugin/skills/azure-postgres/SKILL.md |
1519 | 500 | +1019 |
plugin/skills/azure-postgres/references/entra-rbac-overview.md |
1823 | 1000 | +823 |
plugin/skills/azure-postgres/references/group-sync.md |
1844 | 1000 | +844 |
plugin/skills/azure-postgres/references/permission-templates.md |
1647 | 1000 | +647 |
plugin/skills/azure-postgres/references/troubleshooting.md |
1959 | 1000 | +959 |
plugin/skills/azure-prepare/SKILL.md |
1545 | 500 | +1045 |
plugin/skills/azure-prepare/references/aspire.md |
2675 | 1000 | +1675 |
plugin/skills/azure-prepare/references/azure-context.md |
1019 | 1000 | +19 |
plugin/skills/azure-prepare/references/recipes/azd/aspire.md |
1584 | 1000 | +584 |
plugin/skills/azure-prepare/references/recipes/azd/azure-yaml.md |
1803 | 1000 | +803 |
plugin/skills/azure-prepare/references/recipes/azd/terraform.md |
2924 | 1000 | +1924 |
plugin/skills/azure-prepare/references/research.md |
1600 | 1000 | +600 |
plugin/skills/azure-prepare/references/runtimes/nodejs.md |
1508 | 1000 | +508 |
plugin/skills/azure-prepare/references/security.md |
1784 | 1000 | +784 |
plugin/skills/azure-prepare/references/services/functions/bicep.md |
1896 | 1000 | +896 |
plugin/skills/azure-prepare/references/services/functions/templates/SPEC-composable-templates.md |
6187 | 1000 | +5187 |
plugin/skills/azure-prepare/references/services/functions/templates/recipes/README.md |
1265 | 1000 | +265 |
plugin/skills/azure-prepare/references/services/functions/templates/recipes/common/uami-bindings.md |
1223 | 1000 | +223 |
plugin/skills/azure-prepare/references/services/functions/templates/recipes/composition.md |
3150 | 1000 | +2150 |
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/README.md |
1467 | 1000 | +467 |
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/README.md |
1149 | 1000 | +149 |
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/README.md |
1403 | 1000 | +403 |
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/java.md |
1312 | 1000 | +312 |
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/python.md |
1207 | 1000 | +207 |
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/typescript.md |
1075 | 1000 | +75 |
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/README.md |
1171 | 1000 | +171 |
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/source/dotnet.md |
1227 | 1000 | +227 |
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/source/java.md |
1009 | 1000 | +9 |
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/source/python.md |
1080 | 1000 | +80 |
plugin/skills/azure-prepare/references/services/functions/terraform.md |
2305 | 1000 | +1305 |
plugin/skills/azure-prepare/references/services/service-bus/patterns.md |
1010 | 1000 | +10 |
plugin/skills/azure-resource-lookup/SKILL.md |
1379 | 500 | +879 |
plugin/skills/azure-resource-lookup/references/azure-resource-graph.md |
1307 | 1000 | +307 |
plugin/skills/azure-resource-visualizer/SKILL.md |
2091 | 500 | +1591 |
plugin/skills/azure-storage/SKILL.md |
1092 | 500 | +592 |
plugin/skills/azure-storage/references/sdk-usage.md |
1096 | 1000 | +96 |
plugin/skills/azure-validate/SKILL.md |
734 | 500 | +234 |
plugin/skills/entra-app-registration/SKILL.md |
2055 | 500 | +1555 |
plugin/skills/entra-app-registration/references/api-permissions.md |
2545 | 1000 | +1545 |
plugin/skills/entra-app-registration/references/cli-commands.md |
2211 | 1000 | +1211 |
plugin/skills/entra-app-registration/references/console-app-example.md |
2752 | 1000 | +1752 |
plugin/skills/entra-app-registration/references/first-app-registration.md |
1846 | 1000 | +846 |
plugin/skills/entra-app-registration/references/oauth-flows.md |
2375 | 1000 | +1375 |
plugin/skills/entra-app-registration/references/troubleshooting.md |
1896 | 1000 | +896 |
plugin/skills/microsoft-foundry/SKILL.md |
1912 | 500 | +1412 |
plugin/skills/microsoft-foundry/foundry-agent/create/agent-framework/SKILL.md |
1671 | 500 | +1171 |
plugin/skills/microsoft-foundry/foundry-agent/create/agent-framework/references/debug-setup.md |
1689 | 1000 | +689 |
plugin/skills/microsoft-foundry/foundry-agent/deploy/deploy.md |
3295 | 1000 | +2295 |
plugin/skills/microsoft-foundry/foundry-agent/invoke/invoke.md |
1273 | 1000 | +273 |
plugin/skills/microsoft-foundry/foundry-agent/troubleshoot/troubleshoot.md |
1299 | 1000 | +299 |
plugin/skills/microsoft-foundry/models/deploy-model/SKILL.md |
1627 | 500 | +1127 |
plugin/skills/microsoft-foundry/models/deploy-model/capacity/SKILL.md |
1725 | 500 | +1225 |
plugin/skills/microsoft-foundry/models/deploy-model/customize/SKILL.md |
2220 | 500 | +1720 |
plugin/skills/microsoft-foundry/models/deploy-model/customize/references/customize-workflow.md |
1859 | 1000 | +859 |
plugin/skills/microsoft-foundry/models/deploy-model/preset/SKILL.md |
1212 | 500 | +712 |
plugin/skills/microsoft-foundry/models/deploy-model/preset/references/preset-workflow.md |
4252 | 1000 | +3252 |
plugin/skills/microsoft-foundry/models/deploy-model/preset/references/workflow.md |
1315 | 1000 | +315 |
plugin/skills/microsoft-foundry/project/create/create-foundry-project.md |
1218 | 1000 | +218 |
plugin/skills/microsoft-foundry/quota/references/ptu-guide.md |
1473 | 1000 | +473 |
plugin/skills/microsoft-foundry/quota/references/troubleshooting.md |
1807 | 1000 | +807 |
plugin/skills/microsoft-foundry/quota/references/workflows.md |
1614 | 1000 | +614 |
plugin/skills/microsoft-foundry/rbac/rbac.md |
1752 | 1000 | +752 |
plugin/skills/microsoft-foundry/references/sdk/foundry-sdk-py.md |
1888 | 1000 | +888 |
plugin/skills/microsoft-foundry/resource/create/create-foundry-resource.md |
1489 | 1000 | +489 |
plugin/skills/microsoft-foundry/resource/create/references/workflows.md |
1637 | 1000 | +637 |
.github/agents/SkillCreator.agent.md |
1044 | 1000 | +44 |
Consider moving content to
references/subdirectories.
Automated token analysis. See skill authoring guidelines for best practices.
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical issue in the azure-prepare skill where .NET Aspire projects were having azure.yaml files manually generated with only name and metadata fields, missing the essential services section. This caused "Could not find infra\main.bicep" errors during deployment, since Aspire projects auto-generate infrastructure from the AppHost and require proper service definitions in azure.yaml.
Changes:
- Added dedicated Aspire detection and workflow guidance with clear DO/DON'T examples
- Enhanced detection patterns using
findandgrepcommands for AppHost project identification - Added test utilities (
hasServicesSection,getServiceProject) to validate azure.yaml structure - Added integration test for aspire-with-azure-functions sample to verify correct azure.yaml generation
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/azure-prepare/utils.ts | Added utility functions to validate azure.yaml has services section and extract service project paths |
| tests/azure-prepare/integration.test.ts | Added integration test to verify Aspire projects generate azure.yaml with services section |
| plugin/skills/azure-prepare/references/recipes/azd/azure-yaml.md | Added critical warning to check for Aspire projects before manual azure.yaml creation |
| plugin/skills/azure-prepare/references/recipes/azd/aspire.md | Comprehensive rewrite with detection patterns, correct workflow, and troubleshooting guidance |
| plugin/skills/azure-prepare/references/recipe-selection.md | Added special cases section highlighting Aspire detection as first step |
| plugin/skills/azure-prepare/references/generate.md | Added mandatory Aspire detection check at top of generation workflow |
| plugin/skills/azure-prepare/references/aspire.md | Added critical warnings and references to detailed workflow documentation |
microsoft#957) * Initial plan * Add prominent Aspire warnings and dedicated recipe guide Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com> * Add test to verify azure.yaml services section for Aspire Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com> * Optimize aspire.md token count to meet limits Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kvenkatrajan <102772054+kvenkatrajan@users.noreply.github.com> Co-authored-by: Juan Ospina <70209456+jeo02@users.noreply.github.com>
The skill was manually generating
azure.yamlfiles for Aspire projects with onlyname/metadatafields, missing theservicessection. This caused "Could not find infra\main.bicep" errors since Aspire auto-generates infrastructure from the AppHost.Changes
recipes/azd/aspire.md) - Shows correct vs incorrect approach with detection patternsgenerate.md) - Makes Aspire check mandatory first step with grep/find commandsazure-yaml.md,recipe-selection.md,aspire.md)hasServicesSection()andgetServiceProject()to validate azure.yaml structureDetection Pattern
Before/After
Before (manual creation):
After (azd init --from-code):
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
centralus-2.in.applicationinsights.azure.com/home/REDACTED/.npm/_npx/6027471c64e54353/node_modules/@azure/mcp-linux-x64/dist/azmcp /home/REDACTED/.npm/_npx/6027471c64e54353/node_modules/@azure/mcp-linux-x64/dist/azmcp server start(dns block)https://api.github.com/user/home/REDACTED/work/GitHub-Copilot-for-Azure/GitHub-Copilot-for-Azure/tests/node_modules/@github/copilot-linux-x64/copilot /home/REDACTED/work/GitHub-Copilot-for-Azure/GitHub-Copilot-for-Azure/tests/node_modules/@github/copilot-linux-x64/copilot --headless --log-level error --stdio(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.