agentleFS
MicrosoftKnown publishermicrosoft-foundry/foundry-agent-webapp/.github/skills/validating-deployments/SKILL.md

validating-deployments

Skill124 starsChanged 7 months agoMITView on GitHub

End-of-session validation for MI and OBO deployment paths. Use after code changes to verify deploy → test → teardown works end-to-end.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run this at the end of any session that changes backend, frontend, infra, or auth code.

    line 10
  2. Very specific:

    All unit tests pass (dotnet test + npm test)

    line 14
  3. Distinctive:

    Run before every deployment:

    line 21
  4. Distinctive:

    Verify: health 200, agent name displayed, chat streaming works, token usage visible.

    line 54
  5. Distinctive:

    Run smoke test. OBO requires interactive MSAL login (user must sign in with test tenant credentials).

    line 105

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Validating Deployments

Run this at the end of any session that changes backend, frontend, infra, or auth code.

Prerequisites

  • All unit tests pass (dotnet test + npm test)
  • Frontend builds (npm run build)
  • Bicep validates (az bicep build --file infra/main.bicep)
  • Playwright installed (npx playwright install chromium)

Security Checks

Run before every deployment:

# Backend: check for vulnerable NuGet packages
cd backend && dotnet list package --vulnerable

# Frontend: check for vulnerable npm packages
cd frontend && npm audit

# Docker: lint Dockerfile for security issues (if hadolint installed)
hadolint deployment/docker/frontend.Dockerfile

The Dockerfile runs as non-root (USER app). Verify this hasn't been removed after changes.

MI Path (Default)

1. Deploy

azd env new mi-test --no-prompt
azd env set ENTRA_SERVICE_MANAGEMENT_REFERENCE "<guid-from-admin>"  # Required by some orgs
azd env set AZURE_LOCATION eastus2 --no-prompt
azd up --no-prompt

2. Test Remote

$endpoint = azd env get-value WEB_ENDPOINT
node deployment/scripts/smoke-test.js $endpoint

Verify: health 200, agent name displayed, chat streaming works, token usage visible.

3. Test Local Dev

cd backend/WebApp.Api
$env:ASPNETCORE_ENVIRONMENT = "Development"  # CRITICAL — without this, uses ManagedIdentityCredential which fails locally
$env:ASPNETCORE_URLS = "http://localhost:8080"
dotnet watch run --no-launch-profile &

cd ../../frontend
npm run dev &

# Wait for both servers, then:
node deployment/scripts/smoke-test.js http://localhost:5173

4. Teardown

azd down --force --purge --environment mi-test --no-prompt
# Verify:
# - frontend/.env.local deleted
# - backend/WebApp.Api/.env deleted
# - .azure/mi-test/ deleted
# - Entra app deleted (check azd logs)

OBO Path

1. Deploy

azd env new obo-test --no-prompt
azd env set ENABLE_OBO true --no-prompt
azd env set AZURE_LOCATION eastus2 --no-prompt
# No SMR needed if using a non-MSFT tenant
azd up --no-prompt

2. Verify OBO Wiring

# Check backend logs for OBO mode
az containerapp logs show --name <app-name> --resource-group <rg> --type console --tail 20 | Select-String "OBO"
# Expected: "OBO mode enabled: backendClientId=..."
# Expected: "Created OBO credential for request" (after first chat)

3. Test

Run smoke test. OBO requires interactive MSAL login (user must sign in with test tenant credentials). The smoke test will wait at auth if no cached session exists.

4. Teardown

Same as MI path. Additionally verify:

  • Backend API app registration deleted (postdown.ps1 handles this)
  • FIC removed with the app

Gotchas

GotchaDetail
ASPNETCORE_ENVIRONMENT=DevelopmentRequired for local dev — without it, backend tries ManagedIdentityCredential which fails on dev machines
SMR requiredSet ENTRA_SERVICE_MANAGEMENT_REFERENCE or Entra app creation fails
Bicep FIC creation may failGraph API eventual consistency issue. Workaround: create FIC via az ad app federated-credential create
v2 agent API requires kind: "prompt"When creating agents via REST, use definition: { kind: "prompt", model: "...", instructions: "..." }
OBO scope is api://{BACKEND}/Chat.ReadWriteNOT api://{SPA}/Chat.ReadWrite. Token audience mismatch = AADSTS500131
AI scope resolves to Azure ML Serviceshttps://ai.azure.com/.default → appId 18a66f5f-... (Azure Machine Learning Services), NOT 7d312290-... (Cognitive Services)
Conversation history not user-scoped in MI modeMI uses shared identity — all users see all conversations

Related Skills

  • testing-with-playwright — Playwright MCP patterns for interactive testing
  • validating-ui-features — Step-by-step UI feature validation
  • deploying-to-azure — azd commands and troubleshooting
  • troubleshooting-authentication — MSAL/JWT debugging

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.