All skills
microsoft avatar

/azure-prepare

@7995851 official

Prepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd) workflow. USE ONLY when the user explicitly wants to use azd as the deployment tool, or the project already has an azure.yaml file. DO NOT USE FOR: non-azd deployments, Python App Service code-only deploys (use python-appservice-deploy), or cross-cloud migration (use azure-cloud-migrate). WHEN: prepare app for azd, create azure.yaml, set up azd infrastructure, modernize app for Azure with azd, deploy with azd, function app, timer trigger, service bus trigger, event-driven function, managed identity, generate Bicep, generate Terraform, create and deploy to Azure.

Use this Skill: https://skilld.dev/gh/microsoft/github-copilot-for-azure/azure-prepare

This session only. Nothing lands on disk.

referencesservicesapp-servicetemplatesrecipescomposition.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Composition Algorithm — REFERENCE ONLY

Step-by-step algorithm for composing a base App Service template with an integration recipe.

This is the authoritative process. Follow it exactly.

Algorithm

INPUT:
  - language:    dotnet | typescript | javascript | python | java
  - scenario:    web-api | web-app
  - integration: none | sql | cosmos | auth | redis
  - iac:         bicep | terraform

OUTPUT:
  - Complete project directory ready for `azd up`

Step 1: Fetch Base Template

# Determine template by scenario + language
IF scenario == 'web-api':
  TEMPLATE = web_api_templates[language]    # See web-api.md
ELSE IF scenario == 'web-app':
  TEMPLATE = web_app_templates[language]    # See web-app.md

# Non-interactive init
ENV_NAME="$(basename "$PWD" | tr '[:upper:]' '[:lower:]' | tr ' _' '-')-dev"
# PowerShell: $ENV_NAME = "$(Split-Path -Leaf (Get-Location) | ForEach-Object { $_.ToLower() -replace '[ _]','-' })-dev"
azd init -t $TEMPLATE -e "$ENV_NAME" --no-prompt

Step 2: Check if Recipe Needed

IF integration IN [none]:
  → DONE. Base template is complete.

IF integration IN [sql, cosmos, redis, auth]:
  → Full recipe. Continue to Step 3.

Step 3: Add IaC Module (for full recipes only)

Bicep:

  1. Read recipe's README.md for the Bicep module file
  2. Copy module into infra/app/
  3. Add module reference in infra/main.bicep:
    module sqlServer './app/sql.bicep' = {
      name: 'sqlServer'
      scope: rg
      params: {
        name: name
        location: location
        tags: tags
        appServicePrincipalId: web.outputs.SERVICE_WEB_IDENTITY_PRINCIPAL_ID
      }
    }
  4. If VNET_ENABLED, add the network module for private endpoints

Terraform:

  1. Copy recipe .tf files into infra/
  2. Merge app settings into web app resource block
  3. Networking uses count = var.vnet_enabled ? 1 : 0

Step 4: Add App Settings

Read the recipe's README.md for required app settings. Add them to the web app config.

CRITICAL: Managed Identity Configuration

For service bindings, prefer User Assigned Managed Identity (UAMI). Always include connection settings that reference managed identity, not passwords:

⚠️ Connection-string format is language-specific. The example below is .NET / ADO.NET format. For other stacks, use the per-language env vars documented in recipes/sql/source/{language}.md:

Language Env var(s) Format
.NET AZURE_SQL_CONNECTION_STRING Server=...;Authentication=Active Directory Managed Identity;User Id=<clientId>; (ADO.NET)
Python AZURE_SQL_SERVER, AZURE_SQL_DATABASE, AZURE_CLIENT_ID Code obtains MI access token and passes via ODBC attrs_before
Node.js DATABASE_URL sqlserver://<host>:1433;database=<db>;authentication=ActiveDirectoryMsi;clientId=<clientId> (Prisma)
appSettings: [
  { name: 'AZURE_SQL_CONNECTION_STRING', value: 'Server=${sqlServer.properties.fullyQualifiedDomainName};Database=${dbName};Authentication=Active Directory Managed Identity;User Id=${managedIdentity.properties.clientId};' }
]

Step 5: Add Source Code Integration

  1. Read recipes/{integration}/source/{language}.md
  2. Add the integration code (service client, middleware, configuration)
  3. Add package dependencies (NuGet, npm, pip, Maven)

⛔ Do NOT replace the main entry point file (Program.cs, app.py, index.js). Recipes ADD integration code alongside the existing application code.

Step 6: Update azure.yaml (if needed)

Some recipes require hooks:

hooks:
  postprovision:
    posix:
      shell: sh
      run: ./infra/scripts/setup-db.sh
    windows:
      shell: pwsh
      run: ./infra/scripts/setup-db.ps1

Step 7: Validate and Deploy

Required Environment Setup:

azd env set AZURE_LOCATION eastus2

Deployment (two-phase recommended):

azd provision --no-prompt     # Create resources + RBAC assignments
sleep 60                       # Wait for RBAC propagation
azd deploy --no-prompt        # Deploy code (RBAC now active)

CRITICAL: Never store database passwords in app settings. The correct approach is managed identity with passwordless connections.

Critical Rules

  1. NEVER synthesize Bicep or Terraform from scratch — always start from base template IaC
  2. Do not restructure or replace base IaC files — only ADD recipe modules alongside them
  3. ALWAYS use recipe RBAC role GUIDs — never let the LLM guess role IDs
  4. ALWAYS use --no-prompt — the agent must never elicit user input during azd commands
  5. ALWAYS include a health check endpoint at /health
  6. ALWAYS use managed identity — no connection strings with passwords
  7. ALWAYS tag the App Service with azd-service-name matching azure.yaml

Source: SKILL.md on GitHub

1 alert8d4 checks · Risk SAFE
  • Gen Agent Trust Hub8d

    The azure-prepare skill provides a comprehensive environment for preparing Azure applications for deployment. It focuses on generating infrastructure-as-code and deployment configuration while strictly enforcing security best practices like managed identity usage and secret management via Key Vault. No malicious patterns or security risks were identified.

  • Socket8d

    5 alerts: gptAnomaly, gptSecurity

  • Snyk8d

    Risk: LOW · No issues

  • Runlayer6mo

    68/196 files flagged

Signed by skilld at 7995851. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 3 weeks ago
metadata
{
  "author": "Microsoft",
  "version": "0.0.0-placeholder"
}
  • Infrastructure
  • azure
  • bicep
  • terraform
  • deployment
  • docker
  • functions
  • app-service

README badge

README badge for microsoft/github-copilot-for-azure/azure-prepare

Prepares Azure applications for deployment by generating infrastructure templates (Bicep or Terraform), azure.yaml configuration, and Dockerfiles. Covers new app creation, modernization, and hosting on App Service, Container Apps, or Functions—but excludes Python App Service deployments, copilot SDK apps, and cross-cloud migrations which have dedicated skills.

Generated from the current SKILL.md.

Does this skill handle Python App Service deployments?
No. Use the python-appservice-deploy skill instead for Python code-only App Service deploys.
Can I use this skill for cross-cloud migration?
No. This skill is for Azure-native preparation. Use azure-cloud-migrate for migrations from AWS, GCP, or other clouds.
Does this skill support Copilot SDK apps?
No. Use azure-hosted-copilot-sdk for apps with @github/copilot-sdk or CopilotClient.
What infrastructure templates does this skill support?
Azure Developer CLI (azd), Bicep, Terraform, and Azure CLI. The skill creates infrastructure code, Dockerfiles, and configuration files—actual deployment execution is handled by the azure-deploy skill.
Does this skill delete existing project files?
No. When adding features to existing projects, it modifies files rather than deletes them. It never removes the project or workspace directory itself.

Generated from the current SKILL.md. These answers refresh after source changes.