Ai Foundry Posture Check logo

Ai Foundry Posture Check

Community
ricmmartins
ai-foundry-posture-check

Assess security, reliability, and cost posture of Azure OpenAI and Microsoft Foundry deployments. Detects critical anti-patterns: API keys instead of Managed Identity, public endpoints without firewall, disabled content filtering, missing diagnostic settings, deprecated model versions, over-provisioned PTU, absence of AI Gateway (APIM) for rate limiting, shared dev/prod deployments, quota exhaustion risk, 429 throttling rates, runaway token consumption, and single-region deployment. Use when asked about AI workload security, OpenAI best practices, Foundry health check, model deployment review, AI cost optimization, quota monitoring, or throttling analysis.

Overview

Publisherricmmartins
Repositoryazure-sre-agent-skills
Skill nameai-foundry-posture-check
Stars
70
Forks
14
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by ricmmartins on GitHub. Read the source before you install it.

Installation

Install the Ai Foundry Posture Check AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/ricmmartins/azure-sre-agent-skills/tree/main/skills/08-ai-foundry-posture
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ricmmartins/azure-sre-agent-skills.git /tmp/azure-sre-agent-skills
mkdir -p .claude/skills
cp -r /tmp/azure-sre-agent-skills/skills/08-ai-foundry-posture .claude/skills/ai-foundry-posture-check
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Ai Foundry Posture Check in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Ai Foundry Posture Check on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Ai Foundry Posture Check is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

AI Foundry & OpenAI Posture Check

Purpose

Assess the security, reliability, and cost efficiency of Azure OpenAI and Microsoft Foundry deployments. Detects the most common anti-patterns that startups make when building AI-powered products — from exposed endpoints to runaway token costs.

Based on the Azure Well-Architected Framework for AI workloads and Microsoft Foundry operational best practices.

When to use this skill

  • User asks "is our OpenAI deployment secure?"
  • User asks about AI cost optimization or token consumption
  • Review before going to production with an AI feature
  • User asks about content filtering, model versions, or rate limiting
  • Periodic AI workload health check

Pre-check

Confirm with the user:

  • Which Azure OpenAI / Cognitive Services accounts to assess (or "all in subscription")
  • Whether they use PTU (Provisioned Throughput) or Standard deployments
  • Whether they have production AI workloads already live

Assessment procedure

Step 0: Discover AI resources

bash
az cognitiveservices account list \
  --subscription <sub-id> \
  --query "[?kind=='OpenAI' || kind=='AIServices'].{name:name, kind:kind, rg:resourceGroup, location:location, sku:sku.name}" \
  -o table

If no results, try:

bash
az cognitiveservices account list \
  --subscription <sub-id> \
  --query "[].{name:name, kind:kind, rg:resourceGroup, location:location}" \
  -o table

If no Cognitive Services accounts exist, report "No Azure OpenAI or AI Foundry resources found" and end assessment.

For each account found, run the following checks:


🔐 CATEGORY 1 — Security (Critical)

Check 1.1 — Managed Identity enabled (not API keys only)

bash
az cognitiveservices account show \
  --name <account> --resource-group <rg> \
  --query "{identity:identity.type, disableLocalAuth:properties.disableLocalAuth}" \
  -o json
FindingSeverityScore
identity.type = SystemAssigned/UserAssigned AND disableLocalAuth = true✅ Pass12 pts
identity.type set but disableLocalAuth = false⚠️ Partial6 pts
identity.type = None or null❌ Fail0 pts

📖 https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/managed-identity

Check 1.2 — Network isolation (firewall or private endpoint)

bash
az cognitiveservices account show \
  --name <account> --resource-group <rg> \
  --query "{publicAccess:properties.publicNetworkAccess, defaultAction:properties.networkAcls.defaultAction, privateEndpoints:properties.privateEndpointConnections}" \
  -o json
FindingSeverityScore
publicNetworkAccess = Disabled + private endpoints exist✅ Pass13 pts
defaultAction = Deny + IP/VNet rules configured✅ Pass13 pts
defaultAction = Allow (open to internet)❌ Fail0 pts

📖 https://learn.microsoft.com/en-us/azure/ai-services/cognitive-services-virtual-networks

Check 1.3 — Content filtering (RAI policies)

bash
az rest --method get \
  --url "https://management.azure.com/subscriptions/<sub-id>/resourceGroups/<rg>/providers/Microsoft.CognitiveServices/accounts/<account>/raiPolicies?api-version=2024-10-01"

Then check deployments have a policy assigned:

bash
az cognitiveservices account deployment list \
  --name <account> --resource-group <rg> \
  --query "[].{name:name, model:properties.model.name, raiPolicy:properties.raiPolicyName}" \
  -o table
FindingSeverityScore
All deployments have RAI policy assigned with filters enabled✅ Pass10 pts
Some deployments missing policy or using minimal filters⚠️ Partial5 pts
No RAI policies or content filtering disabled❌ Fail0 pts

📖 https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/content-filters

⚙️ CATEGORY 2 — Reliability & Operations

Check 2.1 — Model version pinned and not deprecated

bash
az cognitiveservices account deployment list \
  --name <account> --resource-group <rg> \
  --query "[].{name:name, model:properties.model.name, version:properties.model.version}" \
  -o table

Cross-reference with available models:

bash
az cognitiveservices account list-models \
  --name <account> --resource-group <rg> \
  --query "[].{model:model.name, version:model.version, lifecycle:model.lifecycleStatus}" \
  -o table
FindingSeverityScore
All deployments on GA versions with explicit version pinned✅ Pass7 pts
Deployments on versions nearing retirement (< 3 months)⚠️ Attention3 pts
Deployments on Legacy/Deprecated versions❌ Fail0 pts

📖 https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/model-retirements

Check 2.2 — Diagnostic settings enabled

bash
# Get resource ID
RESOURCE_ID=$(az cognitiveservices account show \
  --name <account> --resource-group <rg> --query "id" -o tsv)

az monitor diagnostic-settings list --resource $RESOURCE_ID -o json
FindingSeverityScore
Diagnostic settings sending RequestResponse + Audit to Log Analytics✅ Pass7 pts
Diagnostic settings exist but incomplete (only metrics, no logs)⚠️ Partial3 pts
No diagnostic settings at all❌ Fail0 pts

📖 https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/monitoring

Check 2.3 — Resource Lock on production account

bash
az lock list --resource-group <rg> \
  --query "[?contains(id, '<account>')].{name:name, level:level}" \
  -o table
FindingSeverityScore
CanNotDelete lock exists on the OpenAI account✅ Pass5 pts
Lock exists on RG but not specifically on account⚠️ Partial3 pts
No locks❌ Fail0 pts

📖 https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/lock-resources

Check 2.4 — Multi-region resilience (failover capability)

Check if OpenAI accounts exist in more than one region (disaster recovery / latency optimization):

bash
az cognitiveservices account list \
  --subscription <sub-id> \
  --query "[?kind=='OpenAI' || kind=='AIServices'].{name:name, location:location, rg:resourceGroup}" \
  -o table

Group by location and count unique regions:

FindingSeverityScore
OpenAI accounts in 2+ different regions✅ Pass5 pts
All OpenAI accounts in a single region⚠️ Risk2 pts
Only 1 OpenAI account total (single point of failure)❌ Risk0 pts

📖 https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/business-continuity-disaster-recovery

Context from the field: Customers with single-region deployments face outages during regional capacity events. Multi-region + APIM load balancing (Check 4.1) is the recommended pattern for production AI workloads.

Check 2.5 — 429 throttling rate (last 24 hours)

Requires diagnostic settings sending logs to Log Analytics (Check 2.2). If diagnostics are not configured, skip and note dependency.

kusto
AzureDiagnostics
| where TimeGenerated > ago(24h)
| where ResourceProvider == "MICROSOFT.COGNITIVESERVICES"
| where Category == "RequestResponse"
| summarize 
    TotalRequests = count(),
    ThrottledRequests = countif(resultSignature_d == 429),
    ThrottleRate = round(100.0 * countif(resultSignature_d == 429) / count(), 2)
  by Resource, properties_s
| order by ThrottleRate desc

Use execute_kusto_query with the Log Analytics workspace connected to the OpenAI account's diagnostic settings.

FindingSeverityScore
Throttle rate < 1% in last 24h✅ Pass6 pts
Throttle rate 1–10% (occasional bursts)⚠️ Attention3 pts
Throttle rate > 10% (active capacity problem)❌ Fail0 pts
No diagnostic data available (Check 2.2 failed)⚠️ Skip0 pts — flag dependency

📖 https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/quota

Context from the field: Customers assume PTU eliminates throttling — it does not. Bursty traffic and concurrency limits can cause 429s even on PTU. Check APIM retry/spillover pattern (Check 4.1) as mitigation.


💰 CATEGORY 3 — Cost & Efficiency

Check 3.1 — Rate limits configured per deployment (not max)

bash
az cognitiveservices account deployment list \
  --name <account> --resource-group <rg> \
  --query "[].{name:name, model:properties.model.name, sku:sku.name, capacity:sku.capacity}" \
  -o table
FindingSeverityScore
Each deployment has explicit TPM capacity set (not maximum)✅ Pass5 pts
Single deployment consuming all available quota⚠️ Risk2 pts
Unable to determine (no deployments)N/A5 pts

📖 https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/quota

Check 3.2 — Model selection diversity (not GPT-4o for everything)

bash
az cognitiveservices account deployment list \
  --name <account> --resource-group <rg> \
  --query "[].{name:name, model:properties.model.name}" \
  -o table
FindingSeverityScore
Mix of models (e.g., gpt-4o + gpt-4o-mini, or batch deployments)✅ Pass3 pts
Only premium models deployed (no cost-efficient alternative)⚠️ Info1 pt
Single deployment onlyN/A3 pts

📖 https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models

Check 3.3 — PTU utilization (if applicable)

Only check if PTU/Provisioned deployments exist:

bash
az cognitiveservices account deployment list \
  --name <account> --resource-group <rg> \
  --query "[?sku.name=='ProvisionedManaged'].{name:name, capacity:sku.capacity}" \
  -o table

If PTU deployments exist, check utilization via metrics:

bash
az rest --method get \
  --url "https://management.azure.com<resource-id>/providers/microsoft.insights/metrics?api-version=2019-07-01&metricnames=ProvisionedManagedUtilizationV2&timespan=P7D&interval=PT1H&aggregation=Average"
FindingSeverityScore
PTU utilization 70–85% average (well-sized)✅ Pass7 pts
PTU utilization < 50% (over-provisioned — burning money)⚠️ Waste2 pts
PTU utilization > 95% (under-provisioned — users getting 429s)⚠️ Risk4 pts
No PTU deployments (using Standard — fine for most startups)N/A7 pts

📖 https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/provisioned-throughput

Check 3.4 — Quota utilization (TPM used vs limit)

bash
az cognitiveservices account list-usage \
  --name <account> --resource-group <rg> \
  -o json

Alternative if the above returns empty (common for newer deployments):

bash
az rest --method get \
  --url "https://management.azure.com/subscriptions/<sub-id>/providers/Microsoft.CognitiveServices/locations/<location>/usages?api-version=2024-10-01"
FindingSeverityScore
Quota usage < 70% of limit across all models✅ Pass5 pts
Quota usage 70–90% (nearing limit — plan increase)⚠️ Attention3 pts
Quota usage > 90% (at risk of rejection — request increase NOW)❌ Risk0 pts
Unable to retrieve usage data⚠️ Info3 pts

📖 https://learn.microsoft.com/en-us/azure/ai-services/openai/quotas-limits

Context from the field: Approved TPM quotas sometimes don't appear in Foundry due to subscription/project mismatches or the new Global/Data Zone quota pooling model. If usage data looks incorrect, verify the quota was assigned to the correct subscription and region.

Check 3.5 — Token consumption trend (tokens per day per deployment)

Requires diagnostic settings sending logs to Log Analytics (Check 2.2). If diagnostics are not configured, skip and note dependency.

kusto
AzureDiagnostics
| where TimeGenerated > ago(7d)
| where ResourceProvider == "MICROSOFT.COGNITIVESERVICES"
| where Category == "RequestResponse"
| extend model = tostring(parse_json(properties_s).modelName)
| extend promptTokens = toint(parse_json(properties_s).promptTokens)
| extend completionTokens = toint(parse_json(properties_s).completionTokens)
| summarize 
    DailyPromptTokens = sum(promptTokens),
    DailyCompletionTokens = sum(completionTokens),
    DailyTotalTokens = sum(promptTokens) + sum(completionTokens),
    RequestCount = count()
  by bin(TimeGenerated, 1d), Resource, model
| order by TimeGenerated desc, DailyTotalTokens desc

Use execute_kusto_query with the Log Analytics workspace.

FindingSeverityScore
Token consumption stable or declining (no runaway growth)✅ Pass5 pts
Token consumption growing > 20% day-over-day (investigate)⚠️ Attention2 pts
Token consumption spiking > 50% day-over-day (possible prompt leak or loop)❌ Risk0 pts
No diagnostic data available (Check 2.2 failed)⚠️ Skip0 pts — flag dependency

📖 https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/monitoring

Context from the field: Unmonitored token growth is the #1 surprise cost driver for startups using OpenAI. A single prompt injection loop or chatbot without max_tokens can burn through thousands of dollars in a weekend.


🏗️ CATEGORY 4 — Architecture Patterns

Check 4.1 — AI Gateway / APIM in front of OpenAI (for production)

bash
az apim list --subscription <sub-id> \
  --query "[].{name:name, sku:sku.name, rg:resourceGroup}" \
  -o table
FindingSeverityScore
APIM exists with OpenAI-related APIs configured✅ Pass5 pts
No APIM — calls go directly to OpenAI endpoint⚠️ Risk0 pts
N/A (dev/test environment only)N/A5 pts

📖 https://learn.microsoft.com/en-us/azure/api-management/api-management-authenticate-authorize-azure-openai

Check 4.2 — Environment separation (dev ≠ prod for AI resources)

bash
az cognitiveservices account list \
  --subscription <sub-id> \
  --query "[?kind=='OpenAI'].{name:name, rg:resourceGroup, tags:tags}" \
  -o json
FindingSeverityScore
Separate accounts or deployments for dev/prod with tags✅ Pass5 pts
Single account with environment tag but shared deployments⚠️ Partial2 pts
Single account, no separation, no tags❌ Fail0 pts

📖 https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/landing-zone/design-area/resource-org-subscriptions

Scoring

CategoryChecksMax Points
🔐 Security (Identity, Network, Content Filter)1.1–1.335
⚙️ Reliability (Model version, Diagnostics, Locks, Multi-region, 429 monitoring)2.1–2.530
💰 Cost & Efficiency (Rate limits, Model mix, PTU, Quota, Token trend)3.1–3.525
🏗️ Architecture (Gateway, Env separation)4.1–4.210
TOTAL15 checks100

Maturity levels

ScoreLevelMeaning
0–39🔴 CriticalMajor security and operational gaps — not production-ready
40–69🟡 DevelopingSome controls in place but significant risks remain
70–89🟢 SolidGood posture — minor improvements recommended
90–100🏆 ExemplaryFollowing WAF best practices for AI workloads

Accepted exceptions (optional)

If the user provides a list of accepted exceptions, do not flag those items. Instead, note them in the report as Accepted Exception with the reason provided.

Example format the user may provide:

CheckReason
1.2 Network isolationPublic endpoint required for third-party SaaS integration
1.3 Content filteringCustom RAI policy approved by security team for internal tool
3.3 PTU utilizationPTU capacity pre-provisioned for upcoming product launch

When exceptions are provided:

  • Skip the flagged checks in scoring
  • List them in a separate "Accepted Exceptions" section at the end of the report
  • Recalculate the overall score excluding excepted checks

Expected output

Report header (mandatory — use this exact format)

AI Foundry & OpenAI Posture Check Report

FieldValue
ScoreXX / 100
Level🟡 Developing
Accounts AssessedN (list names)
Deployments FoundM (model details)
Assessment DateYYYY-MM-DD

Per-account findings

For each OpenAI/AI Services account:

CheckStatusFindingRecommendation
Managed Identity❌API keys enabled, no MIEnable System MI + set disableLocalAuth=true
Network⚠️Public access enabled, no firewallSet defaultAction=Deny + add VNet rules
............

Critical findings (fix immediately)

Security issues that expose the AI endpoint or violate responsible AI principles.

Cost optimization opportunities

Token waste, PTU over-provisioning, or model selection improvements with estimated savings.

Architecture recommendations

Patterns to improve resilience: AI Gateway, retry policies, multi-region deployment.

Remediation guidance

For each ❌ or ⚠️ finding, include in the output:

  1. The specific az CLI command to remediate (suggest only — do not execute)
  2. Use GetAzCliHelp to validate the command syntax before suggesting
  3. Include the 📖 documentation link from the check that failed

References

Sample output

The following is a redacted example of what the report looks like when run against a subscription.

AI Foundry & OpenAI Posture Check Report

FieldValue
Score61 / 100
Level🟡 Developing
Accounts Assessed2 (oai-contoso-prod, oai-contoso-dev)
Deployments Found5 (gpt-4o, gpt-4o-mini, text-embedding-ada-002, gpt-4o x2)
Assessment Date2026-07-15

Per-account findings (sample — oai-contoso-prod)

CheckStatusFindingRecommendation
1.1 Managed Identity⚠️System MI enabled but disableLocalAuth=falseSet disableLocalAuth=true to block API key access
1.2 Network isolation❌publicNetworkAccess=Enabled, no firewall rulesSet defaultAction=Deny + add VNet rules
1.3 Content filtering✅All deployments have RAI policy contoso-standard assigned—
2.1 Model version⚠️gpt-4o deployment on version 2024-05-13 retiring in 60 daysUpgrade to 2024-08-06
2.2 Diagnostic settings✅RequestResponse + Audit logs → law-contoso-prod—
2.3 Resource lock❌No CanNotDelete lock on oai-contoso-prodAdd lock
2.4 Multi-region✅Accounts in East US + West Europe—
3.1 Rate limits✅Each deployment has explicit TPM capacity set—
3.2 Model diversity✅Mix of gpt-4o + gpt-4o-mini for cost efficiency—
4.1 AI Gateway (APIM)❌No APIM instance foundDeploy APIM with OpenAI backend

Cost optimization opportunities (sample)

FindingCurrent CostPotential SavingsAction
gpt-4o used for simple classification tasks~$420/mo~$340/mo (80%)Route to gpt-4o-mini
Dev account oai-contoso-dev idle on weekends~$85/mo~$25/mo (30%)Reduce dev TPM allocation

Remediation commands (sample)

bash
# Disable local API key authentication
az cognitiveservices account update --name oai-contoso-prod --resource-group rg-ai-prod --set properties.disableLocalAuth=true

# Set network firewall to deny by default
az cognitiveservices account update --name oai-contoso-prod --resource-group rg-ai-prod --set properties.networkAcls.defaultAction=Deny

# Add resource lock
az lock create --name CanNotDelete --resource-group rg-ai-prod --resource oai-contoso-prod --resource-type Microsoft.CognitiveServices/accounts --lock-type CanNotDelete

Frequently asked questions

What does the Ai Foundry Posture Check AI skill do?

Assess security, reliability, and cost posture of Azure OpenAI and Microsoft Foundry deployments. Detects critical anti-patterns: API keys instead of Managed Identity, public endpoints without firewall, disabled content filtering, missing diagnostic settings, deprecated model versions, over-provisioned PTU, absence of AI Gateway (APIM) for rate limiting, shared dev/prod deployments, quota exhaustion risk, 429 throttling rates, runaway token consumption, and single-region deployment. Use when asked about AI workload security, OpenAI best practices, Foundry health check, model deployment revi...

Why use Ai Foundry Posture Check on TypingMind?

Because you install it once and use it with any model. Ai Foundry Posture Check is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Ai Foundry Posture Check in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/ricmmartins/azure-sre-agent-skills/tree/main/skills/08-ai-foundry-posture. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Ai Foundry Posture Check?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Ai Foundry Posture Check?

As many as you like. As long as a model supports skills, you can use Ai Foundry Posture Check with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Ai Foundry Posture Check AI skill free?

Yes. It is published on GitHub by ricmmartins under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇