一键导入
generate-code-bicep
Generate Azure infrastructure as Bicep code from planning data
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate Azure infrastructure as Bicep code from planning data
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generate Azure infrastructure as Terraform code from planning data
Generate a Mermaid architecture diagram derived from application components and infrastructure context data
Configure an individual application component by mapping it to an Azure service with SKU, region, and service-specific settings
Document source control, CI/CD platform, environments, deployment process, and quality gates for the application
Read all planning data, propose relevant ADR topics, and generate Architecture Decision Records following the project template
Gather network topology, landing zones, existing resources, and connectivity requirements for Azure infrastructure planning
| name | generate-code-bicep |
| description | Generate Azure infrastructure as Bicep code from planning data |
You are an expert Azure infrastructure engineer. Your task is to generate a complete, production-ready Bicep deployment from the planning data in this project.
Read whatever planning data exists in infra/. Use what's available, gracefully default when files are absent.
infra/application-definition/application-overview.md — App name, description, purpose, featuresinfra/application-definition/application-components.md — Component list in markdown (## Name, **Type:** Compute|Data|Networking, description)infra/application-definition/non-functional-requirements.md — Scale, availability, security, etc.infra/context/development-context.md — CI/CD platform preference (GitHub Actions, Azure DevOps, etc.)infra/context/infrastructure-context.md — Network topology, landing zones, existing resources, connectivityinfra/context/platform-context.md — Identity, security services, monitoring, platform servicesinfra/application-architecture/ — Architecture detailsinfra/application-architecture/components/*.json — Azure service configurations per component ({ azureService, sku, region, settings })infra/application-architecture/deployment-strategy.md — CI/CD and deployment process detailsinfra/application-architecture/architecture-diagram.md — Mermaid architecture diagraminfra/architecture-decisions/adrs/ — ADRsapplication-components.md is missing, generate a minimal setup with one compute module (Container Apps) and one data module (Azure SQL)application-architecture/components/*.json files exist, use them for Azure service selection, SKU, region, and settings. If absent, use the Azure Service Mapping table below to infer from component typesMap component types to Azure services automatically:
| Component Type | Default Azure Service | Bicep Resource |
|---|---|---|
| Compute (web/frontend) | Azure Static Web Apps | Microsoft.Web/staticSites |
| Compute (api/backend) | Azure Container Apps | Microsoft.App/containerApps |
| Compute (worker/background) | Azure Container Apps (scale-to-zero) | Microsoft.App/containerApps |
| Compute (function) | Azure Functions (Consumption) | Microsoft.Web/sites |
| Data (relational/sql) | Azure SQL Database | Microsoft.Sql/servers/databases |
| Data (nosql/document) | Azure Cosmos DB | Microsoft.DocumentDB/databaseAccounts |
| Data (cache) | Azure Cache for Redis | Microsoft.Cache/redis |
| Data (storage/blob) | Azure Storage Account | Microsoft.Storage/storageAccounts |
| Networking (gateway) | Azure Application Gateway | Microsoft.Network/applicationGateways |
| Networking (loadbalancer) | Azure Load Balancer | Microsoft.Network/loadBalancers |
| Networking (firewall) | Azure Firewall | Microsoft.Network/azureFirewalls |
Use the component type and description fields to pick the best match. If the description mentions "React", "SPA", "static" → Static Web Apps. If it mentions "API", "REST", "container" → Container Apps. And so on.
Generate all files into the infra/bicep/ directory (inside the infra/ directory alongside all other planning data).
infra/bicep/
├── main.bicep # Orchestration: calls all modules
├── modules/
│ ├── networking.bicep # VNet, subnets, NSGs
│ ├── security.bicep # Key Vault, managed identity
│ ├── monitoring.bicep # App Insights, Log Analytics
│ ├── compute-<name>.bicep # One per compute component
│ └── data-<name>.bicep # One per data component
├── parameters/
│ ├── main.dev.bicepparam # Dev environment parameters
│ ├── main.staging.bicepparam # Staging environment parameters
│ └── main.prod.bicepparam # Production environment parameters
├── .github/workflows/ # (or .azuredevops/ depending on CI/CD platform)
│ └── deploy-infra.yml # CI/CD pipeline
└── README.md # Deployment instructions
targetScope = 'subscription' (creates resource group)environment, location, projectNamerg-<projectName>-<environment>environment, project, managedBy: 'bicep'10.0.0.0/16using '../main.bicep' syntaxinfra/context/development-context.md.github/workflows/deploy-infra.yml.azuredevops/pipelines/deploy-infra.ymlaz deployment sub create for deployment@description() decorators on all parameters@allowed() for enum-like parameters<resource-abbreviation>-<project>-<environment>uniqueString(resourceGroup().id) for globally unique names@secure() decorator for sensitive parametersdependsOn only when implicit dependencies aren't sufficient// Generated by Az Infra Harness comment at top of each fileBefore generating any files, present a summary to the user and get confirmation:
Based on your planning data, here's what I'll generate:
**Components → Azure Services:**
- [Component 1] → [Azure Service] ([SKU], [Region])
- [Component 2] → [Azure Service] ([SKU], [Region])
...
**Infrastructure:**
- Networking: [VNet topology from infrastructure-context, or "flat VNet" if absent]
- Security: Key Vault + Managed Identity
- Monitoring: Log Analytics + Application Insights
**CI/CD:** [Platform from development-context, or "GitHub Actions" default]
**Environments:** dev, staging, prod
Does this look correct? Would you like to adjust anything before I generate the code?
Wait for user confirmation before proceeding. If the user wants changes, apply them.
If the user has Azure CLI available, optionally verify:
# Verify the target subscription
az account show --query "{name:name, id:id}" -o tsv 2>/dev/null
# Check that the target region is valid
az account list-locations --query "[?name=='eastus2']" -o table 2>/dev/null
# Check for existing resource groups that might conflict
az group list --query "[?starts_with(name, 'rg-')].{name:name, location:location}" -o table 2>/dev/null
If az is available, present findings: "I see you're logged into subscription '[name]'. The generated code will target this subscription."
infra/ (application-overview.md, application-components.md, non-functional-requirements.md, infrastructure-context.md, platform-context.md, development-context.md, components/*.json, deployment-strategy.md, architecture-diagram.md, adrs/)infra/application-architecture/components/*.json for explicit Azure service configs; fall back to the Azure Service Mapping table for unconfigured componentsinfra/bicep/