teardown-agent-aca-dev
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).
- License 许可
- MIT
- 最近更新
- 2026-08-06
- Stars
- ★ 15
- Forks
- 8
01 前言 Front Matter
- name
- teardown-agent-aca-dev
- description
- 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).
02 资源文件 1
- 脚本scripts/teardown-aca-dev.sh4.1 KB
03 SKILL.md 正文
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
fi
Step 2 — Delete the resource group
az group delete --name "$RG" --yes --no-wait
This 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 Graph
Step 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.sh
Common 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
04 同仓库更多 Skills
teardown-agent-aca-aws
AI-led teardown of the AWS Bedrock sample agent deployment on Azure Container Apps created by deploy-agent-aca-aws. Use when the user wants to delete the AWS sample ACA deployment, clean up the resource group, remove the AWS IAM role + OIDC provider, delete the intermediary Entra app, or optionally delete the Blueprint / Agent Identity / Client SPA. Defaults to DRY-RUN and keeps Entra/AWS objects unless the user explicitly opts in. NOT for local docker-compose (no cloud resources to delete) and NOT for GCP (pending).
entra-agent-id-setup
AI-guided setup for Microsoft Entra Agent ID. Use when the user wants to provision an Agent Identity Blueprint, Agent Identity, and OBO client app in an Entra tenant; when configuring the dev/AWS/GCP sidecar stack; when debugging 403 Authorization_RequestDenied on blueprint creation; when checking which Entra role is required (Global Admin / Agent ID Administrator / Agent ID Developer); when running Start-EntraAgentIDWorkflow / setup-obo-client-app / setup-obo-blueprint.
deploy-agent-aca-dev
AI-led deployment of the local-LLM sample agent (Ollama + Microsoft Entra Agent ID sidecar) to Azure Container Apps. Use when the user wants to deploy sidecar/dev to ACA, run the agent on Azure without AWS/GCP, host Ollama on Container Apps, promote the docker-compose local-dev stack from ClientSecret to SignedAssertionFromManagedIdentity (secretless), or debug AADSTS65001/AADSTS50011/ImagePullBackOff/Ollama OOM errors in this specific deployment. NOT for AWS Bedrock (use deploy-agent-aca-aws) and NOT for local docker-compose on a laptop (use sidecar/dev directly). Chains to entra-agent-id-setup for the Blueprint + Agent Identity + Client SPA objects.
deploy-agent-aca-aws
AI-led deployment of the AWS Bedrock sample agent with the Microsoft Entra Agent ID sidecar to Azure Container Apps. Use when the user wants to deploy the AWS sample to ACA, provision the AWS-federation intermediary Entra app, wire the token refresher, create the AWS OIDC provider and IAM role for Bedrock, build and push the four container images to ACR, or debug InvalidIdentityToken / AADSTS65001 / Directory.AccessAsUser.All / AcrPull errors in this specific deployment. NOT for local docker-compose (use sidecar/dev) and NOT for GCP (deploy-agent-aca-gcp, pending). Chains to entra-agent-id-setup for the Blueprint + Agent Identity + Client SPA objects.