Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Execute Azure deployments using azd, Terraform, or Bicep with built-in error recovery.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/recipes/azd/verify.md
1# AZD Verification23Verify deployment success and application health.45## Step 1: Verify Resources67```bash8azd show9```1011Expected output:12```text13Showing deployed resources:14Resource Group: rg-myapp-dev15Services:16api - Endpoint: https://api-xxxx.azurecontainerapps.io17```1819## Step 2: Health Check2021```bash22# Get endpoint23ENDPOINT=$(azd env get-values | grep -E "SERVICE_.*_URI|.*_ENDPOINT" | head -1 | cut -d'=' -f2)2425# Test endpoint26curl -f "$ENDPOINT/health" || curl -f "$ENDPOINT"27```2829**PowerShell:**30```powershell31# Get endpoint32$Endpoint = azd env get-values | Select-String -Pattern 'SERVICE_.*_URI|.*_ENDPOINT' |33Select-Object -First 1 | ForEach-Object { ($_ -split '=', 2)[1] }3435# Test endpoint36try { Invoke-WebRequest "$Endpoint/health" } catch { Invoke-WebRequest $Endpoint }37```3839Expected: HTTP 200 response.4041## Step 3: Report Results to User4243> ⛔ **MANDATORY** — You **MUST** present the deployed endpoint URLs to the user in your response. A deployment is not considered complete until the user has received the URLs.4445> ⛔ **ALWAYS run `azd show`** after deployment to extract endpoint URLs. Do NOT rely on the `azd deploy` output alone — it is frequently truncated before endpoint URLs appear.4647```bash48azd show49```5051Parse the `Endpoint:` lines from the `azd show` output to collect all deployed service URLs.5253**Present a summary to the user that includes:**5455| Item | Source |56|------|--------|57| Deployed service endpoint(s) | `Endpoint:` lines from `azd show` |58| Aspire Dashboard URL (if applicable) | `Aspire Dashboard:` line from `azd show` |59| Azure Portal deployment link (if available) | Portal URL from provisioning output |6061Example response format:6263```text64✅ Deployment succeeded!6566| Service | Endpoint |67|---------|----------|68| apiservice | https://apiservice.xxx.azurecontainerapps.io |6970Aspire Dashboard: https://aspire-dashboard.xxx.azurecontainerapps.io71```7273> ⚠️ **Always use fully-qualified URLs with the `https://` scheme.** If a command returns a bare hostname (e.g. `myapp.azurestaticapps.net`), prepend `https://` before presenting it to the user.7475## Step 4: Post-Deployment Verification (if applicable)7677For deployments with Azure SQL Database and managed identity:7879### Verify SQL Access8081> ⚠️ **Warning:** `az sql db query` requires the `rdbms-connect` extension: `az extension add --name rdbms-connect --yes`8283```bash84# Load environment variables85eval $(azd env get-values)8687# Check managed identity user exists in database88az sql db query \89--server "$SQL_SERVER" \90--database "$SQL_DATABASE" \91--resource-group "$AZURE_RESOURCE_GROUP" \92--auth-mode ActiveDirectoryDefault \93--queries "SELECT name, type_desc FROM sys.database_principals WHERE type = 'E'"94```9596**PowerShell:**97```powershell98# Load environment variables99azd env get-values | ForEach-Object {100$name, $value = $_.Split('=', 2)101Set-Item "env:$name" $value102}103104# Check managed identity user exists in database105az sql db query `106--server $env:SQL_SERVER `107--database $env:SQL_DATABASE `108--resource-group $env:AZURE_RESOURCE_GROUP `109--auth-mode ActiveDirectoryDefault `110--queries "SELECT name, type_desc FROM sys.database_principals WHERE type = 'E'"111```112113**Expected:** Should list the App Service or Container App managed identity.114115### Verify Database Schema116117For EF Core applications:118119```bash120# Check tables exist121az sql db query \122--server "$SQL_SERVER" \123--database "$SQL_DATABASE" \124--resource-group "$AZURE_RESOURCE_GROUP" \125--auth-mode ActiveDirectoryDefault \126--queries "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'"127```128129**PowerShell:**130```powershell131az sql db query `132--server $env:SQL_SERVER `133--database $env:SQL_DATABASE `134--resource-group $env:AZURE_RESOURCE_GROUP `135--auth-mode ActiveDirectoryDefault `136--queries "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'"137```138139**Expected:** Should list application tables (not just `__EFMigrationsHistory`).140141### Check Application Logs142143```bash144# For App Service145az webapp log tail --name <app-name> --resource-group <resource-group>146147# For Container Apps148az containerapp logs show --name <app-name> --resource-group <resource-group> --follow149```150151**Look for:**152- ✅ No SQL authentication errors153- ✅ Successful database connection154- ✅ Application started successfully155156## Common Issues157158| Symptom | Cause | Fix |159|---------|-------|-----|160| HTTP 500 on startup | SQL authentication failure | See [sql-managed-identity.md](sql-managed-identity.md) |161| "Invalid object name" errors | Migrations not applied | See [ef-migrations.md](ef-migrations.md) |162| Endpoint not accessible | Service still starting | Wait 1-2 minutes, retry |163| Health check fails | Application error | Check logs with `az webapp log tail` |164165## References166167- [Post-Deployment Steps](post-deployment.md)168- [SQL Managed Identity Access](sql-managed-identity.md)169- [EF Core Migrations](ef-migrations.md)170