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

validating-local-setup

Skill124 starsChanged 7 months agoMITView on GitHub

Diagnose and fix incomplete local development setup. Use when dev servers fail to start, env vars are missing, authentication errors occur, or before running any dev commands for the first time.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 3 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If you came from the portal, paste those values and run azd up — it detects them and incorporates them automatically.

    line 21
  2. Distinctive:

    Run the validation script to check all configuration:

    line 25
  3. Very specific:

    Fix: Run azd up — this creates the Entra app and generates frontend/.env.local.

    line 73
  4. Very specific:

    Fix: Run azd up, then restart the dev server.

    line 81
  5. Very specific:

    Fix: Ensure AzureAd__ClientId matches the Entra app registration.

    line 85
  6. Distinctive:

    Restart dev servers: after any fix — env vars are read at startup.

    line 113
  7. Very specific:

    Before executing dotnet watch run, npm run dev, or start-local-dev.ps1:

    line 117
  8. Very specific:

    Check if frontend/.env.local exists

    line 119
  9. Very specific:

    If either is missing, tell the user to run azd up first

    line 121
  10. Distinctive:

    Do NOT try to create these files manually — they contain auto-generated Entra app registration IDs

    line 122

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

Local Setup Validation

Portal vs azd up — What Each Provides

The AI Foundry portal's "View sample app code" gives you AI resource variables (AI_AGENT_ENDPOINT, AI_AGENT_ID), which identify your agent. However, this app also needs an Entra ID app registration for user authentication — which only azd up creates. Both sets of config are required.

SourceWhat It ProvidesConfig It Generates
AI Foundry portalAgent endpoint + agent IDRoot .env (or manual azd env set)
azd upEntra app registration, RBAC, infrastructurefrontend/.env.local + backend/WebApp.Api/.env

If you came from the portal, paste those values and run azd up — it detects them and incorporates them automatically.

Quick Diagnostic

Run the validation script to check all configuration:

pwsh -File deployment/scripts/validate-config.ps1

This checks for frontend/.env.local and backend/WebApp.Api/.env with the core authentication variables. For a full list of required variables, see the tables below.

What azd up Creates

This app requires azd up before local development works. Here's what it provisions:

WhatWhyGenerated File
Entra ID app registrationSPA authentication (MSAL.js)frontend/.env.local
Backend auth configJWT token validationbackend/WebApp.Api/.env
Azure infrastructureContainer Apps, ACR, RBAC.azure/<env>/.env
Redirect URIsLogin callback URLsEntra app registration

Even if AI Foundry resources already exist (e.g., from the portal "View sample app code" flow), azd up is still required to create the Entra app registration.

Required Environment Variables

Frontend (frontend/.env.local)

VariableSourceRequired
VITE_ENTRA_SPA_CLIENT_IDEntra app registration (created by azd up)Yes
VITE_ENTRA_TENANT_IDAzure AD tenantYes
VITE_ENTRA_BACKEND_CLIENT_IDBackend app registration (OBO mode only)No

Backend (backend/WebApp.Api/.env)

VariableSourceRequired
AzureAd__TenantIdAzure AD tenantYes
AzureAd__ClientIdEntra app registrationYes
AzureAd__Audienceapi://{ClientId}Yes
AI_AGENT_ENDPOINTAI Foundry project endpointYes
AI_AGENT_IDAgent name in FoundryYes

Common Error Patterns

"undefined" in login URL

login.microsoftonline.com/undefined/oauth2/v2.0/authorize?client_id=undefined

Cause: VITE_ENTRA_SPA_CLIENT_ID and VITE_ENTRA_TENANT_ID not set. Fix: Run azd up — this creates the Entra app and generates frontend/.env.local.

AADSTS900023: Specified tenant identifier is neither a valid DNS name

Cause: Same as above — tenant ID is undefined or empty. Fix: Run azd up.

Frontend shows "Setup Required" error page

Cause: The Vite env check plugin detected missing environment variables. Fix: Run azd up, then restart the dev server.

401 Unauthorized on /api/* endpoints

Cause: Backend JWT validation failing — check backend/WebApp.Api/.env. Fix: Ensure AzureAd__ClientId matches the Entra app registration. Run azd provision to regenerate.

ManagedIdentityCredential error in local dev

Cause: Backend trying to use managed identity locally. Fix: Set ASPNETCORE_ENVIRONMENT=Development — local dev uses ChainedTokenCredential(AzureCliCredential, AzureDeveloperCliCredential) instead.

Step-by-Step Fix for Incomplete Setup

  1. Check current state:
    pwsh -File deployment/scripts/validate-config.ps1
  2. If no .azure/ directory (never ran azd):
    azd up
  3. If .azure/ exists but env files missing (partial setup):
    azd provision   # Re-creates Entra app + generates .env files
  4. If env files exist but vars are wrong (stale config):
    azd provision   # Regenerates everything
  5. Restart dev servers after any fix — env vars are read at startup.

For Agents: Before Running Dev Commands

Before executing dotnet watch run, npm run dev, or start-local-dev.ps1:

  1. Check if frontend/.env.local exists
  2. Check if backend/WebApp.Api/.env exists
  3. If either is missing, tell the user to run azd up first
  4. Do NOT try to create these files manually — they contain auto-generated Entra app registration IDs

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.