teardown-agent-aca-dev
Skill12 starsChanged 7 months agoMITView on GitHub
AI-led teardown of the local-LLM (Ollama) sample agent deployment on Azure Container Apps created by deploy-agent-aca-dev. Use when the user wants to delete the dev sample ACA deployment, clean up the resource group, or optionally delete the Blueprint / Agent Identity / Client SPA. Defaults to DRY-RUN and keeps Entra objects unless the user explicitly opts in. NOT for local docker-compose (use `docker compose down -v`) and NOT for the AWS Bedrock variant (use teardown-agent-aca-aws).
In this repository7 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- n8n/.github/copilot-instructions.mdCopilot instructions
- deploy-agent-aca-awsSkill
- deploy-agent-aca-devSkill
- entra-agent-id-setupSkill
- teardown-agent-aca-awsSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 52
If keeping the Agent Identity, revoke existing consent so a redeploy starts clean:
- Distinctive: line 75
Ask per object. Order:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Teardown — Dev (Ollama) Agent on Azure Container Apps (AI-Led)
Reverses the deploy-agent-aca-dev skill. Deletes the Azure resource group and (opt-in) the Entra objects.
Paired with: deploy-agent-aca-dev. Uses the same /tmp/deploy-vars.sh.
When to Use
- User says: "tear down the dev ACA deployment", "delete the Ollama agent on Azure", "clean up the demo RG"
- User wants to re-run the deploy skill from a clean state
- User is ending a demo and needs to remove billable resources (ACA, ACR with Ollama images, Log Analytics)
Do NOT Use When
- Local docker-compose —
cd sidecar/dev && docker compose down -vis enough - AWS variant — use teardown-agent-aca-aws (handles IAM role, OIDC provider, intermediary app)
- Shared / long-lived tenants — confirm the Blueprint and Client SPA are not shared with other agents first
Safety posture
- Dry-run by default (
DRY_RUN=1). User must setDRY_RUN=0to actually delete. - Entra objects are opt-in (
DELETE_ENTRA=1). Default keeps them. - Confirm tenant + subscription + RG with the user first — the user has multiple Azure accounts.
- Re-confirm before deleting the Blueprint. Blueprints are often shared.
Prerequisites
/tmp/deploy-vars.shfrom the original deployment (at minimumSUBSCRIPTION_ID,RG).azlogged in to the correct tenant + subscription.- Graph role sufficient to delete Entra apps (only if
DELETE_ENTRA=1):Application Administratoror higher.
Procedure
Step 0 — Confirm scope
Teardown plan (dev / Ollama):
Subscription: $SUBSCRIPTION_ID
Resource group: $RG (WILL be deleted)
Delete Entra objects: $DELETE_ENTRA
Dry run: $DRY_RUN
Proceed? [y/N]Step 1 — Revoke OAuth consent grants on the Agent SP
If keeping the Agent Identity, revoke existing consent so a redeploy starts clean:
AGENT_SP_OID=$(az ad sp show --id "$AGENT_CLIENT_ID" --query id -o tsv 2>/dev/null)
if [[ -n "$AGENT_SP_OID" ]]; then
az rest --method GET \
--uri "https://graph.microsoft.com/v1.0/oauth2PermissionGrants?\$filter=clientId eq '$AGENT_SP_OID'" \
--query 'value[].id' -o tsv | while read -r g; do
az rest --method DELETE --uri "https://graph.microsoft.com/v1.0/oauth2PermissionGrants/$g"
done
fiStep 2 — Delete the resource group
az group delete --name "$RG" --yes --no-waitThis removes the Container App, ACA environment, ACR (with the ~1–4 GB baked Ollama image), Log Analytics workspace, and user-assigned managed identity in one shot.
Step 3 — Delete Entra objects (opt-in: DELETE_ENTRA=1)
Ask per object. Order:
- Client SPA (
CLIENT_SPA_APP_ID) — safe if no other agent reuses it. - Agent Identity — delete via Agent ID portal or Graph (
DELETE /agentIdentities/{id}). - Blueprint (
BLUEPRINT_APP_ID) — ASK AGAIN. Blueprints are often shared.
az ad app delete --id "$CLIENT_SPA_APP_ID" 2>/dev/null || true
# Agent + Blueprint: prompt explicitly, then call GraphStep 4 — Verify
az group exists --name "$RG" # expect: false
az ad app show --id "$CLIENT_SPA_APP_ID" 2>&1 | head -1 # expect: not found (if DELETE_ENTRA=1)Orchestrator
Single-entry-point script: scripts/teardown-aca-dev.sh.
# Dry run (default)
bash .claude/skills/teardown-agent-aca-dev/scripts/teardown-aca-dev.sh
# Real teardown, Azure only
DRY_RUN=0 bash .claude/skills/teardown-agent-aca-dev/scripts/teardown-aca-dev.sh
# Full teardown (incl. Entra apps)
DRY_RUN=0 DELETE_ENTRA=1 \
bash .claude/skills/teardown-agent-aca-dev/scripts/teardown-aca-dev.shCommon failure modes
| Symptom | Cause | Fix |
az group delete hangs | ACR still has replications or a KV with purge protection is in the RG | Check RG contents with az resource list -g "$RG"; delete the stuck resource manually |
Authorization_RequestDenied on az ad app delete | Signing-in user lacks Application Administrator on the app | Elevate via PIM or have the app owner run it |
| FIC cleanup leaves orphaned entries on Blueprint | MI deleted by az group delete | Inert; clean with az ad app federated-credential list/delete if cosmetic |
Baked Ollama image still billing after az group delete completes | ACR has a soft-delete retention window | Check: az acr list --query "[].{n:name,p:properties.policies.softDeletePolicy.status}"; purge if present |
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

