agentleFS
MicrosoftKnown publishermicrosoft/agentic-journeys/journeys/smart-todo/checkpoints/phase-3/repo/.github/skills/flex-functions-sql-foundry/SKILL.md

flex-functions-sql-foundry

Skill5 starsChanged 46 days agoMITView on GitHub

Scaffold and deploy an Azure Functions Flex Consumption API with Azure SQL through managed identity and Microsoft Foundry. USE FOR: serverless APIs that need Flex Consumption, managed-identity Azure SQL access, Microsoft Foundry models, and deterministic azd/Bicep infrastructure. DO NOT USE FOR: Container Apps, AKS, SQL password authentication, non-HTTP workloads that need independent scaling, or projects that cannot use Azure CLI and azd.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 4 are distinctive, and 4 are 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.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill for an Azure Functions Flex Consumption API that connects to Azure SQL through managed identity and calls a Microsoft …

    line 13
  2. Distinctive:

    Do not deploy until the gate passes.

    line 33
  3. Very specific:

    Run node scripts/check-infra.mjs before azd up.

    line 36
  4. Very specific:

    Do not set FUNCTIONS_WORKER_RUNTIME.

    line 65
  5. Very specific:

    Add the azd-service-name: api tag to the Function App.

    line 67
  6. Distinctive:

    Use the SQL server resource's FQDN.

    line 76
  7. Very specific:

    Create a raw Cognitive Services model deployment in a separate nested module after its account to avoid RequestConflict.

    line 83
  8. Distinctive:

    Never print secrets, connection strings, app-setting values, developer IPs, or run-specific subscription, principal, or resource …

    line 94

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

Flex Functions with SQL and Foundry

When to Use

Use this skill for an Azure Functions Flex Consumption API that connects to Azure SQL through managed identity and calls a Microsoft Foundry model.

Required Inputs

Collect these before generating infrastructure:

  • Application name: 3-31 lowercase letters, numbers, and hyphens, starting with a letter
  • Runtime language: an azd-supported value such as ts, python, csharp, or java
  • Azure region: verify SQL and model availability there
  • Foundry model name and region-supported model version

Also resolve the deploying principal's ID, login, and type (User or ServicePrincipal) before provisioning. Never guess missing identity values.

Fast Path and Gate

  1. Run node scripts/scaffold-infra.mjs --target <directory> --name <app-name>.
  2. Generate only application code or infrastructure changes the scaffold does not cover.
  3. Run node scripts/check-infra.mjs --offline.
  4. Do not deploy until the gate passes.
  5. Set the azd subscription, location, region-specific AZURE_AI_MODEL_VERSION, principal ID, login, and type values.
  6. Run node scripts/check-infra.mjs before azd up.

The scaffold and gate use only Node.js standard-library APIs and work from any current directory. Do not copy .azure/, .env files, node_modules/, or compiled Bicep JSON into a new project.

Resource Contract

  • One azd service named api, hosted on Azure Functions; device clients are not services.
  • Flex Consumption App Service plan with SKU FC1.
  • Function App with system-assigned identity for runtime/deployment storage and a user-assigned identity used only for Azure SQL.
  • functionAppConfig with a supported runtime, 2048 MB memory, maximum instance count, and deploymentpackage blob storage authenticated by system identity.
  • Storage with shared-key access disabled, default network action Allow, and a deploymentpackage container.
  • Grant the Function App Storage Blob Data Owner; grant the deployer Storage Blob Data Contributor; grant the Function App's system identity Cognitive Services OpenAI User on the Foundry account.
  • Azure SQL server with the deployer as Entra admin, an AllowAzureServices 0.0.0.0 firewall rule, and a Basic 2 GB database with zone redundancy off.
  • A post-provision JavaScript hook creates the SQL identity user by client-ID SID, idempotently grants reader, writer, and DDL admin roles, attempts every cleanup action even after a cleanup failure, and never uses a SQL password.
  • Microsoft Foundry/Azure OpenAI with local auth disabled (keyless) and the selected model; use GlobalStandard for gpt-5-mini.
  • Log Analytics and Application Insights.
  • Function settings for SQL and AI providers, endpoints, deployment, SQL FQDN/database/client ID (no AI key and no listKeys()), and identity-based AzureWebJobsStorage__accountName. Do not set FUNCTIONS_WORKER_RUNTIME; set siteConfig.alwaysOn to false.
  • Outputs use SCREAMING_SNAKE_CASE; API_URL is the origin without /api.
  • Add the azd-service-name: api tag to the Function App.

Known Deployment Gotchas

  • SQL and model availability varies by region. Try westus3, centralus, or southcentralus when needed, and query the region for the exact model version.
  • Basic Azure SQL rejects zone redundancy and limits maxSizeBytes to 2 GB.
  • SQL's Entra admin principal type is User or Application; map azd ServicePrincipal to Application. Avoid reserved words such as WINDOWS in names.
  • Use the SQL server resource's FQDN. Appending the Azure suffix incorrectly can produce a double dot, while a short name causes DNS failures.
  • For local SQL setup, temporarily add a developer-IP firewall rule. Switch a Redirect connection policy to Proxy if outbound ports 11000-11999 are blocked, and restore the policy and delete the rule in finally.
  • Storage deployment failures usually mean the default action is not Allow, the deployer lacks Blob Data Contributor, or deploymentpackage is missing.
  • Create a raw Cognitive Services model deployment in a separate nested module after its account to avoid RequestConflict.
  • Flex Consumption rejects alwaysOn: true and a duplicate FUNCTIONS_WORKER_RUNTIME setting.
  • Oryx TypeScript builds need src/ and tsconfig.json; do not exclude them.
  • Invoke hooks through argument arrays. On Windows, use a static PowerShell JSON-payload launcher so .cmd Azure CLI shims work safely.
  • Simulator Application failed preflight checks or SBMainWorkspace Busy errors require terminating or uninstalling the app, rebooting the simulator, then cleaning and rebuilding.

Never print secrets, connection strings, app-setting values, developer IPs, or run-specific subscription, principal, or resource identifiers.

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.