All skills
microsoft avatar

/azure-deploy

@d0c21c0 official

Execute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files. DO NOT use this skill when the user asks to CREATE a new application — use azure-prepare instead. This skill runs azd up, azd deploy, terraform apply, and az deployment commands with built-in error recovery. Requires .azure/deployment-plan.md from azure-prepare and validated status from azure-validate. WHEN: "run azd up", "run azd deploy", "execute deployment", "push to production", "push to cloud", "go live", "ship it", "bicep deploy", "terraform apply", "publish to Azure", "launch on Azure". DO NOT USE WHEN: "create and deploy", "build and deploy", "create a new app", "set up infrastructure", "create and deploy to Azure using Terraform" — use azure-prepare for these.

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

This session only. Nothing lands on disk.

referencesrecipesazdpost-deployment.md

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

Post-Deployment Steps

Execute critical post-deployment configuration after infrastructure provisioning completes.

⚠️ Run AFTER azd up or azd provision completes successfully

When to Apply

Post-deployment steps are required when your deployment includes:

Scenario Required Actions
ASP.NET Core + Azure SQL + Managed Identity Grant managed identity SQL access, apply EF migrations
App Service + Azure SQL + Entra auth Grant App Service identity database permissions
Container Apps + SQL Database Configure managed identity access, run migrations

ASP.NET Core + EF Core + Azure SQL

Complete workflow for apps using Entity Framework with Azure SQL Database.

Prerequisites

  • azd up or azd provision completed successfully
  • App Service or Container App has system-assigned managed identity enabled
  • Azure SQL Server configured with Entra ID admin
  • EF Core project with migrations

Step 1: Grant Managed Identity SQL Access

Grant the App Service or Container App's managed identity permissions on the SQL database.

See SQL Managed Identity Access for detailed SQL scripts and examples.

Quick Template:

# Get the app identity name from azd
eval $(azd env get-values)
APP_NAME=$SERVICE_API_NAME  # or SERVICE_WEB_NAME

# Connect as Entra admin and grant permissions
# See sql-managed-identity.md for connection patterns

PowerShell:

# Get the app identity name from azd
azd env get-values | ForEach-Object {
    $name, $value = $_.Split('=', 2)
    Set-Item "env:$name" $value
}
$AppName = $env:SERVICE_API_NAME  # or SERVICE_WEB_NAME

# Connect as Entra admin and grant permissions
# See sql-managed-identity.md for connection patterns

Step 2: Apply EF Core Migrations

Apply Entity Framework migrations to create database schema.

See EF Core Migrations for deployment patterns and troubleshooting.

Quick Options:

Method Command Use When
azd hook Add postprovision hook in azure.yaml Automated deployments
Manual dotnet ef database update One-time or troubleshooting
SQL Script dotnet ef migrations script --idempotent Pre-generated scripts

Step 3: Verify Deployment

# Get app endpoint
ENDPOINT=$(azd env get-values | grep SERVICE_.*_URI | cut -d'=' -f2)

# Health check
curl -f "$ENDPOINT/health" || echo "Health check failed"

# Test database connectivity
curl -f "$ENDPOINT/api/test-db" || echo "Database connection failed"

PowerShell:

# Get app endpoint
$Endpoint = azd env get-values | Select-String -Pattern 'SERVICE_.*_URI' |
    Select-Object -First 1 | ForEach-Object { ($_ -split '=', 2)[1] }

# Health check
try { Invoke-WebRequest "$Endpoint/health" } catch { Write-Output "Health check failed" }

# Test database connectivity
try { Invoke-WebRequest "$Endpoint/api/test-db" } catch { Write-Output "Database connection failed" }

Expected Result:

  • HTTP 200 from health endpoint
  • No SQL authentication errors in logs
  • Application starts successfully

Common Issues

Error Cause Solution
Login failed for user '<token-identified principal>' Managed identity not granted SQL access Follow sql-managed-identity.md
Cannot open database Firewall rules block access Check SQL firewall, ensure "Allow Azure services" enabled
Invalid object name Migrations not applied Run EF migrations per ef-migrations.md
No such table Schema missing Apply migrations or check connection string database name

Best Practices

  1. Automate with azd hooks — Add postprovision hook to azure.yaml for repeatable deployments
  2. Use idempotent scripts — Generate SQL with dotnet ef migrations script --idempotent
  3. Verify incrementally — Test SQL access, then migrations, then endpoint
  4. Log everything — Enable verbose logging during initial setup for troubleshooting

References

Source: SKILL.md on GitHub

1 alert16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides comprehensive instructions and scripts for executing Azure deployments using various tools like the Azure Developer CLI (azd), Terraform, and Bicep. It includes several security considerations, such as the execution of deployment commands and the use of external scripts for database migrations. These operations are essential to the skill's intended purpose and are accompanied by extensive safety guidance, including the implementation of managed identities and mandatory user confirmation for destructive actions.

  • Socket16d

    1 alert: gptAnomaly

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    21/36 files flagged

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

Last checked against GitHub yesterday.

Activeupdated 5 months ago
metadata
{
  "author": "Microsoft",
  "version": "0.0.0-placeholder"
}

README badge

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

Executes Azure deployments for applications with prepared infrastructure and validated deployment plans, running azd up, azd deploy, terraform apply, and az deployment commands with error recovery. Use this skill only after azure-prepare and azure-validate have completed — it does not create applications or infrastructure, only deploys them.

Generated from the current SKILL.md.

What prerequisites must be met before using this skill?
The azure-prepare skill must have completed (creating .azure/deployment-plan.md and infrastructure files) and the azure-validate skill must have run and confirmed status as 'Validated'. If either is missing, invoke those skills first.
Can I use this skill to create a new application?
No. This skill executes deployments for already-prepared applications only. Use the azure-prepare skill to create new applications or set up infrastructure.
What deployment methods does this skill support?
The skill runs azd up, azd deploy, terraform apply, and az deployment commands with built-in error recovery.
What happens if validation status is not 'Validated'?
The skill will not proceed. You must invoke azure-validate first and ensure the Validation Proof section in .azure/deployment-plan.md is populated with actual validation results.
Does this skill handle post-deployment configuration?
Yes. It configures SQL managed identity and applies Entity Framework migrations if applicable, following the post-deployment steps for the selected recipe.

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