skills/cli-scripting/azure-cli/SKILL.md
Expert agent for Azure CLI (az) covering all major Azure services. Deep expertise in authentication (interactive, service principal, managed identity, SSO), output formats and JMESPath queries, resource groups, VMs, storage accounts/blobs, networking (VNets, NSGs, load balancers, DNS), Entra ID (Azure AD), AKS, App Service, Functions, databases (SQL, Cosmos DB, MySQL, PostgreSQL), Key Vault, Monitor/alerting, and infrastructure scripting patterns. WHEN: "az ", "Azure CLI", "az login", "az vm", "az aks", "az storage", "az keyvault", "az monitor", "az ad", "az group", "az network", "az webapp", "az functionapp", "az sql", "az cosmosdb", "JMESPath", "az account".
npx skillsauth add chrishuffman5/domain-expert cli-azureInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a specialist in the Azure CLI (az) for managing Azure resources from the command line. You have deep knowledge of:
When you receive a request:
Classify the request type:
references/core.mdreferences/commands.mdreferences/patterns.mdreferences/core.mdVerify subscription -- Remind user to verify active subscription with az account show before destructive operations.
Prefer idempotent patterns -- Use check-before-create for scripts. Many az commands are not idempotent by default.
Use JMESPath for extraction -- Combine --query with --output tsv for scripting. Use --output table for human display.
Provide complete commands -- Include all required flags. Show the --resource-group and --name flags explicitly.
# Interactive login
az login
# Device code (headless/SSH)
az login --use-device-code
# Service principal
az login --service-principal --username "$APP_ID" --password "$SP_PASSWORD" --tenant "$TENANT_ID"
# Managed identity
az login --identity
# Switch subscription
az account set --subscription "My Subscription"
az account show --query "{Sub:id, Tenant:tenantId}" --output json
# Output formats: json, jsonc, table, tsv, yaml, yamlc, none
az vm list --output table
# JMESPath queries
az vm list --query "[].{Name:name, RG:resourceGroup, Location:location}" --output table
az vm list --query "[?location=='eastus'].name" --output tsv
az vm list --query "length(@)" --output tsv
# Capture value for scripting
VM_IP=$(az vm list-ip-addresses -g my-rg -n my-vm \
--query "[0].virtualMachine.network.publicIpAddresses[0].ipAddress" --output tsv)
az group create --name my-rg --location eastus --tags env=prod
az group list --query "[?tags.env=='prod'].name" --output tsv
az group exists --name my-rg
az group delete --name my-rg --yes --no-wait
az vm create -g my-rg -n my-vm --image Ubuntu2204 --size Standard_B2s \
--admin-username azureuser --ssh-key-values ~/.ssh/id_rsa.pub
az vm list -g my-rg --show-details \
--query "[].{Name:name, State:powerState, IP:publicIps}" --output table
az vm start -g my-rg -n my-vm
az vm deallocate -g my-rg -n my-vm
az vm delete -g my-rg -n my-vm --yes
az storage account create -n mystorageacct -g my-rg -l eastus --sku Standard_LRS
az storage blob upload -c my-container -f ./file.csv -n reports/file.csv --connection-string "$CONN"
az storage blob list -c my-container --connection-string "$CONN" --output table
az network vnet create -g my-rg -n my-vnet --address-prefix 10.0.0.0/16
az network vnet subnet create -g my-rg --vnet-name my-vnet -n app-subnet --address-prefix 10.0.1.0/24
az network nsg create -g my-rg -n web-nsg
az network nsg rule create -g my-rg --nsg-name web-nsg -n AllowHTTP \
--priority 100 --protocol Tcp --destination-port-ranges 80 --access Allow --direction Inbound
az aks create -g my-rg -n my-aks --node-count 3 --enable-managed-identity --generate-ssh-keys
az aks get-credentials -g my-rg -n my-aks --overwrite-existing
az aks scale -g my-rg -n my-aks --node-count 5
az keyvault create -n my-kv -g my-rg -l eastus --enable-rbac-authorization true
az keyvault secret set --vault-name my-kv -n db-password --value "$DB_PASS"
az keyvault secret show --vault-name my-kv -n db-password --query value --output tsv
1. Not setting the correct subscription
Always verify with az account show. Use az account set --subscription NAME before running commands.
2. Forgetting --yes on destructive commands
az group delete and az vm delete prompt interactively by default. Add --yes in scripts.
3. Not using --no-wait for long operations
VM creation, AKS scaling, and resource group deletion can take minutes. Use --no-wait and poll status separately.
4. Hardcoding storage keys instead of using SAS or RBAC Prefer SAS tokens with expiry or RBAC-based access (Storage Blob Data Contributor role) over shared keys.
5. Missing --permanent on firewall-like resources
Unlike Linux firewalld, Azure NSG rules are always persistent. But forgetting --output tsv in variable capture adds headers/formatting.
6. Using az resource show for existence checks without suppressing errors
Always redirect stderr: az group show --name "$RG" &>/dev/null
7. Not using --query for variable capture
Parsing JSON with jq works but --query with --output tsv is faster and requires no extra tool.
8. Creating storage accounts with public blob access enabled
Always pass --allow-blob-public-access false unless public access is explicitly needed.
9. Forgetting to associate NSGs with subnets
Creating an NSG and adding rules is not enough. Use az network vnet subnet update --network-security-group.
10. Not tagging resources
Tags enable cost tracking, automation (batch delete by tag), and ownership. Always tag with at least env and owner.
Load these when you need deep knowledge for a specific area:
references/core.md -- Authentication methods, output formats, JMESPath query patterns, configuration, extensions, global flags. Read for auth, querying, and CLI configuration questions.references/commands.md -- Complete command reference by service: resource groups, VMs, storage, networking, identity, AKS, App Service, databases, Key Vault, Monitor. Read for specific service commands.references/patterns.md -- Scripting patterns: idempotent create, error handling, --no-wait async, batch operations with loops and xargs, cleanup with trap. Read for infrastructure automation scripts.scripts/01-azure-provision.sh -- Complete idempotent environment provisioning (RG, VNet, NSG, VM, Storage)tools
kubectl command-line usage and scripting: kubeconfig and context management, output formats (jsonpath, custom-columns, go-template), all major verbs (get, describe, apply, delete, exec, logs, port-forward, rollout, scale, drain), workload resources, config/storage, networking, RBAC, node management, debugging (CrashLoopBackOff, ImagePullBackOff, OOMKilled), and scripting patterns (dry-run, diff, wait, jq, kustomize). WHEN: "kubectl", "k8s CLI", "kubeconfig", "namespace", "pod", "deployment", "service", "ingress", "configmap", "secret", "rollout", "scale", "drain", "taint", "kustomize". Do NOT use for cluster architecture, sizing, upgrades, or workload design decisions — that's the `kubernetes` skill in the `containers` plugin. This skill is command syntax and scripting kubectl against an existing cluster, not cluster ops.
tools
Bash 5.x shell scripting, Unix text processing, and command-line automation: variables, parameter expansion, quoting, control flow, functions, I/O redirection, error handling (set -euo pipefail, trap), and the Unix tool ecosystem (grep, sed, awk, jq, find, sort, uniq, cut, xargs). Covers process management, networking (curl, ssh, rsync, nc), file locking (flock), parallel execution, and production script patterns. WHEN: "Bash", "bash", "shell", "sh", ".sh", "shell script", "sed", "awk", "grep", "jq", "find", "xargs", "curl", "ssh", "rsync", "cron", "pipe", "redirect", "here-doc", "shebang", "POSIX", "set -euo pipefail", "trap".
tools
Azure CLI (az) command syntax and scripting: authentication (interactive, service principal, managed identity, SSO), output formats and JMESPath queries, resource groups, VMs, storage accounts/blobs, networking (VNets, NSGs, load balancers, DNS), Entra ID, AKS, App Service, Functions, databases (SQL, Cosmos DB, MySQL, PostgreSQL), Key Vault, Monitor/alerting, and infrastructure scripting patterns. WHEN: "az ", "Azure CLI", "az login", "az vm", "az aks", "az storage", "az keyvault", "az monitor", "az ad", "az group", "az network", "az webapp", "az functionapp", "az sql", "az cosmosdb", "JMESPath", "az account". Do NOT use for Azure architecture, landing zones, or multi-subscription strategy — that's the `cloud-platforms` plugin. This skill is about command syntax and scripting the CLI, not deciding what to provision.
tools
AWS CLI v2 command syntax and scripting: authentication (profiles, SSO, assume-role, instance profiles), output formats and JMESPath queries, pagination and waiters, IAM, S3, Lambda, RDS, CloudFormation, ECS, EKS, CloudWatch, SSM, Route 53, STS, and VPC networking. WHEN: "aws ", "AWS CLI", "aws ec2", "aws s3", "aws lambda", "aws iam", "aws cloudformation", "aws ssm", "aws ecs", "aws eks", "aws rds", "aws cloudwatch", "aws route53", "aws sts". Do NOT use for AWS architecture, service selection, multi-account strategy, or FinOps — that's the `cloud-platforms` plugin. This skill is about command syntax and scripting the CLI, not deciding what to provision.