microsoftlearning/trainer-demo-deploy/az-azure-deploy

Claude Code and agent skill by microsoftlearning/trainer-demo-deploy

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Deployment patterns, azd usage, rollback procedures, and post-deployment validation for Azure infrastructure projects.

Install

npx vskill@latest install microsoftlearning/trainer-demo-deploy/az-azure-deploy

SKILL.md

The same SKILL.md was published earlier as microsoftlearning/trainer-demo-deploy/az-azure-deploy.

Azure Deploy Skill

Deployment patterns and procedures for Azure infrastructure provisioned via Bicep templates and the Azure Developer CLI (azd). Covers the full deployment lifecycle: pre-flight checks, execution strategies, post-deployment validation, rollback, and cleanup.

[!CAUTION]
MANDATORY DEPLOYMENT POLICY
1. Always attempt deployment: The Deploy agent MUST always attempt azd up.
Tooling blockers (missing CLI, extension errors, auth issues) must be resolved
or escalated to the user — never used as a reason to autonomously skip deployment.
2. User decides on failure: If deployment fails for any reason, present the
full error to the user and ask for their decision. Never autonomously generate
a "dry-run only" or "blocked" summary and move on.
3. Escalate, don’t absorb: If a pre-deployment gate fails and cannot be
auto-fixed, ask the user. Do not silently document the failure and skip ahead.

1. Deployment Strategy Selection

Choose the deployment method based on available project artifacts:

MethodWhen to UsePrerequisites
`azd up` (preferred)azure.yaml exists in generated-scenarios/{project}/Azure Developer CLI installed, az login completed
Decision Tree
text
azure.yaml exists?
├── YES → Use azd up
└── NO → Generate azure.yaml first, then use azd up

2. Azure Developer CLI (azd) Patterns

First-Time Setup
powershell
# Verify azd is installed
azd version
# Initialize environment (first time only)
cd generated-scenarios/{project}
azd init
# Set environment name
azd env new {project}-{env}
azd env set AZURE_LOCATION eastus2
azd up — Full Deployment

azd up provisions infrastructure AND deploys application code in one step:

powershell
cd generated-scenarios/{project}
# Interactive mode (prompts for subscription, location)
azd up
# Non-interactive mode (CI/CD or automated runs)
azd up --no-prompt
azd provision — Infrastructure Only

When you only need to deploy Bicep templates without application code:

powershell
# Preview changes before provisioning
azd provision --preview
# Provision infrastructure
azd provision
azd deploy — Application Only

When infrastructure exists and you need to push application code:

powershell
azd deploy
azure.yaml Structure

The azure.yaml file must be in generated-scenarios/{project}/ root:

yaml
name: tdd-azd-{project}
metadata:
template: tddazd-{project}@1.0.0
infra:
provider: bicep
path: ./infra
[!IMPORTANT]
The infra.path must point to the directory containing main.bicep.
For this project, that's ./infra (relative to generated-scenarios/{project}/).
azd Environment Variables
VariablePurposeExample
AZURE_LOCATIONDefault Azure regioneastus2
AZURE_SUBSCRIPTION_IDTarget subscriptionxxxxxxxx-xxxx-...
AZURE_ENV_NAMEEnvironment namedev
AZURE_RESOURCE_GROUPTarget resource grouprg-funcsbweb-dev

Set via:

powershell
azd env set AZURE_LOCATION eastus2
azd env set AZURE_ENV_NAME dev

3. What-If Analysis

Interpreting What-If Results
Change TypeSymbolMeaningAction
Create+ (green)New resource will be createdReview for expected resources
Delete- (red)Resource will be removedVerify this is intentional
Modify~ (purple)Existing resource will be updatedCheck which properties change
No Change= (gray)Resource exists, no updates neededExpected for idempotent runs
Deploy! (yellow)Resource type doesn't support what-ifManual verification needed
What-If Best Practices
  • Always run what-if before the first deployment to a new environment
  • Compare resource counts against the implementation plan
  • Flag any unexpected DELETE operations — these may indicate naming changes
  • Resources showing Deploy (unsupported) need manual validation post-deployment

4. Post-Deployment Validation

Resource Existence Check
powershell
# List all resources in the group
az resource list --resource-group {rg-name} --output table
# Count resources (compare against implementation plan)
az resource list --resource-group {rg-name} --query "length(@)"
Provisioning State Check
powershell
az resource list `
--resource-group {rg-name} `
--query "[].{Name:name, Type:type, State:provisioningState}" `
--output table

All resources should show Succeeded. Any Failed or Creating states require investigation.

Service-Specific Health Checks
ServiceCommandExpected
App Serviceaz webapp show --name {n} --resource-group {rg} --query "state" -o tsvRunning
Function Appaz functionapp show --name {n} --resource-group {rg} --query "state" -o tsvRunning
Service Busaz servicebus namespace show --name {n} --resource-group {rg} --query "provisioningState" -o tsvSucceeded
Key Vaultaz keyvault show --name {n} --query "properties.provisioningState" -o tsvSucceeded
Storageaz storage account show --name {n} --resource-group {rg} --query "provisioningState" -o tsvSucceeded
SQL Serveraz sql server show --name {n} --resource-group {rg} --query "state" -o tsvReady
Cosmos DBaz cosmosdb show --name {n} --resource-group {rg} --query "provisioningState" -o tsvSucceeded
Container Appaz containerapp show --name {n} --resource-group {rg} --query "properties.provisioningState" -o tsvSucceeded
Container Envaz containerapp env show --name {n} --resource-group {rg} --query "properties.provisioningState" -o tsvSucceeded
Log Analyticsaz monitor log-analytics workspace show --workspace-name {n} --resource-group {rg} --query "provisioningState" -o tsvSucceeded
Deployment Outputs
powershell
az deployment group show `
--resource-group {rg-name} `
--name {deployment-name} `
--query "properties.outputs" -o json

5. Rollback Procedures

Full Rollback (Delete Everything)
powershell
# Using azd
azd down --force --purge
# Using Azure CLI
az group delete --name {rg-name} --yes --no-wait
# Purge Key Vault soft-deleted vaults (if purge protection is off)
az keyvault purge --name {kv-name} --location {location}
Partial Rollback (Specific Resources)
powershell
# Delete a specific resource
az resource delete --ids {resource-id}
# Redeploy only failed resources (phased approach)
azd provision
Rollback Decision Tree
text
Deployment failed?
├── All resources failed
│ └── az group delete (full cleanup)
├── Some resources failed
│ ├── Fix template → redeploy
│ └── Delete failed resources → redeploy
└── Deployment succeeded but misconfigured
├── Fix parameters → redeploy (idempotent)
└── az group delete → redeploy from scratch
[!WARNING]
Key Vault with purge protection enabled cannot be purged for 7-90 days
(depending on softDeleteRetentionInDays). Plan Key Vault names carefully
to avoid naming collisions during re-deployments.

6. Common Deployment Errors

[!IMPORTANT]
For every error in this table, the Deploy agent must **present the error
to the user and ask how to proceed** if auto-remediation fails.
Never silently skip deployment or generate a dry-run summary.
ErrorCauseAuto-Fix AttemptIf Auto-Fix Fails
AuthorizationFailedInsufficient RBAC permissionsSuggest Contributor role assignmentAsk the user
InvalidTemplateDeploymentBicep template has errorsRun bicep build to surface detailsAsk the user
QuotaExceededSKU or region quota limit reachedSuggest alternative SKU or regionAsk the user
ResourceGroupNotFoundRG doesn't exist for RG-scoped deployCreate with az group createAsk the user
DeploymentFailed (nested)A module within the template failedCheck az deployment operation group listAsk the user
NameNotAvailableGlobally unique name already takenVerify uniqueSuffix is applied correctlyAsk the user
ResourceProviderNotRegisteredService not enabled in subscriptionaz provider register --namespace {ns}Ask the user
MissingSubscriptionRegistrationSame as aboveaz provider register --namespace {ns}Ask the user
LinkedAuthorizationFailedCross-scope role assignment failedVerify managed identity exists before assigning rolesAsk the user
ConflictResource state doesn't allow the operationWait and retryAsk the user
Azure CLI broken/extension errorCLI extension permission or corruptionTry removing extension or running repairAsk the user
Bicep CLI missingBicep not installedTry az bicep installAsk the user to install manually
Detailed Error Investigation
powershell
# List all deployment operations (shows individual resource failures)
az deployment operation group list `
--resource-group {rg-name} `
--name {deployment-name} `
--query "[?properties.provisioningState=='Failed'].{Resource:properties.targetResource.resourceName, Error:properties.statusMessage.error.message}" `
--output table

7. Cleanup Patterns

Demo Teardown
powershell
# Preferred: azd handles all cleanup including purge-protected resources
azd down --force --purge
# Alternative: delete resource group
az group delete --name {rg-name} --yes --no-wait
Selective Cleanup
powershell
# Remove specific resources while keeping others
az resource delete --resource-group {rg-name} --name {resource-name} --resource-type {type}

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
31
Repository forks
30
7-day trend score
17

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 15 Sep 2026, 2 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/microsoftlearning/trainer-demo-deploy/az-azure-deploy/badge)](https://verified-skill.com/skills/microsoftlearning/trainer-demo-deploy/az-azure-deploy)

Something wrong with this skill or its page? Tell us.