name: az-cli-ops
description: Azure CLI (az) operations for resource groups, deployments (ARM/Bicep), app services/container apps, ACR images, Key Vault secrets, role assignments, and operational checks. Use when a request involves az commands, Azure deployments, secrets/app settings, or Azure resource management.
Az Cli Ops
Overview
Use az to manage Azure resources, deployments, and secrets with safe, repeatable workflows.
Quick start (context)
- Use the wrapper so commands are logged:
scripts/azx account show,scripts/azx account list -o table,scripts/azx account set -s <subscription-id>. - Confirm defaults:
scripts/azx configure -d group=<rg> location=<region>for the current session. - For read-heavy tasks, prefer
--query+-o jsonc|tsvto avoid parsing errors. - Review
references/auto-summary.mdto adapt based on recent successes/failures.
Automation wrapper (required)
- Use
scripts/azxfor all az commands to log outcomes toreferences/usage-log.jsonl. - The wrapper auto-updates
references/auto-summary.mdafter each command to capture what worked or failed. - If you must run
azdirectly (e.g., debugging), runscripts/track_command.sh az ...afterward with the same args.
Task map
See references/az-command-map.md for task-to-command mappings and safe defaults.
Deployments (ARM/Bicep)
- Use
az deployment group createfor resource-group scoped deployments. - Use
az deployment sub createfor subscription-scoped deployments. - Prefer
--what-ifbefore destructive changes; capture outputs via--query.
App Services / Container Apps
- Use
az webapp/az appservicefor App Service operations. - Use
az containerappfor Container Apps; install the extension if needed (az extension add -n containerapp). - Use deployment logs and revision lists when diagnosing rollouts.
Secrets & config
- Use Key Vault for secrets:
az keyvault secret set/show/list. - For app settings:
- App Service:
az webapp config appsettings set/list. - Container Apps:
az containerapp secret set/listandaz containerapp update --set-env-vars.
- App Service:
Access control
- Use
az role assignment create/listandaz role definition listfor RBAC. - Use
az adcommands sparingly; confirm tenant context withaz account show.
Self-improving loop (automated + manual)
Automated (always on when using scripts/azx):
- Command outcomes are logged to
references/usage-log.jsonl. scripts/auto_improve.pyupdatesreferences/auto-summary.mdand can append repeatable learnings toreferences/az-ops-notes.md.
Manual (when new patterns are discovered):
- Append new command patterns, flags, or pitfalls to
references/az-ops-notes.md. - If a command/flag is missing or changed, update
references/az-command-map.md. - Run
scripts/refresh_az_reference.shto refreshreferences/az-help.mdfrom the locally installed az.
Resources
scripts/
scripts/azx: wrapper that logs az command outcomes and triggers auto-summary updates.scripts/track_command.sh: logs command outcomes toreferences/usage-log.jsonl.scripts/auto_improve.py: generatesreferences/auto-summary.mdand auto-notes.scripts/refresh_az_reference.sh: regeneratereferences/az-help.mdfrom local az help output.
references/
references/az-command-map.md: task-to-command map and safe defaults.references/az-help.md: auto-generated help snapshot from the local az version.references/az-ops-notes.md: living notes for patterns, pitfalls, and team conventions.references/auto-summary.md: auto-generated success/failure summary for recent commands.references/usage-log.jsonl: append-only command log (redacted).