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

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

Trust tier 2
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
LLM review pending
Source check pending

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

Pre-deployment and post-deployment validation patterns for Azure infrastructure. Covers authentication, template linting, what-if analysis, resource provider checks, and health verification.

Install

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

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

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

Azure Validate Skill

Pre-deployment and post-deployment validation gates that ensure Azure infrastructure is ready for deployment and correctly provisioned afterward. Used by the Deploy agent as hard gates before executing any deployment.


1. Pre-Deployment Validation Gates

All gates must pass before deployment proceeds. Each gate is a hard stop — failure means the deployment cannot continue until the issue is resolved.

[!CAUTION]
GATE FAILURE POLICY: If a gate fails and cannot be auto-remediated,
present the failure to the user and ask how to proceed.
Do NOT autonomously skip deployment or generate a dry-run summary.
The user must explicitly decide whether to:
1. Fix the issue and retry
2. Skip the gate (accepting risk)
3. Abort the deployment
Gate Sequence
text
Gate 1: Authentication → az login / azd auth status
Gate 2: Subscription → correct subscription selected
Gate 3: Template → bicep build + bicep lint pass
Gate 4: Parameters → required params have values
Gate 5: Resource Providers → all needed providers registered
Gate 6: What-If → no unexpected destructive changes

2. Gate 1 — Authentication Check

Azure CLI
powershell
# Check if logged in
$account = az account show 2>$null | ConvertFrom-Json
if (-not $account) {
Write-Error "Not authenticated. Run 'az login' first."
exit 1
}
Write-Host "Authenticated as: $($account.user.name)"
Write-Host "Tenant: $($account.tenantId)"
Azure Developer CLI
powershell
# Check azd authentication
azd auth login --check-status
Expected Output
FieldCheck
user.name or user.typeNon-empty; matches expected identity
tenantIdMatches the target tenant
stateEnabled
[!WARNING]
Service principal authentication (user.type: "servicePrincipal") may have
restricted permissions compared to interactive login. Verify RBAC before proceeding.

3. Gate 2 — Subscription Context

Verify Correct Subscription
powershell
# Show current subscription
az account show --query "{Name:name, SubscriptionId:id, State:state}" -o table
# List all available subscriptions
az account list --query "[].{Name:name, SubscriptionId:id, IsDefault:isDefault}" -o table
Switch Subscription (If Needed)
powershell
# By name
az account set --subscription "Visual Studio Enterprise"
# By ID
az account set --subscription "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Validation Checks
CheckCommandExpected
Subscription stateaz account show --query "state" -o tsvEnabled
Spending limitaz account show --query "spendingLimit" -o tsvNot On for production
Subscription ID matches envCompare az account show --query "id" with azd env get-valuesMatch
[!IMPORTANT]
Always confirm the subscription before deploying. Deploying to the wrong subscription
is the most common and costly mistake in demo environments.

4. Gate 3 — Template Validation

Bicep Build (Syntax Check)
powershell
# Build main template (transpiles to ARM JSON)
bicep build generated-scenarios/{project}/infra/main.bicep
# Build all bicep files in the directory
Get-ChildItem generated-scenarios/{project}/infra -Recurse -Filter "*.bicep" | ForEach-Object {
Write-Host "Building: $($_.FullName)"
bicep build $_.FullName
}

A successful bicep build produces no output. Any output indicates errors.

Bicep Lint (Best Practice Check)
powershell
# Lint the main template
bicep lint generated-scenarios/{project}/infra/main.bicep

Linting checks against bicepconfig.json rules. Common lint warnings:

RuleSeverityMeaning
no-unused-paramsWarningParameter defined but not used
no-unused-varsWarningVariable defined but not used
secure-parameter-defaultErrorSecure param has a default value
adminusername-should-not-be-literalWarningAdmin username is hardcoded
no-hardcoded-env-urlsWarningUses management.azure.com instead of environment()
ARM Template Validation API
powershell
# Validate against Azure Resource Manager (without deploying)
az deployment group validate `
--resource-group {rg-name} `
--template-file generated-scenarios/{project}/infra/main.bicep `
--parameters generated-scenarios/{project}/infra/main.bicepparam

This calls the ARM validation endpoint which checks:

  • Template schema validity
  • Parameter type correctness
  • Resource API version availability
  • Cross-resource reference resolution

5. Gate 4 — Parameter Validation

Check Required Parameters
powershell
# Extract parameters from the Bicep file
bicep build generated-scenarios/{project}/infra/main.bicep --stdout | `
ConvertFrom-Json | `
Select-Object -ExpandProperty parameters | `
ForEach-Object { $_.PSObject.Properties } | `
Select-Object Name, @{N='Type';E={$_.Value.type}}, @{N='Default';E={$_.Value.defaultValue}} | `
Format-Table
Verify .bicepparam File
powershell
# Ensure the parameter file exists
Test-Path generated-scenarios/{project}/infra/main.bicepparam
# Verify it references the correct template
Get-Content generated-scenarios/{project}/infra/main.bicepparam | Select-Object -First 1
# Expected: using 'main.bicep'
Common Parameter Issues
IssueSymptomFix
Missing required parameterThe parameter 'X' is requiredAdd to .bicepparam file
Wrong typeExpected type 'string', got 'int'Correct the value type
Invalid allowed valueNot in allowed values listCheck @allowed() decorator
Secure param in plain textLint errorUse Key Vault reference or @secure()

6. Gate 5 — Resource Provider Registration

Check Required Providers

Every Azure service requires its resource provider to be registered in the subscription.

powershell
# Check if a specific provider is registered
az provider show --namespace Microsoft.Web --query "registrationState" -o tsv
# Check multiple providers at once
$providers = @(
"Microsoft.Web",
"Microsoft.ServiceBus",
"Microsoft.Storage",
"Microsoft.KeyVault",
"Microsoft.OperationalInsights",
"Microsoft.Insights",
"Microsoft.App",
"Microsoft.ManagedIdentity",
"Microsoft.Authorization"
)
foreach ($p in $providers) {
$state = az provider show --namespace $p --query "registrationState" -o tsv 2>$null
Write-Host "$p : $state"
}
Register Missing Providers
powershell
# Register a provider (takes 1-5 minutes)
az provider register --namespace Microsoft.Web --wait
# Batch register
$providers | ForEach-Object {
Write-Host "Registering: $_"
az provider register --namespace $_ --wait
}
Common Resource Providers by Service
Azure ServiceResource Provider
App Service / FunctionsMicrosoft.Web
Service BusMicrosoft.ServiceBus
Key VaultMicrosoft.KeyVault
StorageMicrosoft.Storage
Log AnalyticsMicrosoft.OperationalInsights
Application InsightsMicrosoft.Insights
Container AppsMicrosoft.App
Managed IdentityMicrosoft.ManagedIdentity
Role AssignmentsMicrosoft.Authorization
Cosmos DBMicrosoft.DocumentDB
SQL ServerMicrosoft.Sql
Event HubsMicrosoft.EventHub
API ManagementMicrosoft.ApiManagement
Cognitive ServicesMicrosoft.CognitiveServices

7. Gate 6 — What-If Analysis

Run What-If
powershell
# Resource group scoped
az deployment group what-if `
--resource-group {rg-name} `
--template-file generated-scenarios/{project}/infra/main.bicep `
--parameters generated-scenarios/{project}/infra/main.bicepparam
# Subscription scoped
az deployment sub what-if `
--location eastus2 `
--template-file generated-scenarios/{project}/infra/main.bicep `
--parameters generated-scenarios/{project}/infra/main.bicepparam
What-If Validation Criteria
CheckPass Criteria
No unexpected Delete operationsZero resources being deleted (unless intentional)
Resource count matches planNumber of Create operations aligns with 04-implementation-plan.md
No Error status resourcesAll resources can be evaluated
Region correctnessResources deploy to the expected region
Automated What-If Parsing
powershell
# Save what-if output for analysis
$whatif = az deployment group what-if `
--resource-group {rg-name} `
--template-file generated-scenarios/{project}/infra/main.bicep `
--parameters generated-scenarios/{project}/infra/main.bicepparam `
--no-pretty-print 2>&1
# Check for destructive changes
if ($whatif -match "Delete") {
Write-Warning "DESTRUCTIVE CHANGES DETECTED - Review before proceeding"
}

8. Post-Deployment Validation

Resource Provisioning State

All resources must reach Succeeded state:

powershell
# Check all resources in the group
$resources = az resource list `
--resource-group {rg-name} `
--query "[].{Name:name, Type:type, State:provisioningState}" -o json | ConvertFrom-Json
$failed = $resources | Where-Object { $_.State -ne "Succeeded" }
if ($failed) {
Write-Error "Resources not in Succeeded state:"
$failed | Format-Table
} else {
Write-Host "All $($resources.Count) resources provisioned successfully."
}
Deployment Output Capture
powershell
# Get deployment outputs (endpoints, keys, connection strings)
az deployment group show `
--resource-group {rg-name} `
--name {deployment-name} `
--query "properties.outputs" -o json
Connectivity Validation
powershell
# Test App Service endpoint
$url = az webapp show --name {app-name} --resource-group {rg-name} --query "defaultHostName" -o tsv
Invoke-WebRequest -Uri "https://$url" -Method Head -UseBasicParsing
# Test Function App endpoint
$url = az functionapp show --name {func-name} --resource-group {rg-name} --query "defaultHostName" -o tsv
Invoke-WebRequest -Uri "https://$url" -Method Head -UseBasicParsing

9. Validation Report Format

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
26
7-day trend score
17

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

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-validate/badge)](https://verified-skill.com/skills/microsoftlearning/trainer-demo-deploy/az-azure-validate)

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