Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Prepare applications for Azure deployment by generating infrastructure code, Dockerfiles, and config files.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/generate.md
1# Artifact Generation23Generate infrastructure and configuration files based on selected recipe.45## ⛔ CRITICAL: Check for .NET Aspire Projects FIRST67**MANDATORY: Before generating any files, detect .NET Aspire projects:**89```bash10# Method 1: Find AppHost project files11find . -name "*.AppHost.csproj" -o -name "*AppHost.csproj"1213# Method 2: Search for Aspire packages14grep -r "Aspire\.Hosting\|Aspire\.AppHost\.Sdk" . --include="*.csproj"15```1617**If Aspire is detected:**181. ⛔ **STOP** - Do NOT manually create `azure.yaml`192. ⛔ **STOP** - Do NOT manually create `infra/` files203. ✅ **USE** - `azd init --from-code -e <env-name>` instead214. 📖 **READ** - [aspire.md](aspire.md) and [recipes/azd/aspire.md](recipes/azd/aspire.md) for complete guidance2223**Why this is critical:**24- Aspire AppHost auto-generates infrastructure from code25- Manual `azure.yaml` without `services` section causes "infra\main.bicep not found" error26- `azd init --from-code` correctly detects AppHost and generates proper configuration2728> ⚠️ **Manually creating azure.yaml for Aspire projects is the most common deployment failure.** Always use `azd init --from-code`.2930## Check for Other Special Patterns3132After verifying the project is NOT Aspire, check for these patterns:3334| Pattern | Detection | Action |35|---------|-----------|--------|36| **Complex existing codebase** | Multiple services, existing structure | Consider `azd init --from-code` |37| **Existing azure.yaml** | File already present | MODIFY mode - update existing config |3839> **CRITICAL:** After running `azd init --from-code`, you **MUST** immediately set the user-confirmed subscription with `azd env set AZURE_SUBSCRIPTION_ID <id>`. Do NOT skip this step. See [aspire.md](aspire.md) Step 3 for the complete sequence.4041## CRITICAL: Research Must Be Complete4243**DO NOT generate any files without first completing the [Research Components](research.md) step.**4445The research step loads service-specific references and invokes related skills to gather best practices. Apply all research findings to generated artifacts.4647## Research Checklist48491. ✅ Completed [Research Components](research.md) step502. ✅ Loaded all relevant `services/*.md` references513. ✅ Invoked related skills for specialized guidance524. ✅ Documented findings in `.azure/deployment-plan.md`5354## Generation Order5556| Order | Artifact | Notes |57|-------|----------|-------|58| 1 | Application config (azure.yaml) | AZD only—defines services and hosting |59| 2 | Application code scaffolding | Entry points, health endpoints, config |60| 3 | Dockerfiles | If containerized |61| 4 | Infrastructure (Bicep/Terraform) | IaC templates in `./infra/` |62| 5 | CI/CD pipelines | If requested |6364## Recipe-Specific Generation6566Load the appropriate recipe for detailed generation steps:6768| Recipe | Guide |69|--------|-------|70| AZD | [AZD Recipe](recipes/azd/README.md) |71| AZCLI | [AZCLI Recipe](recipes/azcli/README.md) |72| Bicep | [Bicep Recipe](recipes/bicep/README.md) |73| Terraform | [Terraform Recipe](recipes/terraform/README.md) |7475## Common Standards7677### File Structure7879```80project-root/81├── .azure/82│ └── deployment-plan.md83├── infra/84│ ├── main.bicep (or main.tf)85│ └── modules/86├── src/87│ └── <component>/88│ └── Dockerfile89└── azure.yaml (AZD only)90```9192### Directory Creation9394> ⚠️ **Warning:** The `create` tool fails with `Parent directory does not exist` when intermediate directories are missing. Always create the full directory tree before writing files.9596**Before creating nested files** (e.g., `src/frontend/src/App.jsx`), create all parent directories first:9798```bash99mkdir -p src/frontend/src src/api100```101102- Use **absolute paths** in `mkdir -p` when the working directory may differ from the project root103- Create directories for **all components** in a single command before writing any files104- Do **not** rely on the `create` tool to create parent directories — it will not105106### Security Requirements107108- No hardcoded secrets109- Use Key Vault for sensitive values110- Managed Identity for service auth111- HTTPS only, TLS 1.2+112- SQL Server Bicep MUST use Entra-only auth — omit `administratorLogin` and `administratorLoginPassword` entirely, including from conditional/ternary branches (see [services/sql-database/bicep.md](services/sql-database/bicep.md)). These property names must not appear anywhere in a generated `.bicep` file.113- **SQL + Managed Identity: MUST add postprovision hook** — ARM role assignments only grant control-plane access; you MUST also generate `scripts/grant-sql-access.sh` + `.ps1` and add a `postprovision` hook in `azure.yaml` to run T-SQL grants. See [services/sql-database/bicep.md](services/sql-database/bicep.md).114- **App Service Bicep: MUST include `azd-service-name` tag** — Every App Service `Microsoft.Web/sites` resource MUST have `tags: union(tags, { 'azd-service-name': serviceName })`. Without this tag, `azd deploy` cannot locate the resource. See [services/app-service/bicep.md](services/app-service/bicep.md).115116### Runtime Configuration117118Apply language-specific production settings for containerized apps:119120| Runtime | Reference |121|---------|-----------|122| Node.js/Express | [runtimes/nodejs.md](runtimes/nodejs.md) |123124## After Generation1251261. Update `.azure/deployment-plan.md` with generated file list1272. Run validation checks1283. Proceed to **azure-validate** skill129