<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Microsoft Azure in Practice - Medium]]></title>
        <description><![CDATA[Code-first Azure publication covering AI, .NET, Data, DevOps, Security, and cost optimization — real projects, reproducible examples, and measurable outcomes. - Medium]]></description>
        <link>https://medium.com/microsoft-azure-in-practice?source=rss----a34acb0c483c---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Microsoft Azure in Practice - Medium</title>
            <link>https://medium.com/microsoft-azure-in-practice?source=rss----a34acb0c483c---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 06:20:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/microsoft-azure-in-practice" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Zero-trust AI agents on Azure, provisioned with Terraform]]></title>
            <link>https://medium.com/microsoft-azure-in-practice/zero-trust-ai-agents-on-azure-provisioned-with-terraform-756ac0c4b7d3?source=rss----a34acb0c483c---4</link>
            <guid isPermaLink="false">https://medium.com/p/756ac0c4b7d3</guid>
            <category><![CDATA[microsoft-azure]]></category>
            <category><![CDATA[azure-agent]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[microsoft-foundry]]></category>
            <category><![CDATA[ai-agent-security]]></category>
            <dc:creator><![CDATA[Divyesh Govaerdhanan]]></dc:creator>
            <pubDate>Tue, 03 Nov 2026 20:28:20 GMT</pubDate>
            <atom:updated>2026-11-03T20:28:20.027Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Five controls every AI agent needs before it touches real data, written as code you can review, version, and prove.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mhiMRenWgHPIBVMwCjObaw.png" /><figcaption>Zero Trust AI Agent on Azure with Terraform</figcaption></figure><p>Most AI agent security on Azure lives in the portal. Someone toggles off public access, assigns a role, and tightens a content filter. It works on the day it’s done.</p><p>Then a second environment gets built from memory. A teammate re-enables API keys to debug something and forgets to turn them off. Six months later, nobody can say which agent has which controls, and the audit question “show me” has no good answer.</p><p>Infrastructure as code fixes that. When the security posture is a Terraform file, it’s reviewed in a pull request, it’s identical across environments, and drift shows up in the next plan.</p><p>In this article, you’ll provision a complete zero-trust agent stack on Azure with Terraform: a Microsoft Foundry project, a model deployment, and an agent running on Azure Container Apps. Every control maps to one letter of the AGENT framework, and every control is checked against the live resources at the end.</p><p>The full code is in the companion repo: <a href="https://github.com/divyeshg94/azure-agent-zero-trust-iac">github.com/divyeshg94/azure-agent-zero-trust-iac</a>. It works with both Terraform and OpenTofu.</p><h3>The AGENT framework in one table</h3><p>AGENT is a checklist for securing AI agents on Azure. Each letter is one control, and in this repo each control is one file.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatawrapper.dwcdn.net%2FQAepj%2F1%2F&amp;display_name=Datawrapper&amp;url=https%3A%2F%2Fdatawrapper.dwcdn.net%2FQAepj%2F1%2F&amp;image=https%3A%2F%2Fdatawrapper.dwcdn.net%2FQAepj%2Fplain-s.png%3Fv%3D1&amp;type=text%2Fhtml&amp;schema=dwcdn" width="600" height="487" frameborder="0" scrolling="no"><a href="https://medium.com/media/7b52dd26bd36cd2c0a30fa5ed07902be/href">https://medium.com/media/7b52dd26bd36cd2c0a30fa5ed07902be/href</a></iframe><p>One file per pillar is a deliberate choice. A reviewer can open grant.tf and see every permission the agent holds on one screen. In a real platform you&#39;d likely wrap these in modules, but for learning and for review, flat files read better.</p><h3>Before you start</h3><p>You’ll need Terraform 1.11 or later (or OpenTofu 1.11 or later), the Azure CLI, and a subscription where you can create role assignments. You also need model quota in your region. Check it with az cognitiveservices model list --location eastus2.</p><p>This stack targets <strong>AzureRM provider 5.x</strong>, released in July 2026. If you’re used to 4.x, a few things changed that matter here, and I’ll call them out as they come up. The first one shows up in the provider block:</p><pre>provider &quot;azurerm&quot; {<br>  subscription_id = var.subscription_id<br><br># azurerm 5.x registers no resource providers by default.<br>  # Register only what this stack needs, nothing more.<br>  resource_providers_to_register = [<br>    &quot;Microsoft.App&quot;,<br>    &quot;Microsoft.CognitiveServices&quot;,<br>    &quot;Microsoft.Insights&quot;,<br>    &quot;Microsoft.KeyVault&quot;,<br>    &quot;Microsoft.ManagedIdentity&quot;,<br>    &quot;Microsoft.Network&quot;,<br>    &quot;Microsoft.OperationalInsights&quot;,<br>  ]<br>  features {}<br>}</pre><p>In 4.x, the provider tried to register around 60 resource providers on every run. In 5.x, the default is none. That’s a small win for least privilege: the identity running Terraform no longer needs subscription-wide registration rights it never uses.</p><h3>A is for Authenticate: kill the API keys</h3><p>An API key is a password that never expires, can’t be scoped, and doesn’t say who used it. If your agent authenticates with one, anyone who reads the environment variables is your agent.</p><p>The fix is two parts. First, give the agent a managed identity. Second, make the Foundry resource refuse anything else.</p><pre>resource &quot;azurerm_user_assigned_identity&quot; &quot;agent&quot; {<br>  name                = &quot;id-agent-${local.suffix}&quot;<br>  location            = azurerm_resource_group.this.location<br>  resource_group_name = azurerm_resource_group.this.name<br>  tags                = local.tags<br>}<br><br>resource &quot;azurerm_cognitive_account&quot; &quot;foundry&quot; {<br>  name                = &quot;ais-${local.name}&quot;<br>  location            = azurerm_resource_group.this.location<br>  resource_group_name = azurerm_resource_group.this.name<br>  kind                = &quot;AIServices&quot;<br>  sku_name            = &quot;S0&quot;<br>  # Required for Entra ID token auth and for private endpoints.<br>  custom_subdomain_name = &quot;ais-${local.name}&quot;<br>  # Turns this account into a Foundry resource that can hold projects.<br>  project_management_enabled = true<br>  # With local auth off, API keys stop working. Entra ID is the only way in.<br>  local_auth_enabled = false<br>  public_network_access_enabled = false<br>  identity {<br>    type = &quot;SystemAssigned&quot;<br>  }<br>}</pre><p>Three lines carry the weight here.</p><p>kind = &quot;AIServices&quot; with project_management_enabled = true is how you create a current Foundry resource in Terraform. It&#39;s a Cognitive Services account under the hood, and projects live inside it as azurerm_cognitive_account_project.</p><p>custom_subdomain_name looks optional, but it isn&#39;t. Without it, Entra ID token auth and private endpoints both fail. You can&#39;t add it cleanly later either, since changing it forces a new resource.</p><p>local_auth_enabled = false is the line that matters most. The provider default is true. Leave it out and your resource accepts keys, no matter how carefully you wrote the rest.</p><h3>Why user-assigned instead of system-assigned?</h3><p>The Foundry resource itself uses a system-assigned identity, because it lives and dies with the resource. The agent gets a user-assigned identity for a different reason: Terraform can create it, assign its roles, and wait for those roles to exist before the container ever starts. With a system-assigned identity on the container app, the app has to exist first, so its first revision boots with no permissions and fails.</p><p>In your agent code, DefaultAzureCredential picks up this identity through one environment variable, AZURE_CLIENT_ID. No secret is involved at any point.</p><h3>G is for Grant: three roles, three scopes</h3><p>Authentication says who the agent is. Authorization says what it can do, and this is where most agent deployments are far too generous. Contributor on the resource group is common. It lets the agent delete the very resources it runs on.</p><p>This agent needs exactly three things, so it gets exactly three role assignments:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatawrapper.dwcdn.net%2F8i1Pv%2F1%2F&amp;display_name=Datawrapper&amp;url=https%3A%2F%2Fdatawrapper.dwcdn.net%2F8i1Pv%2F1%2F&amp;image=https%3A%2F%2Fdatawrapper.dwcdn.net%2F8i1Pv%2Fplain-s.png%3Fv%3D1&amp;type=text%2Fhtml&amp;schema=dwcdn" width="600" height="277" frameborder="0" scrolling="no"><a href="https://medium.com/media/92d8d636a29d2cc79125852a8948f309/href">https://medium.com/media/92d8d636a29d2cc79125852a8948f309/href</a></iframe><pre>locals {<br>  role_ids = {<br>    # Foundry User (formerly Azure AI User)<br>    foundry_user = &quot;53ca6127-db72-4b80-b1b0-d745d6d5456d&quot;<br><br># Key Vault Secrets User<br>    key_vault_secrets_user = &quot;4633458b-17de-408a-b874-0445c86b69e6&quot;<br>    # Monitoring Metrics Publisher<br>    monitoring_metrics_publisher = &quot;3913510d-42f4-4e42-8a64-420c390055eb&quot;<br>  }<br>  role_scope_prefix = &quot;/subscriptions/${var.subscription_id}/providers/Microsoft.Authorization/roleDefinitions&quot;<br>}<br><br>resource &quot;azurerm_role_assignment&quot; &quot;agent_foundry_user&quot; {<br>  scope              = azurerm_cognitive_account_project.agent.id<br>  role_definition_id = &quot;${local.role_scope_prefix}/${local.role_ids.foundry_user}&quot;<br>  principal_id       = azurerm_user_assigned_identity.agent.principal_id<br>  principal_type     = &quot;ServicePrincipal&quot;<br>  description        = &quot;AGENT/Grant: agent identity can use its Foundry project.&quot;<br>}</pre><p>The other two assignments follow the same pattern. Two details are worth stealing for your own code.</p><p><strong>Scope to the project, not the account.</strong> A Foundry account can hold many projects. Assigning Foundry User on the project means a second agent in a second project can’t see this one’s threads, files, or deployments.</p><p><strong>Reference roles by GUID, not by name.</strong> In 2026, Microsoft renamed the Azure AI roles. Azure AI User became Foundry User, Azure AI Owner became Foundry Owner, and so on. <a href="https://learn.microsoft.com/azure/foundry/concepts/rbac-foundry">Microsoft’s docs</a> note that the IDs and permissions didn’t change, but the names did, and you may still see the old names while the rename rolls out. Code that uses role_definition_name = &quot;Azure AI User&quot; is exactly the kind of thing that breaks quietly during a rename. A GUID never changes.</p><p>Setting principal_type = &quot;ServicePrincipal&quot; is a small fix with a real payoff. Without it, Azure tries to look the principal up in Entra ID, and a brand new managed identity often hasn&#39;t replicated yet. Your first apply fails with a principal-not-found error, and your second one works. This line makes the first one work.</p><h3>E is for Encrypt: keep every hop off the internet</h3><p>TLS protects data in transit, and Azure gives you that by default. Zero trust asks a harder question: why is this endpoint on the internet at all? For an agent, the honest answer is usually “it doesn’t need to be.”</p><p>The network has two subnets. One is delegated to Container Apps and runs the agent. The other holds private endpoints for Foundry and Key Vault, behind an NSG that accepts HTTPS from the apps subnet and nothing else.</p><pre>resource &quot;azurerm_subnet&quot; &quot;apps&quot; {<br>  name                 = &quot;snet-apps&quot;<br>  resource_group_name  = azurerm_resource_group.this.name<br>  virtual_network_name = azurerm_virtual_network.this.name<br><br># Workload profile environments need at least a /27. A /23 leaves room to scale.<br>  address_prefixes = [cidrsubnet(var.vnet_address_space, 7, 0)]<br>  delegation {<br>    name = &quot;container-apps&quot;<br>    service_delegation {<br>      name    = &quot;Microsoft.App/environments&quot;<br>      actions = [&quot;Microsoft.Network/virtualNetworks/subnets/join/action&quot;]<br>    }<br>  }<br>}</pre><p>Size this subnet carefully. <a href="https://learn.microsoft.com/azure/container-apps/custom-virtual-networks#subnet">Container Apps can’t resize a subnet</a> after the environment is created. A /27 is the minimum and gives you about 90 Consumption replicas. Outgrowing it means building a new environment.</p><h3>One endpoint, three DNS zones</h3><p>This is the part that catches people. A Foundry resource answers on three hostnames, openai.azure.com, cognitiveservices.azure.com, and services.ai.azure.com, and <a href="https://learn.microsoft.com/azure/private-link/private-endpoint-dns#commercial">each one needs its own private DNS zone</a>.</p><pre>resource &quot;azurerm_private_endpoint&quot; &quot;foundry&quot; {<br>  name                = &quot;pe-foundry-${local.suffix}&quot;<br>  location            = azurerm_resource_group.this.location<br>  resource_group_name = azurerm_resource_group.this.name<br>  subnet_id           = azurerm_subnet.private_endpoints.id<br><br>private_service_connection {<br>    name                           = &quot;foundry&quot;<br>    private_connection_resource_id = azurerm_cognitive_account.foundry.id<br>    subresource_names              = [&quot;account&quot;]<br>    is_manual_connection           = false<br>  }<br>  # One endpoint, three DNS zones. Miss one and some calls leave the VNet.<br>  private_dns_zone_group {<br>    name                 = &quot;foundry&quot;<br>    private_dns_zone_ids = [<br>      azurerm_private_dns_zone.this[&quot;cognitive&quot;].id,<br>      azurerm_private_dns_zone.this[&quot;openai&quot;].id,<br>      azurerm_private_dns_zone.this[&quot;foundry&quot;].id,<br>    ]<br>  }<br>}</pre><p>Most older samples only create privatelink.openai.azure.com, because they were written for Azure OpenAI. With only that zone, chat completions work, but the Agent Service calls on services.ai.azure.com resolve to the public IP and get rejected because public access is off. The error looks like an auth problem. It&#39;s DNS.</p><p>If you’re upgrading from the 4.x provider, note that azurerm_private_dns_zone_virtual_network_link now takes private_dns_zone_id instead of the zone name and resource group. The repo uses the 5.x form.</p><h3>An internal Container Apps environment</h3><p>The last hop is the agent itself. Setting internal_load_balancer_enabled = true puts the environment&#39;s ingress on a private IP inside the VNet.</p><pre>resource &quot;azurerm_container_app_environment&quot; &quot;this&quot; {<br>  name                = &quot;cae-${local.name}&quot;<br>  location            = azurerm_resource_group.this.location<br>  resource_group_name = azurerm_resource_group.this.name<br><br>infrastructure_subnet_id       = azurerm_subnet.apps.id<br>  internal_load_balancer_enabled = var.internal_only<br>  # Logs are routed by a diagnostic setting, so no shared key is needed.<br>  logs_destination = &quot;azure-monitor&quot;<br>  workload_profile {<br>    name                  = &quot;Consumption&quot;<br>    workload_profile_type = &quot;Consumption&quot;<br>  }<br>}</pre><p>You’ll see external_enabled = true on the container app&#39;s ingress later, which looks wrong at first. In an internal environment, &quot;external&quot; means reachable from the VNet, not from the internet. The internal_only variable is the real switch.</p><p>Key Vault gets the same treatment: public_network_access_enabled = false, a private endpoint, and its own privatelink.vaultcore.azure.net zone. It also needs rbac_authorization_enabled = true, which is a required argument in 5.x.</p><h3>N is for Neutralize: guardrails the app can’t skip</h3><p>The first four pillars protect the agent from the outside world. This one protects the outside world, and your data, from the agent.</p><p>Agents have a risk plain chatbots don’t. They read documents, web pages, and tool results, and any of those can carry hidden instructions. That’s indirect prompt injection, and it’s the attack an agent is most likely to meet in production.</p><p>Azure AI Content Safety handles this at the platform layer through a content filter policy. In Terraform, that’s azurerm_cognitive_account_rai_policy:</p><pre>resource &quot;azurerm_cognitive_account_rai_policy&quot; &quot;agent&quot; {<br>  name                 = &quot;agent-strict&quot;<br>  cognitive_account_id = azurerm_cognitive_account.foundry.id<br>  base_policy_name     = &quot;Microsoft.Default&quot;<br><br># Harm categories on both prompt and completion.<br>  # &quot;Low&quot; is the strictest threshold: it blocks low severity and above.<br>  dynamic &quot;content_filter&quot; {<br>    for_each = {<br>      for pair in setproduct([&quot;Hate&quot;, &quot;Sexual&quot;, &quot;Violence&quot;, &quot;SelfHarm&quot;], [&quot;Prompt&quot;, &quot;Completion&quot;]) :<br>      &quot;${pair[0]}-${pair[1]}&quot; =&gt; { name = pair[0], source = pair[1] }<br>    }<br>    content {<br>      name               = content_filter.value.name<br>      source             = content_filter.value.source<br>      filter_enabled     = true<br>      block_enabled      = true<br>      severity_threshold = &quot;Low&quot;<br>    }<br>  }<br>  # Prompt shields. These have no severity threshold.<br>  content_filter {<br>    name           = &quot;Jailbreak&quot;<br>    source         = &quot;Prompt&quot;<br>    filter_enabled = true<br>    block_enabled  = true<br>  }<br>  content_filter {<br>    name           = &quot;Indirect Attack&quot;<br>    source         = &quot;Prompt&quot;<br>    filter_enabled = true<br>    block_enabled  = true<br>  }<br>}</pre><p>The setproduct trick turns four categories times two sources into eight filter blocks without eight copies of the same code. The repo also adds protected material filters for text and code.</p><p>Two gotchas are worth knowing before you write your own. First, filter names are literal strings, and some have spaces: Indirect Attack, Protected Material Text, Protected Material Code. Second, prompt shields don&#39;t take a severity_threshold, so leave it off those blocks.</p><h3>Bind the policy to the deployment</h3><p>A filter policy does nothing until a deployment uses it:</p><pre>resource &quot;azurerm_cognitive_deployment&quot; &quot;chat&quot; {<br>  name                 = var.model_name<br>  cognitive_account_id = azurerm_cognitive_account.foundry.id<br><br>rai_policy_name        = azurerm_cognitive_account_rai_policy.agent.name<br>  version_upgrade_option = &quot;NoAutoUpgrade&quot;<br>  model {<br>    format  = &quot;OpenAI&quot;<br>    name    = var.model_name<br>    version = var.model_version<br>  }<br>  sku {<br>    name     = var.model_sku<br>    capacity = var.model_capacity<br>  }<br>}</pre><p>This is why Neutralize belongs in infrastructure, not application code. The filter is attached to the deployment, so every caller gets it: your agent, a teammate’s notebook, and a script someone writes next year. Nobody can forget to add it.</p><p>NoAutoUpgrade matters for the same reason. A model version change can shift how an agent behaves with its tools. You want that to happen in a pull request, not overnight.</p><p>One honest caveat: a strict filter will block some legitimate requests. Start strict, watch what gets blocked in the Trace queries below, and loosen individual categories with evidence.</p><h3>T is for Trace: one workspace, no shared keys</h3><p>When an agent does something unexpected, the first question is always “what did it actually do?” Trace makes sure that answer exists, in one place, before you need it.</p><p>There’s a trap here that undoes a lot of good work. Log Analytics and Application Insights both default to accepting a shared key. If your observability stack is keyed while everything else is keyless, you’ve just moved the credential, not removed it.</p><pre>resource &quot;azurerm_log_analytics_workspace&quot; &quot;this&quot; {<br>  name                = &quot;log-${local.name}&quot;<br>  location            = azurerm_resource_group.this.location<br>  resource_group_name = azurerm_resource_group.this.name<br>  sku                 = &quot;PerGB2018&quot;<br>  retention_in_days   = var.log_retention_days<br><br>local_authentication_enabled = false<br>}<br><br>resource &quot;azurerm_application_insights&quot; &quot;this&quot; {<br>  name                = &quot;appi-${local.name}&quot;<br>  location            = azurerm_resource_group.this.location<br>  resource_group_name = azurerm_resource_group.this.name<br>  workspace_id        = azurerm_log_analytics_workspace.this.id<br>  application_type    = &quot;other&quot;<br>  local_authentication_enabled = false<br>}</pre><p>With local auth off, telemetry has to arrive with an Entra ID token. That’s why Grant gave the agent the Monitoring Metrics Publisher role. <a href="https://learn.microsoft.com/azure/azure-monitor/app/azure-ad-authentication">Despite the name</a>, it covers all telemetry, not just metrics. The agent also gets one environment variable that tells the SDK to use its identity:</p><pre>env {<br>  name  = &quot;APPLICATIONINSIGHTS_AUTHENTICATION_STRING&quot;<br>  value = &quot;Authorization=AAD;ClientId=${azurerm_user_assigned_identity.agent.client_id}&quot;<br>}</pre><p>This is also why the Container Apps environment uses logs_destination = &quot;azure-monitor&quot; instead of log-analytics. The log-analytics option wires the environment to the workspace with its shared key, and that key is now disabled. A diagnostic setting routes the same logs over Azure Monitor instead.</p><h3>Route everything to one place</h3><p>One for_each sends platform logs from Foundry, Key Vault, and the Container Apps environment to the same workspace:</p><pre>resource &quot;azurerm_monitor_diagnostic_setting&quot; &quot;this&quot; {<br>  for_each = {<br>    foundry  = azurerm_cognitive_account.foundry.id<br>    keyvault = azurerm_key_vault.agent.id<br>    cae      = azurerm_container_app_environment.this.id<br>  }<br><br>name                       = &quot;diag-${each.key}&quot;<br>  target_resource_id         = each.value<br>  log_analytics_workspace_id = azurerm_log_analytics_workspace.this.id<br>  enabled_log {<br>    category_group = &quot;allLogs&quot;<br>  }<br>  enabled_metric {<br>    category = &quot;AllMetrics&quot;<br>  }<br>}</pre><p>In 5.x, the old metric block is gone and enabled_metric replaces it. If you copy a diagnostic setting from an older sample, that&#39;s the first thing that will fail.</p><p>The repo includes starter KQL in queries/agent-trace.kql. Here&#39;s the one I&#39;d put on a dashboard first, Key Vault secret reads by identity:</p><pre>AzureDiagnostics<br>| where TimeGenerated &gt; ago(24h)<br>| where ResourceProvider == &quot;MICROSOFT.KEYVAULT&quot;<br>| where OperationName == &quot;SecretGet&quot;<br>| project TimeGenerated, identity_claim_oid_g, CallerIPAddress, ResultSignature, requestUri_s</pre><p>If any object ID other than the agent’s shows up there, you want to know today, not during an incident review.</p><h3>Deploy it, then prove it</h3><p>The deploy is the usual three commands. Copy terraform.tfvars.example to terraform.tfvars, set your subscription ID, and run:</p><pre>terraform init<br>terraform plan -out tfplan<br>terraform apply tfplan</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*7aLAcdFmbV7WX45w9RilYg.png" /><figcaption>terraform plan</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YksScXJJC0msTopIAYnKFQ.png" /><figcaption>Resources in Azure</figcaption></figure><p>OpenTofu works the same way with tofu in place of terraform. The repo&#39;s GitHub Actions workflow runs fmt, init, and validate against both on every push, plus a Checkov scan.</p><p>Here’s the part most IaC tutorials skip. Declaring a control isn’t the same as having one. A setting can be overridden by policy, changed in the portal, or silently ignored by an API version. So the repo ships scripts/verify.sh, which checks each pillar against the live resources:</p><pre>./scripts/verify.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*XESSECvfmMQbab51_l6pJw.png" /></figure><p>It confirms that Foundry API keys are disabled, the agent identity holds exactly three roles and none of them is Owner or Contributor, Foundry has no public access, Key Vault rejects traffic from outside the VNet, the deployment uses the agent-strict filter, and Foundry logs reach Log Analytics. It exits non-zero on any failure, so you can run it as a pipeline gate after every apply.</p><h3>Things that will surprise you</h3><ul><li><strong>Terraform can’t read your Key Vault secrets.</strong> Public access is off, so data-plane calls from your laptop fail. Create secrets from a pipeline agent inside the VNet.</li><li><strong>You can’t browse to the agent.</strong> With internal_only = true, it&#39;s only reachable from the VNet. Flip it for a demo, then flip it back.</li><li><strong>Destroy doesn’t free the vault name right away.</strong> Purge protection holds it for 7 days. The random suffix keeps redeploys from colliding.</li></ul><h3>Wrapping up</h3><p>Zero trust for AI agents isn’t one setting. It’s five decisions, and each one is easy to get almost right. Writing them as code makes them reviewable, repeatable, and testable.</p><p>Here’s what you built:</p><ol><li><strong>Authenticate</strong>: one managed identity, with API keys disabled at the resource</li><li><strong>Grant</strong>: three role assignments, each on a single resource, referenced by GUID</li><li><strong>Encrypt</strong>: private endpoints with all three Foundry DNS zones, and an internal Container Apps environment</li><li><strong>Neutralize</strong>: a strict content filter with jailbreak and indirect-attack shields, bound to the deployment</li><li><strong>Trace</strong>: keyless Log Analytics and Application Insights, with every component’s logs in one workspace</li></ol><p>Clone the <a href="https://github.com/divyeshg94/azure-agent-zero-trust-iac">companion repo</a>, point container_image at your own agent, and run verify.sh. If something fails, open an issue. I&#39;d like to know which control your environment pushed back on.</p><h3>If this helped</h3><p>If this saved you a debugging session, give it a clap (you can clap up to 50 times) and follow <a href="https://medium.com/@divyeshg94">Microsoft Azure in Practice</a> for more hands-on Azure guides. Questions or a different approach? Leave a response below.</p><p><em>Divyesh Govaerdhanan is a Microsoft MVP in Azure PaaS and the founder of Microsoft Azure in Practice. He builds AI and DevOps tooling on Azure, including </em><a href="https://github.com/divyeshg94/velo"><em>Velo</em></a><em>, an AI-powered DORA metrics extension for Azure DevOps. Connect on </em><a href="https://www.linkedin.com/in/divyeshgovardhanan/"><em>LinkedIn</em></a><em> or </em><a href="https://github.com/divyeshg94"><em>GitHub</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=756ac0c4b7d3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-azure-in-practice/zero-trust-ai-agents-on-azure-provisioned-with-terraform-756ac0c4b7d3">Zero-trust AI agents on Azure, provisioned with Terraform</a> was originally published in <a href="https://medium.com/microsoft-azure-in-practice">Microsoft Azure in Practice</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multi-User MCP: Per-User Data Isolation with Azure Cosmos DB]]></title>
            <link>https://medium.com/microsoft-azure-in-practice/multi-user-mcp-per-user-data-isolation-with-azure-cosmos-db-05209ea0f791?source=rss----a34acb0c483c---4</link>
            <guid isPermaLink="false">https://medium.com/p/05209ea0f791</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[microsoft-entra-id]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[rbac-access-control]]></category>
            <dc:creator><![CDATA[Divyesh Govaerdhanan]]></dc:creator>
            <pubDate>Sun, 02 Aug 2026 21:21:16 GMT</pubDate>
            <atom:updated>2026-08-02T21:21:16.228Z</atom:updated>
            <content:encoded><![CDATA[<h4>Every authorized caller sees the same subscription data. That’s not multi-user — that’s shared access with a login screen.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UieK2eBdz3B8DeIbH8ucTQ.png" /><figcaption>Multi-User MCP Server</figcaption></figure><p>After <a href="https://medium.com/microsoft-azure-in-practice/securing-your-mcp-server-microsoft-entra-id-azure-api-management-18f6404142e0?sharedUserId=divyeshg94">Part 4</a>, the AzureOps MCP Server has proper authentication. A caller needs a valid Entra ID token and the right App Role to get through. That&#39;s necessary, but it isn&#39;t sufficient.</p><p>Here’s the gap: right now, every tool call requires the caller to pass subscriptionId and resourceGroup as explicit parameters. There&#39;s nothing in the server that ties a caller&#39;s identity to <em>their</em> data. User A can pass User B&#39;s subscription ID and get back User B&#39;s deployment history. The authentication layer verified <em>who</em> they are. It said nothing about <em>what data they&#39;re allowed to see</em>.</p><p>Part 5 fixes this in two ways:</p><p><strong>Per-user context:</strong> Each caller has a saved profile in Cosmos DB, their default subscription, their watched resource groups, their preferences. Tools can load this context automatically instead of requiring parameters every single call.</p><p><strong>Per-user history:</strong> Incident notes, triage logs, and observations are stored per-user, partitioned by their Entra ID identity. User A’s notes are physically separated from User B’s at the database level, not just filtered in application code.</p><p>The result: a server where “check deployment status” works without the caller typing their subscription ID every time, and where every piece of stored data is cryptographically bound to a specific identity.</p><h3>What Changes From Part 4</h3><p>Three additions:</p><ol><li><strong>Azure Cosmos DB</strong> — a NoSQL account with two containers: user-contexts (one document per user, stores preferences) and incident-notes (many per user, stores triage history). Both partitioned by /userId.</li><li><strong>Four new tools</strong> — save_user_context, get_user_context, log_incident_note, get_incident_history. These give the agent a memory layer per user.</li><li><strong>Updated existing tools</strong> — get_deployment_status, get_resource_tags, and check_resource_health now fall back to the caller&#39;s saved context when subscriptionId or resourceGroup are not explicitly provided. The agent can call them with zero parameters if the user has saved their defaults.</li></ol><p>The identity that ties everything together: the oid claim from the Entra ID JWT token. Object ID is stable across sessions, devices, and app registrations — it never changes for a given user in your tenant. We never use sub (subject) for this purpose — it&#39;s app-specific and changes across app registrations.</p><h3>Phase 1 — Provision Cosmos DB</h3><pre>$RG=&quot;rg-azureops-mcp&quot;<br>$COSMOS_ACCOUNT=&quot;azureops-mcp-cosmos&quot;<br>$LOCATION=&quot;eastus&quot;<br><br># Create Cosmos DB account - NoSQL API, serverless for dev/test<br>az cosmosdb create \<br>  --name $COSMOS_ACCOUNT \<br>  --resource-group $RG \<br>  --kind GlobalDocumentDB \<br>  --capabilities EnableServerless \<br>  --default-consistency-level Session \<br>  --locations regionName=$LOCATION<br><br># Create database<br>az cosmosdb sql database create \<br>  --account-name $COSMOS_ACCOUNT \<br>  --resource-group $RG \<br>  --name &quot;azureops-mcp-db&quot;<br><br># Container 1: user-contexts - one document per user<br>az cosmosdb sql container create \<br>  --account-name $COSMOS_ACCOUNT \<br>  --resource-group $RG \<br>  --database-name &quot;azureops-mcp-db&quot; \<br>  --name &quot;user-contexts&quot; \<br>  --partition-key-path &quot;/userId&quot;<br><br># Container 2: incident-notes - many per user<br>az cosmosdb sql container create \<br>  --account-name $COSMOS_ACCOUNT \<br>  --resource-group $RG \<br>  --database-name &quot;azureops-mcp-db&quot; \<br>  --name &quot;incident-notes&quot; \<br>  --partition-key-path &quot;/userId&quot;</pre><p>EnableServerless is the right SKU for this workload — tool calls are bursty and infrequent, not sustained high-throughput. You pay per request unit consumed, not per hour of provisioned throughput. For a team of 20 engineers making 500 tool calls per day, serverless costs pennies.</p><h3>1.1 — Grant the Container App Data Plane Access</h3><p>Cosmos DB has two separate RBAC systems: Azure RBAC (what we used in Part 3 for ARM calls) and Cosmos DB data plane RBAC. The Container App’s Managed Identity needs the data plane role — Azure Reader is not enough.</p><pre># Get the Container App&#39;s Managed Identity principal ID<br>$PRINCIPAL_ID=$(az containerapp identity show \<br>  --name azureops-mcp-server \<br>  --resource-group $RG \<br>  --query principalId -o tsv)<br><br># Get the Cosmos DB account resource ID<br>$COSMOS_ID=$(az cosmosdb show \<br>  --name $COSMOS_ACCOUNT \<br>  --resource-group $RG \<br>  --query id -o tsv)<br><br># Assign Cosmos DB Built-in Data Contributor (data plane RBAC, not Azure RBAC)<br>az cosmosdb sql role assignment create \<br>  --account-name $COSMOS_ACCOUNT \<br>  --resource-group $RG \<br>  --role-definition-name &quot;Cosmos DB Built-in Data Contributor&quot; \<br>  --principal-id $PRINCIPAL_ID \<br>  --scope $COSMOS_ID</pre><p>This is the most common mistake teams make with Cosmos DB + Managed Identity: assigning an Azure RBAC role and wondering why the SDK still returns 403. Azure RBAC controls management-plane operations (creating containers, viewing account settings). Cosmos DB data plane RBAC controls document read and write access. Both are required for full access; this article only needs the data plane role.</p><h3>1.2 — Store the Endpoint as an App Setting</h3><pre>$COSMOS_ENDPOINT=$(az cosmosdb show \<br>  --name $COSMOS_ACCOUNT \<br>  --resource-group $RG \<br>  --query documentEndpoint -o tsv)</pre><pre>az containerapp update \<br>  --name azureops-mcp-server \<br>  --resource-group $RG \<br>  --set-env-vars &quot;CosmosDb__Endpoint=$COSMOS_ENDPOINT&quot;</pre><p>No connection string. No account key. The SDK authenticates via DefaultAzureCredential using the endpoint alone.</p><h3>Phase 2 — Update the Codebase</h3><p>All changes in this phase are in the existing AzureOpsMcpServer project. No new project.</p><h3>2.1 — Add Package</h3><pre>dotnet add package Microsoft.Azure.Cosmos --version 3.62.0</pre><h3>2.2 — Update Program.cs</h3><p>Add the CosmosClient registration after the existing ArmClient line:</p><pre>using Microsoft.Azure.Cosmos;<br><br>// Existing<br>builder.Services.AddSingleton(_ =&gt; new ArmClient(new DefaultAzureCredential()));<br>// New: CosmosClient with DefaultAzureCredential - no connection string<br>builder.Services.AddSingleton(_ =&gt;<br>{<br>    var endpoint = builder.Configuration[&quot;CosmosDb:Endpoint&quot;]<br>        ?? throw new InvalidOperationException(&quot;CosmosDb:Endpoint is not configured&quot;);<br>    return new CosmosClient(endpoint, new DefaultAzureCredential());<br>});</pre><p>For local development, add to appsettings.Development.json:</p><pre>{<br>  &quot;CosmosDb&quot;: {<br>    &quot;Endpoint&quot;: &quot;https://azureops-mcp-cosmos.documents.azure.com:443/&quot;<br>  }<br>}</pre><p>Locally, DefaultAzureCredential resolves to your az login session — the same account you used to create the Cosmos DB account. No additional local configuration needed.</p><h3>2.3 — Add Data Models</h3><p>Create Models/UserModels.cs:</p><pre>namespace AzureOpsMcpServer.Models;<br><br>public record UserContext<br>{<br>    // &#39;id&#39; is the Cosmos DB document identifier - must equal UserId for upsert-by-user to work cleanly<br>    public required string Id { get; init; }<br>    // Partition key - the Entra ID Object ID (oid claim), stable across sessions<br>    public required string UserId { get; init; }<br>    public string? DefaultSubscriptionId { get; init; }<br>    public string? DefaultResourceGroup { get; init; }<br>    public List&lt;string&gt; WatchedResourceGroups { get; init; } = [];<br>    public DateTimeOffset LastUpdated { get; init; } = DateTimeOffset.UtcNow;<br>}<br><br>public record IncidentNote<br>{<br>    // Auto-generated unique identifier per note<br>    public required string Id { get; init; }<br>    // Partition key - same Entra ID Object ID<br>    public required string UserId { get; init; }<br>    public required string ResourceGroup { get; init; }<br>    public required string Note { get; init; }<br>    public string? Severity { get; init; }  // P1, P2, P3 - optional<br>    public DateTimeOffset CreatedAt { get; init; } = DateTimeOffset.UtcNow;<br>}</pre><h3>2.4 — Add a User Identity Helper</h3><p>Create Helpers/UserIdentity.cs. This is the single place that extracts the user&#39;s stable identity from the request:</p><p>csharp</p><pre>namespace AzureOpsMcpServer.Helpers;<br><br>public static class UserIdentity<br>{<br>    private const string OidClaimType =<br>        &quot;http://schemas.microsoft.com/identity/claims/objectidentifier&quot;;<br><br>    /// &lt;summary&gt;<br>    /// Extracts the Entra ID Object ID (oid) from the current user&#39;s claims.<br>    /// The oid claim is stable across sessions, devices, and app registrations -<br>    /// it is the correct identifier for per-user data partitioning.<br>    /// Never use &#39;sub&#39; (subject) - it is app-specific and changes across registrations.<br>    /// &lt;/summary&gt;<br>    public static string GetUserId(HttpContext context)<br>    {<br>        var oid = context.User.FindFirst(OidClaimType)?.Value<br>                  ?? context.User.FindFirst(&quot;oid&quot;)?.Value;<br>        return oid ?? throw new UnauthorizedAccessException(<br>            &quot;User Object ID (oid) not found in token. &quot; +<br>            &quot;Ensure the token was issued by Entra ID and includes the oid claim.&quot;);<br>    }<br>    public static string GetDisplayName(HttpContext context)<br>        =&gt; context.User.FindFirst(&quot;preferred_username&quot;)?.Value<br>           ?? context.User.FindFirst(&quot;name&quot;)?.Value<br>           ?? &quot;unknown&quot;;<br>}</pre><h3>2.5 — Add User Context Tools</h3><p>Create Tools/UserContextTools.cs:</p><p>csharp</p><pre>using Microsoft.Azure.Cosmos;<br>using System.ComponentModel;<br>using ModelContextProtocol.Server;<br>using AzureOpsMcpServer.Models;<br>using AzureOpsMcpServer.Helpers;<br><br>namespace AzureOpsMcpServer.Tools;<br>[McpServerToolType]<br>public class UserContextTools(CosmosClient cosmos)<br>{<br>    private const string DatabaseId  = &quot;azureops-mcp-db&quot;;<br>    private const string ContextsId  = &quot;user-contexts&quot;;<br>    private const string NotesId     = &quot;incident-notes&quot;;<br>    private Container Contexts =&gt; cosmos.GetContainer(DatabaseId, ContextsId);<br>    private Container Notes    =&gt; cosmos.GetContainer(DatabaseId, NotesId);<br>    // ─────────────────────────────────────────────────────────────────<br>    // TOOL: Save User Context<br>    // ─────────────────────────────────────────────────────────────────<br>    [McpServerTool(Name = &quot;save_user_context&quot;)]<br>    [Description(<br>        &quot;Saves the caller&#39;s default Azure subscription and resource group. &quot; +<br>        &quot;Once saved, other tools can be called without specifying these parameters each time. &quot; +<br>        &quot;Use this once when the user sets up the assistant for the first time.&quot;)]<br>    public async Task&lt;SaveContextResult&gt; SaveUserContextAsync(<br>        [Description(&quot;Azure subscription ID to set as default&quot;)] string subscriptionId,<br>        [Description(&quot;Resource group name to set as default&quot;)] string resourceGroup,<br>        [Description(&quot;Additional resource groups to watch (optional)&quot;)] List&lt;string&gt;? watchedGroups,<br>        HttpContext httpContext)<br>    {<br>        var userId = UserIdentity.GetUserId(httpContext);<br>        var context = new UserContext<br>        {<br>            Id                    = userId,   // document id = userId → clean upsert<br>            UserId                = userId,<br>            DefaultSubscriptionId = subscriptionId,<br>            DefaultResourceGroup  = resourceGroup,<br>            WatchedResourceGroups = watchedGroups ?? [],<br>            LastUpdated           = DateTimeOffset.UtcNow<br>        };<br>        await Contexts.UpsertItemAsync(context, new PartitionKey(userId));<br>        return new SaveContextResult<br>        {<br>            UserId               = userId,<br>            DisplayName          = UserIdentity.GetDisplayName(httpContext),<br>            DefaultSubscription  = subscriptionId,<br>            DefaultResourceGroup = resourceGroup,<br>            WatchedGroups        = context.WatchedResourceGroups,<br>            Message              = &quot;Context saved. Tools can now be called without explicit parameters.&quot;<br>        };<br>    }<br>    // ─────────────────────────────────────────────────────────────────<br>    // TOOL: Get User Context<br>    // ─────────────────────────────────────────────────────────────────<br>    [McpServerTool(Name = &quot;get_user_context&quot;)]<br>    [Description(<br>        &quot;Retrieves the caller&#39;s saved Azure context - default subscription, &quot; +<br>        &quot;resource group, and watched groups. &quot; +<br>        &quot;Call this to check what defaults are configured before running other tools.&quot;)]<br>    public async Task&lt;UserContextResult&gt; GetUserContextAsync(HttpContext httpContext)<br>    {<br>        var userId = UserIdentity.GetUserId(httpContext);<br>        try<br>        {<br>            var response = await Contexts.ReadItemAsync&lt;UserContext&gt;(<br>                userId, new PartitionKey(userId));<br>            var ctx = response.Resource;<br>            return new UserContextResult<br>            {<br>                UserId               = userId,<br>                DisplayName          = UserIdentity.GetDisplayName(httpContext),<br>                DefaultSubscription  = ctx.DefaultSubscriptionId,<br>                DefaultResourceGroup = ctx.DefaultResourceGroup,<br>                WatchedGroups        = ctx.WatchedResourceGroups,<br>                LastUpdated          = ctx.LastUpdated,<br>                HasContext           = true<br>            };<br>        }<br>        catch (CosmosException ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound)<br>        {<br>            return new UserContextResult<br>            {<br>                UserId      = userId,<br>                DisplayName = UserIdentity.GetDisplayName(httpContext),<br>                HasContext  = false,<br>                Message     = &quot;No saved context found. Call save_user_context to set your defaults.&quot;<br>            };<br>        }<br>    }<br>    // ─────────────────────────────────────────────────────────────────<br>    // TOOL: Log Incident Note<br>    // ─────────────────────────────────────────────────────────────────<br>    [McpServerTool(Name = &quot;log_incident_note&quot;)]<br>    [Description(<br>        &quot;Logs an incident observation or action taken to the caller&#39;s personal history. &quot; +<br>        &quot;Notes are private to each caller and cannot be read by other users. &quot; +<br>        &quot;Use during active incidents to maintain a timestamped record.&quot;)]<br>    public async Task&lt;LogNoteResult&gt; LogIncidentNoteAsync(<br>        [Description(&quot;Resource group where the incident occurred&quot;)] string resourceGroup,<br>        [Description(&quot;The observation, action, or decision to record&quot;)] string note,<br>        [Description(&quot;Incident severity: P1, P2, or P3 (optional)&quot;)] string? severity,<br>        HttpContext httpContext)<br>    {<br>        var userId = UserIdentity.GetUserId(httpContext);<br>        var incidentNote = new IncidentNote<br>        {<br>            Id            = Guid.NewGuid().ToString(),<br>            UserId        = userId,<br>            ResourceGroup = resourceGroup,<br>            Note          = note,<br>            Severity      = severity,<br>            CreatedAt     = DateTimeOffset.UtcNow<br>        };<br>        await Notes.CreateItemAsync(incidentNote, new PartitionKey(userId));<br>        return new LogNoteResult<br>        {<br>            NoteId        = incidentNote.Id,<br>            ResourceGroup = resourceGroup,<br>            Severity      = severity,<br>            LoggedAt      = incidentNote.CreatedAt,<br>            Message       = &quot;Incident note logged to your private history.&quot;<br>        };<br>    }<br>    // ─────────────────────────────────────────────────────────────────<br>    // TOOL: Get Incident History<br>    // ─────────────────────────────────────────────────────────────────<br>    [McpServerTool(Name = &quot;get_incident_history&quot;)]<br>    [Description(<br>        &quot;Returns the caller&#39;s incident note history for a given resource group. &quot; +<br>        &quot;Only returns notes logged by the caller - never returns other users&#39; notes. &quot; +<br>        &quot;Useful for building a timeline of actions taken during an incident.&quot;)]<br>    public async Task&lt;IncidentHistoryResult&gt; GetIncidentHistoryAsync(<br>        [Description(&quot;Resource group to retrieve history for&quot;)] string resourceGroup,<br>        [Description(&quot;Maximum number of recent notes to return (default 10)&quot;)] int limit = 10,<br>        HttpContext httpContext = null!)<br>    {<br>        var userId = UserIdentity.GetUserId(httpContext);<br>        var query = new QueryDefinition(<br>            &quot;SELECT * FROM c WHERE c.userId = @userId AND c.resourceGroup = @rg &quot; +<br>            &quot;ORDER BY c.createdAt DESC OFFSET 0 LIMIT @limit&quot;)<br>            .WithParameter(&quot;@userId&quot;, userId)<br>            .WithParameter(&quot;@rg&quot;, resourceGroup)<br>            .WithParameter(&quot;@limit&quot;, Math.Min(limit, 50));<br>        var notes   = new List&lt;IncidentNote&gt;();<br>        var iterator = Notes.GetItemQueryIterator&lt;IncidentNote&gt;(query,<br>            requestOptions: new QueryRequestOptions<br>            {<br>                PartitionKey = new PartitionKey(userId)  // scoped to caller&#39;s partition<br>            });<br>        while (iterator.HasMoreResults)<br>        {<br>            var page = await iterator.ReadNextAsync();<br>            notes.AddRange(page);<br>        }<br>        return new IncidentHistoryResult<br>        {<br>            UserId        = userId,<br>            ResourceGroup = resourceGroup,<br>            Notes         = notes,<br>            Count         = notes.Count,<br>            Summary       = notes.Count == 0<br>                ? &quot;No incident notes found for this resource group.&quot;<br>                : $&quot;{notes.Count} note(s) found. Most recent: {notes[0].CreatedAt:u}&quot;<br>        };<br>    }<br>}<br>// Result types<br>public record SaveContextResult<br>{<br>    public required string UserId { get; init; }<br>    public required string DisplayName { get; init; }<br>    public required string DefaultSubscription { get; init; }<br>    public required string DefaultResourceGroup { get; init; }<br>    public required List&lt;string&gt; WatchedGroups { get; init; }<br>    public required string Message { get; init; }<br>}<br>public record UserContextResult<br>{<br>    public required string UserId { get; init; }<br>    public required string DisplayName { get; init; }<br>    public string? DefaultSubscription { get; init; }<br>    public string? DefaultResourceGroup { get; init; }<br>    public List&lt;string&gt; WatchedGroups { get; init; } = [];<br>    public DateTimeOffset? LastUpdated { get; init; }<br>    public required bool HasContext { get; init; }<br>    public string? Message { get; init; }<br>}<br>public record LogNoteResult<br>{<br>    public required string NoteId { get; init; }<br>    public required string ResourceGroup { get; init; }<br>    public string? Severity { get; init; }<br>    public required DateTimeOffset LoggedAt { get; init; }<br>    public required string Message { get; init; }<br>}<br>public record IncidentHistoryResult<br>{<br>    public required string UserId { get; init; }<br>    public required string ResourceGroup { get; init; }<br>    public required List&lt;IncidentNote&gt; Notes { get; init; }<br>    public required int Count { get; init; }<br>    public required string Summary { get; init; }<br>}</pre><h3>2.6 — Update Existing Tools to Use Saved Context</h3><p>Update AzureOpsTools.cs to load saved context when parameters are not provided. The key change: subscriptionId and resourceGroup become optional, with a context fallback:</p><pre>[McpServerTool(Name = &quot;get_deployment_status&quot;)]<br>[Description(<br>    &quot;Returns recent deployment history for an Azure resource group. &quot; +<br>    &quot;If subscriptionId and resourceGroup are not provided, loads from the caller&#39;s saved context. &quot; +<br>    &quot;Use save_user_context first to avoid passing parameters every call.&quot;)]<br>public async Task&lt;DeploymentStatusResult&gt; GetDeploymentStatusAsync(<br>    [Description(&quot;Azure subscription ID (optional if saved context exists)&quot;)] string? subscriptionId,<br>    [Description(&quot;Resource group name (optional if saved context exists)&quot;)] string? resourceGroup,<br>    [Description(&quot;Number of recent deployments to return (1–20)&quot;)] int count = 5,<br>    HttpContext httpContext = null!)<br>{<br>    var (resolvedSub, resolvedRg) = await ResolveContextAsync(<br>        subscriptionId, resourceGroup, httpContext);<br><br>// existing implementation - replace hardcoded params with resolved values<br>    var subscription = _arm.GetSubscriptionResource(<br>        SubscriptionResource.CreateResourceIdentifier(resolvedSub));<br>    var rg          = await subscription.GetResourceGroupAsync(resolvedRg);<br>    var deployments = rg.Value.GetArmDeployments();<br>    var results = new List&lt;DeploymentEntry&gt;();<br>    await foreach (var d in deployments.GetAllAsync())<br>    {<br>        if (results.Count &gt;= Math.Min(count, 20)) break;<br>        results.Add(new DeploymentEntry<br>        {<br>            Name            = d.Data.Name,<br>            Status          = d.Data.Properties.ProvisioningState.ToString(),<br>            Timestamp       = d.Data.Properties.Timestamp ?? DateTimeOffset.MinValue,<br>            DurationSeconds = (int)(d.Data.Properties.Duration?.TotalSeconds ?? 0),<br>            TriggeredBy     = d.Data.SystemData?.CreatedBy<br>                              ?? d.Data.Properties.CorrelationId?.ToString()<br>                              ?? &quot;unknown&quot;<br>        });<br>    }<br>    var latest = results.FirstOrDefault();<br>    return new DeploymentStatusResult<br>    {<br>        ResourceGroup = resolvedRg,<br>        Deployments   = results,<br>        Summary       = latest is not null<br>            ? $&quot;Last deployment &#39;{latest.Name}&#39; {latest.Status} at {latest.Timestamp:u}&quot;<br>            : &quot;No deployments found in this resource group&quot;<br>    };<br>}</pre><p>Add the context resolver as a private method on AzureOpsTools:</p><pre>private async Task&lt;(string SubscriptionId, string ResourceGroup)&gt; ResolveContextAsync(<br>    string? subscriptionId,<br>    string? resourceGroup,<br>    HttpContext httpContext)<br>{<br>    if (!string.IsNullOrEmpty(subscriptionId) &amp;&amp; !string.IsNullOrEmpty(resourceGroup))<br>        return (subscriptionId, resourceGroup);<br><br>    // Load from saved context<br>    var userId = UserIdentity.GetUserId(httpContext);<br>    try<br>    {<br>        var response = await _cosmos.GetContainer(&quot;azureops-mcp-db&quot;, &quot;user-contexts&quot;)<br>            .ReadItemAsync&lt;UserContext&gt;(userId, new PartitionKey(userId));<br>        var ctx = response.Resource;<br>        return (<br>            subscriptionId ?? ctx.DefaultSubscriptionId<br>                ?? throw new InvalidOperationException(<br>                    &quot;No subscription ID provided and no default saved. Call save_user_context first.&quot;),<br>            resourceGroup ?? ctx.DefaultResourceGroup<br>                ?? throw new InvalidOperationException(<br>                    &quot;No resource group provided and no default saved. Call save_user_context first.&quot;)<br>        );<br>    }<br>    catch (CosmosException ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound)<br>    {<br>        throw new InvalidOperationException(<br>            &quot;No saved context found. &quot; +<br>            &quot;Either provide subscriptionId and resourceGroup explicitly, &quot; +<br>            &quot;or call save_user_context to set your defaults.&quot;);<br>    }<br>}</pre><p>Update AzureOpsTools constructor to accept CosmosClient:</p><pre>[McpServerToolType]<br>public class AzureOpsTools(ArmClient armClient, CosmosClient cosmos)<br>{<br>    private readonly ArmClient    _arm    = armClient;<br>    private readonly CosmosClient _cosmos = cosmos;<br>    // ... rest unchanged<br>}</pre><p>Apply the same optional-parameter pattern to GetResourceTagsAsync and CheckResourceHealthAsync — both call ResolveContextAsync before proceeding.</p><h3>2.7 — Project Structure</h3><p><strong><em>Source Code: </em></strong><a href="https://github.com/divyeshg94/AzureOpsMcpServer/tree/part5">https://github.com/divyeshg94/AzureOpsMcpServer/tree/part5</a></p><pre>AzureOpsMcpServer/<br>├── Helpers/<br>│   └── UserIdentity.cs             ← ✅ new<br>├── Models/<br>│   └── UserModels.cs               ← ✅ new<br>├── Tools/<br>│   ├── AzureOpsTools.cs            ← ✅ updated (CosmosClient + optional params)<br>│   └── UserContextTools.cs         ← ✅ new (4 new tools)<br>├── Resources/<br>│   └── RunbookResource.cs          ← unchanged<br>├── Prompts/<br>│   └── IncidentPrompt.cs           ← unchanged<br>├── AzureOpsMcpServer.csproj        ← ✅ updated (Cosmos package)<br>└── Program.cs                      ← ✅ updated (CosmosClient registration)</pre><h3>Phase 3 — Validate Locally</h3><h3>3.1 — Grant Local Access to Cosmos DB</h3><p>bash</p><pre>$USER_OID=$(az ad signed-in-user show --query id -o tsv)<br><br>az cosmosdb sql role assignment create \<br>  --account-name $COSMOS_ACCOUNT \<br>  --resource-group $RG \<br>  --role-definition-name &quot;Cosmos DB Built-in Data Contributor&quot; \<br>  --principal-id $USER_OID \<br>  --scope $(az cosmosdb show \<br>    --name $COSMOS_ACCOUNT \<br>    --resource-group $RG \<br>    --query id -o tsv)</pre><h3>3.2 — Start the Server and Test in Sequence</h3><pre>dotnet run</pre><p><strong>Step 1 — Save context (no parameters needed after this):</strong></p><pre>Save my Azure context: subscription {your-sub-id}, <br>resource group rg-payments-prod</pre><p>Expected:</p><pre>{<br>  &quot;userId&quot;: &quot;oid-from-your-token&quot;,<br>  &quot;displayName&quot;: &quot;divyesh@contoso.com&quot;,<br>  &quot;defaultSubscription&quot;: &quot;{your-sub-id}&quot;,<br>  &quot;defaultResourceGroup&quot;: &quot;rg-payments-prod&quot;,<br>  &quot;message&quot;: &quot;Context saved. Tools can now be called without explicit parameters.&quot;<br>}</pre><p><strong>Step 2 — Verify context was stored:</strong></p><pre>What is my saved Azure context?</pre><p><strong>Step 3 — Call tools without parameters:</strong></p><pre>Check the deployment status</pre><p>The agent calls get_deployment_status with no explicit parameters. The server loads the saved context, resolves the subscription and resource group, and returns real deployment data. This is the moment the server changes from a parameter-heavy CLI-style tool into an assistant that knows your environment.</p><p><strong>Step 4 — Log an incident note:</strong></p><pre>Log an incident note for rg-payments-prod: <br>&quot;Rolled back deploy-api-v1.14 at 14:47 UTC. <br>Failure rate dropped from 2.3% to 0.1% within 5 minutes.&quot;<br>Severity P2.</pre><p><strong>Step 5 — Retrieve history:</strong></p><pre>Show my incident history for rg-payments-prod</pre><p><strong>Step 6 — Confirm isolation (multi-user test):</strong> If you have a second Entra ID test account with the App Role assigned, sign in as that account and repeat Steps 1–5 with different data. Then sign back in as the first account and confirm get_incident_history returns only the first account&#39;s notes. The partition key ensures this at the database level — not in application code.</p><h3>Phase 4 — Deploy and Validate</h3><h3>4.1 — Rebuild and Push the Image</h3><pre>az acr build \<br>  --registry azureopsmcpacr \<br>  --image azureops-mcp-server:latest .</pre><h3>4.2 — Trigger Container App to Pull New Image</h3><pre>az containerapp update \<br>  --name azureops-mcp-server \<br>  --resource-group $RG \<br>  --image azureopsmcpacr.azurecr.io/azureops-mcp-server:latest</pre><p>The CosmosDb__Endpoint environment variable was set in Phase 1. The Container App&#39;s Managed Identity already has the Cosmos DB data plane role. No further configuration needed.</p><h3>4.3 — Validate Against Production</h3><p>Same five-step test sequence from Phase 3 — now against the live APIM endpoint. Confirm:</p><ul><li>save_user_context stores to Cosmos DB (verify in Azure Portal → Data Explorer)</li><li>Zero-parameter tool calls resolve from saved context</li><li>Incident notes appear under the correct userId partition in the incident-notes container</li><li>A second test user cannot read the first user’s notes</li></ul><p>✅ <strong>Production checkpoint:</strong> Per-user data isolation is live. Their Entra ID Object ID partitions each caller’s context and history at the Cosmos DB level.</p><h3>The Isolation Guarantee</h3><p>It’s worth being precise about what “isolation” means here, because it matters for how much you can trust this model.</p><p>The partition key (/userId) is the Entra ID Object ID extracted from the validated JWT. That token was issued by Entra ID and validated by APIM before the request reached your code. By the time UserIdentity.GetUserId() runs, the oid claim has been cryptographically verified.</p><p>Every Cosmos DB query in the user context tools includes PartitionKey = new PartitionKey(userId) on the request options. Cosmos DB&#39;s partition isolation means a query scoped to userId=A will never return documents from userId=B — not as a filter, but as a physical storage boundary. Even a bug in the query predicate can&#39;t cross partition boundaries.</p><p>What this model doesn’t provide: <strong>tenant-level isolation</strong> for regulated industries (financial services, healthcare) where different organizations need fully separate Cosmos DB accounts with customer-managed keys and dedicated throughput. For an internal enterprise tool serving users in one tenant, the partition-key-per-user model is the correct level of isolation. For a SaaS product serving external organizations, that’s a different architecture — each organization gets its own Cosmos DB account.</p><h3>What’s Next</h3><p>The server now has authentication, authorization, and per-user data isolation. The next question is: how do you connect this to Microsoft Foundry so the agent can be used beyond VS Code — from Foundry-hosted agents, from Copilot Studio, from the emerging enterprise agent ecosystem?</p><p><strong>Part 6</strong> registers the AzureOps MCP Server in Microsoft Foundry Agent Service — covering the tool registration format, how Foundry discovers and invokes your tools, and how the security model from Part 4 carries forward into the Foundry context.</p><h3>Series Progress</h3><ul><li>✅<a href="https://levelup.gitconnected.com/what-is-mcp-and-why-should-every-azure-developer-care-3d65e8eff76c?gi=b8bd1a135134"> Part 1 — Mental model, why MCP matters for Azure</a></li><li>✅<a href="https://medium.com/gitconnected/your-first-mcp-server-in-c-net-build-something-real-in-30-minutes-ea146c8226e2"> Part 2 — First MCP server in C# .NET, tested in GitHub Copilot</a></li><li>✅<a href="https://medium.com/microsoft-azure-in-practice/from-local-to-azure-deploy-your-mcp-server-to-production-78b05bb1e5a9?source=your_stories_outbox---writer_outbox_published-----------------------------------------"> Part 3 — Deployed to Azure Container Apps with Managed Identity</a></li><li>✅<a href="https://medium.com/microsoft-azure-in-practice/securing-your-mcp-server-microsoft-entra-id-azure-api-management-18f6404142e0?sharedUserId=divyeshg94"> Part 4 — Secured with Entra ID + APIM + per-tool App Roles</a></li><li>✅ Part 5 ← You are here</li><li><strong>Part 6</strong> — Register in Microsoft Foundry Agent Service</li><li>Part 7 — Observability with OpenTelemetry + Azure Monitor</li><li>Part 8 — Full E2E production system + cost breakdown + production checklist</li></ul><p><em>Divyesh writes production-grade Azure + Microsoft Foundry guides with real code and real benchmarks. Follow for Part 6 — connecting to Foundry.</em></p><p><em>Part 5 of </em><strong><em>MCP on Azure: From Zero to Production</em></strong><em> — published in [Microsoft Azure in Practice].</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05209ea0f791" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-azure-in-practice/multi-user-mcp-per-user-data-isolation-with-azure-cosmos-db-05209ea0f791">Multi-User MCP: Per-User Data Isolation with Azure Cosmos DB</a> was originally published in <a href="https://medium.com/microsoft-azure-in-practice">Microsoft Azure in Practice</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When ##vso Became ##_vso: The Azure DevOps SSH@0 Change That Broke My Deployment]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/microsoft-azure-in-practice/when-vso-became-vso-the-azure-devops-ssh-0-change-that-broke-my-deployment-9c470864212b?source=rss----a34acb0c483c---4"><img src="https://cdn-images-1.medium.com/max/2600/1*mkhgz7mu9jgSB_bGg4PV7Q.png" width="2752"></a></p><p class="medium-feed-snippet">How a single underscore introduced by Azure DevOps&#x2019; June 2026 SSH@0 security update broke our blue-green deployment, and how we fixed it&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/microsoft-azure-in-practice/when-vso-became-vso-the-azure-devops-ssh-0-change-that-broke-my-deployment-9c470864212b?source=rss----a34acb0c483c---4">Continue reading on Microsoft Azure in Practice »</a></p></div>]]></description>
            <link>https://medium.com/microsoft-azure-in-practice/when-vso-became-vso-the-azure-devops-ssh-0-change-that-broke-my-deployment-9c470864212b?source=rss----a34acb0c483c---4</link>
            <guid isPermaLink="false">https://medium.com/p/9c470864212b</guid>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Rumman Hussain Siddiqui]]></dc:creator>
            <pubDate>Tue, 14 Jul 2026 14:54:22 GMT</pubDate>
            <atom:updated>2026-07-14T14:54:21.469Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Securing Your MCP Server: Microsoft Entra ID + Azure API Management]]></title>
            <link>https://medium.com/microsoft-azure-in-practice/securing-your-mcp-server-microsoft-entra-id-azure-api-management-18f6404142e0?source=rss----a34acb0c483c---4</link>
            <guid isPermaLink="false">https://medium.com/p/18f6404142e0</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <dc:creator><![CDATA[Divyesh Govaerdhanan]]></dc:creator>
            <pubDate>Sun, 12 Jul 2026 02:21:16 GMT</pubDate>
            <atom:updated>2026-07-12T02:21:17.382Z</atom:updated>
            <content:encoded><![CDATA[<h4>Anyone with the URL could call your tools. That ends in this article.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r8YANA9pBrn6-WroXnqDIg.png" /><figcaption>Part 4 — Securing Your MCP Server</figcaption></figure><p><a href="https://medium.com/microsoft-azure-in-practice/from-local-to-azure-deploy-your-mcp-server-to-production-78b05bb1e5a9">Part 3</a> left us with a real problem: the AzureOps MCP Server is deployed, returning real Azure data, authenticated to Azure Resource Manager via Managed Identity, and completely open to the internet. Anyone with the Container App URL can invoke get_deployment_status against any subscription ID they want.</p><p>This article closes that gap with two layers that work together, not one silver bullet:</p><p><strong>Layer 1 — Identity:</strong> Microsoft Entra ID issues tokens. Azure API Management validates them before any request reaches your server. No valid token, no access.</p><p><strong>Layer 2 — Network:</strong> The Container App is locked down to accept traffic only from APIM. Even a valid-looking request that bypasses APIM gets dropped at the network level.</p><p>Most MCP security write-ups stop at Layer 1. That leaves a gap: if your Container App’s public URL is still reachable directly, a determined caller can skip APIM entirely. We close both.</p><p>By the end, we’ll also add <strong>per-tool authorization, </strong>so a caller with access to get_deployment_status doesn&#39;t automatically get get_resource_tags. Least privilege, not just least friction.</p><h3>The Architecture</h3><pre>VS Code / Copilot Agent Mode<br>       │<br>       │  1. No token → 401 + WWW-Authenticate header<br>       │  2. Discovers Entra ID via Protected Resource Metadata<br>       │  3. User signs in, gets access token<br>       ▼<br>Microsoft Entra ID  ──issues──&gt;  Access Token (JWT)<br>       │<br>       │  Authorization: Bearer &lt;token&gt;<br>       ▼<br>Azure API Management<br>       │<br>       │  validate-azure-ad-token policy checks:<br>       │  - Token signature &amp; expiry<br>       │  - Correct tenant<br>       │  - Correct client application ID<br>       │<br>       ▼<br>Azure Container App  (network-locked: only accepts traffic from APIM)<br>       │<br>       │  Reads forwarded Authorization header<br>       │  Checks App Role claim before executing tool<br>       ▼<br>   Tool executes → calls ARM via Managed Identity</pre><p>Two identities are in play here, and conflating them is the most common mistake: the <strong>caller’s identity</strong> (validated by Entra ID + APIM, which determines <em>who can invoke which tool</em>) and the <strong>server’s identity</strong> (the Container App’s Managed Identity, used to call Azure Resource Manager). We are not using the On-Behalf-Of token exchange in this article. The tools don’t act <em>as</em> the calling user against Azure Resource Manager. They act as the app, using the same Managed Identity from Part 3. We’re deciding <em>whether to let the call through at all</em> and <em>which tools the caller may use</em>. That’s a deliberate scope decision, not an oversight — OBO adds real complexity for a benefit this scenario doesn’t need.</p><h3>Phase 1 — Register the MCP Server in Entra ID</h3><p>The server needs its own app registration. This represents your API to Entra ID and defines what a caller must present to be granted access.</p><pre># Create the server app registration<br>az ad app create \<br>  --display-name &quot;AzureOps MCP Server&quot; \<br>  --sign-in-audience AzureADMyOrg<br><br>$SERVER_APP_ID=$(az ad app list --display-name &quot;AzureOps MCP Server&quot; --query &quot;[0].appId&quot; -o tsv)<br><br># Set the Application ID URI - this becomes the audience for tokens<br>az ad app update \<br>  --id $SERVER_APP_ID \<br>  --identifier-uris &quot;api://$SERVER_APP_ID&quot;<br><br># Create the service principal<br>az ad sp create --id $SERVER_APP_ID</pre><h3>1.1 — Expose an API Scope</h3><p>This defines the permission a client requests to call your server at all.</p><pre>az ad app update --id $SERVER_APP_ID --set api=&#39;{<br>  &quot;oauth2PermissionScopes&quot;: [{<br>    &quot;id&quot;: &quot;&lt;GENERATE A GUID AND REPLACE&gt;&quot;,<br>    &quot;adminConsentDisplayName&quot;: &quot;Access AzureOps MCP Server&quot;,<br>    &quot;adminConsentDescription&quot;: &quot;Allows the app to call AzureOps MCP tools on behalf of the signed-in user&quot;,<br>    &quot;userConsentDisplayName&quot;: &quot;Access AzureOps MCP Server&quot;,<br>    &quot;userConsentDescription&quot;: &quot;Allow this app to call AzureOps MCP tools&quot;,<br>    &quot;value&quot;: &quot;access_as_user&quot;,<br>    &quot;type&quot;: &quot;User&quot;,<br>    &quot;isEnabled&quot;: true<br>  }]<br>}&#39;</pre><h3>1.2 — Define App Roles for Per-Tool Authorization</h3><p>This is the piece most MCP security articles skip entirely. A valid token proves <em>who</em> the caller is — it doesn’t say <em>which tools</em> they should reach. We define two roles: one for read-only operational visibility, one for FinOps-sensitive tag data.</p><pre>az ad app update --id $SERVER_APP_ID --set appRoles=&#39;[<br>  {<br>    &quot;id&quot;: &quot;a11c2b44-27ad-4be3-87e9-03868835976a&quot;,<br>    &quot;displayName&quot;: &quot;AzureOps.Operations.Read&quot;,<br>    &quot;description&quot;: &quot;Can call deployment status and health check tools&quot;,<br>    &quot;value&quot;: &quot;AzureOps.Operations.Read&quot;,<br>    &quot;allowedMemberTypes&quot;: [&quot;User&quot;, &quot;Application&quot;],<br>    &quot;isEnabled&quot;: true<br>  },<br>  {<br>    &quot;id&quot;: &quot;e1d54777-9aa9-41ad-b26c-79344058a9e2&quot;,<br>    &quot;displayName&quot;: &quot;AzureOps.FinOps.Read&quot;,<br>    &quot;description&quot;: &quot;Can call the resource tag compliance tool&quot;,<br>    &quot;value&quot;: &quot;AzureOps.FinOps.Read&quot;,<br>    &quot;allowedMemberTypes&quot;: [&quot;User&quot;, &quot;Application&quot;],<br>    &quot;isEnabled&quot;: true<br>  }<br>]&#39;</pre><p>Assign yourself the roles for testing:</p><pre>$USER_OBJECT_ID=$(az ad signed-in-user show --query id -o tsv)<br>$SP_OBJECT_ID=$(az ad sp show --id $SERVER_APP_ID --query id -o tsv)<br><br>az rest --method POST \<br>  --uri &quot;https://graph.microsoft.com/v1.0/servicePrincipals/$SP_OBJECT_ID/appRoleAssignedTo&quot; \<br>  --headers &quot;Content-Type=application/json&quot; \<br>  --body &quot;{&#39;principalId&#39;:&#39;$USER_OBJECT_ID&#39;,&#39;resourceId&#39;:&#39;$SP_OBJECT_ID&#39;,&#39;appRoleId&#39;:&#39;e1d54777-9aa9-41ad-b26c-79344058a9e2&#39;}&quot;             </pre><p>In production, you’d assign these roles to Entra security groups, not individual users — group-based assignment scales without per-person app registration changes.</p><p><strong>One thing to watch:</strong> the az ad app update --set appRoles=... command replaces the entire appRoles array. If you&#39;re adding a role to an app that already has roles defined, fetch the existing array first and append to it — running this command twice with different role lists will silently delete the roles from the first run.</p><h3>1.3 — Register VS Code as a Pre-Authorized Client</h3><p>Entra ID doesn’t support OAuth Dynamic Client Registration. Every client that calls your MCP server must be explicitly known — this is the most important limitation to understand before going further. For VS Code / GitHub Copilot, register a separate client app:</p><pre>az ad app create \<br>  --display-name &quot;AzureOps MCP - VS Code Client&quot; \<br>  --is-fallback-public-client true \<br>  --public-client-redirect-uris &quot;http://localhost&quot; &quot;http://127.0.0.1&quot;<br><br>$CLIENT_APP_ID=$(az ad app list --display-name &quot;AzureOps MCP - VS Code Client&quot; --query &quot;[0].appId&quot; -o tsv)<br><br># Pre-authorize this client to call the server&#39;s access_as_user scope<br>$SCOPE_ID=$(az ad app show --id $SERVER_APP_ID --query &quot;api.oauth2PermissionScopes[0].id&quot; -o tsv)<br><br>az ad app update --id &quot;$SERVER_APP_ID&quot; --set api=&quot;{<br>  &#39;preAuthorizedApplications&#39;: [{<br>    &#39;appId&#39;: &#39;$CLIENT_APP_ID&#39;,<br>    &#39;delegatedPermissionIds&#39;: [&#39;$SCOPE_ID&#39;]<br>  }]<br>}&quot;</pre><p>Pre-authorization means VS Code can request a token without the user seeing a separate consent screen for your API — it was already granted when the client was registered.</p><h3>Phase 2 — Configure Azure API Management as the MCP Gateway</h3><pre>az apim create \<br>  --name azureops-apim \<br>  --resource-group $RG \<br>  --publisher-email you@contoso.com \<br>  --publisher-name &quot;Contoso AzureOps&quot; \<br>  --sku-name Developer</pre><p>APIM provisioning takes 30–45 minutes. While it runs, prepare the policy configuration.</p><h3>Phase 3 — Lock Down the Container App Network</h3><p>Before touching APIM, close the direct path. If the Container App’s public URL still works without going through APIM, the auth layer above means nothing.</p><pre>$RG=&quot;rg-azureops-mcp&quot;<br>$ACA_APP=&quot;azureops-mcp-server&quot;<br><br># Get APIM&#39;s outbound IP addresses (after APIM is provisioned in Phase 2)<br>$APIM_IPS=$(az apim show --name azureops-apim \<br>  --resource-group $RG --query &quot;publicIPAddresses&quot; -o tsv)<br><br># Deny all traffic by default, then allow only APIM<br>az containerapp ingress access-restriction set \<br>  --name $ACA_APP \<br>  --resource-group $RG \<br>  --rule-name &quot;allow-apim-only&quot; \<br>  --ip-address &quot;$APIM_IPS/32&quot; \<br>  --action Allow \<br>  --rule-type IPRule<br><br>az containerapp ingress access-restriction set \<br>  --name $ACA_APP \<br>  --resource-group $RG \<br>  --rule-name &quot;deny-all-else&quot; \<br>  --ip-address &quot;0.0.0.0/0&quot; \<br>  --action Deny \<br>  --rule-type IPRule</pre><p>For production, prefer VNet integration with a private endpoint between APIM and the Container App over IP allow-listing — IP-based rules work, but VNet isolation removes the public attack surface entirely. IP rules are the faster path for this article; treat the VNet pattern as the next hardening step once this works end-to-end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cTa3MtBPvupA4FdRzrDE0g.png" /></figure><h3>3.1 — Import the MCP Server as an APIM Backend API</h3><p>In the Azure Portal: <strong>APIM → APIs → Add API → MCP Server</strong>. Point it at your Container App’s /mcp endpoint. APIM creates the routing automatically — your existing endpoint structure doesn&#39;t change.</p><h3>3.2 — Apply the Entra ID Validation Policy</h3><p>On the imported MCP API, set this inbound policy:</p><pre>&lt;policies&gt;<br>  &lt;inbound&gt;<br>    &lt;validate-azure-ad-token tenant-id=&quot;{your-tenant-id}&quot;<br>                              header-name=&quot;Authorization&quot;<br>                              failed-validation-httpcode=&quot;401&quot;<br>                              failed-validation-error-message=&quot;Unauthorized. Access token is missing or invalid.&quot;&gt;<br>      &lt;client-application-ids&gt;<br>        &lt;application-id&gt;{server-app-id}&lt;/application-id&gt;<br>      &lt;/client-application-ids&gt;<br>    &lt;/validate-azure-ad-token&gt;<br>    &lt;base /&gt;<br>  &lt;/inbound&gt;<br>  &lt;on-error&gt;<br>    &lt;set-header name=&quot;WWW-Authenticate&quot; exists-action=&quot;override&quot;&gt;<br>      &lt;value&gt;@{<br>        return &quot;Bearer resource_metadata=\&quot;https://&quot; + context.Request.OriginalUrl.Host<br>             + &quot;/.well-known/oauth-protected-resource\&quot;&quot;;<br>      }&lt;/value&gt;<br>    &lt;/set-header&gt;<br>    &lt;base /&gt;<br>  &lt;/on-error&gt;<br>&lt;/policies&gt;</pre><p>The on-error block matters as much as the validation itself. When a client calls without a token, MCP clients (VS Code included) expect a 401 with a WWW-Authenticate header pointing them to discovery metadata — without it, the client has no way to know <em>how</em> to authenticate, and the connection just fails silently from the user&#39;s perspective.</p><h3>3.3 — Serve the Protected Resource Metadata Endpoint</h3><p>RFC 9728 requires this exact path — it’s not configurable. Add a new API operation in APIM at /.well-known/oauth-protected-resource with this policy:</p><pre>&lt;policies&gt;<br>  &lt;inbound&gt;<br>    &lt;return-response&gt;<br>      &lt;set-status code=&quot;200&quot; reason=&quot;OK&quot; /&gt;<br>      &lt;set-header name=&quot;Content-Type&quot; exists-action=&quot;override&quot;&gt;<br>        &lt;value&gt;application/json&lt;/value&gt;<br>      &lt;/set-header&gt;<br>      &lt;set-body&gt;@{<br>        return new JObject(<br>          new JProperty(&quot;resource&quot;, &quot;https://&quot; + context.Request.OriginalUrl.Host),<br>          new JProperty(&quot;authorization_servers&quot;, new JArray(<br>            &quot;https://login.microsoftonline.com/{your-tenant-id}/v2.0&quot;<br>          ))<br>        ).ToString();<br>      }&lt;/set-body&gt;<br>    &lt;/return-response&gt;<br>  &lt;/inbound&gt;<br>&lt;/policies&gt;</pre><p>This is the document VS Code reads after receiving the 401 — it tells the client exactly which Entra tenant to authenticate against.</p><h3>Phase 4 — Add Per-Tool Authorization in the Server</h3><p>APIM validates that a caller <em>has</em> a valid token. It doesn’t know your tools well enough to decide <em>which</em> tools the caller should reach — that decision belongs in your code, where the tool definitions live.</p><p>Update Program.cs to read and validate the forwarded token&#39;s claims:</p><pre>using Microsoft.AspNetCore.Authentication.JwtBearer;<br>using Microsoft.IdentityModel.Tokens;<br><br>builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)<br>    .AddJwtBearer(options =&gt;<br>    {<br>        options.Authority = $&quot;https://login.microsoftonline.com/{tenantId}/v2.0&quot;;<br>        options.Audience  = $&quot;api://{serverAppId}&quot;;<br>        options.TokenValidationParameters = new TokenValidationParameters<br>        {<br>            ValidateIssuer = true,<br>            ValidateAudience = true<br>        };<br>    });<br>builder.Services.AddAuthorization(options =&gt;<br>{<br>    options.AddPolicy(&quot;OperationsRead&quot;, policy =&gt;<br>        policy.RequireClaim(&quot;roles&quot;, &quot;AzureOps.Operations.Read&quot;));<br>    options.AddPolicy(&quot;FinOpsRead&quot;, policy =&gt;<br>        policy.RequireClaim(&quot;roles&quot;, &quot;AzureOps.FinOps.Read&quot;));<br>});</pre><p>This is intentional defense-in-depth, not redundant work. APIM already rejected unauthenticated callers — this second check confirms the <em>specific</em> role required for the <em>specific</em> tool, directly in the code that owns the tool’s sensitivity. If APIM is ever misconfigured or bypassed, this layer still holds.</p><p>Update each tool to check its required role before executing:</p><pre>[McpServerTool(Name = &quot;get_resource_tags&quot;)]<br>[Description(&quot;Fetches FinOps compliance tags. Requires AzureOps.FinOps.Read role.&quot;)]<br>public async Task&lt;ResourceTagsResult&gt; GetResourceTagsAsync(<br>    [Description(&quot;Azure subscription ID&quot;)] string subscriptionId,<br>    [Description(&quot;Resource group name&quot;)] string resourceGroup,<br>    HttpContext httpContext)<br>{<br>    if (!httpContext.User.HasClaim(&quot;roles&quot;, &quot;AzureOps.FinOps.Read&quot;))<br>    {<br>        throw new UnauthorizedAccessException(<br>            &quot;This tool requires the AzureOps.FinOps.Read role.&quot;);<br>    }<br><br>    // existing implementation unchanged<br>    var subscription = _arm.GetSubscriptionResource(<br>        SubscriptionResource.CreateResourceIdentifier(subscriptionId));<br>    // ...<br>}</pre><p>The HttpContext parameter is automatically populated by the MCP SDK from the current request — no manual wiring required. A caller with AzureOps.Operations.Read but not AzureOps.FinOps.Read will have get_deployment_status and check_resource_health work normally, and get_resource_tags throw a clear, role-specific error.</p><h3>Phase 5 — Validate End-to-End</h3><p>Update .vscode/mcp.json to point at the APIM endpoint instead of the Container App directly:</p><pre>{<br>  &quot;servers&quot;: {<br>    &quot;azureops-mcp&quot;: {<br>      &quot;type&quot;: &quot;http&quot;,<br>      &quot;url&quot;: &quot;https://azureops-apim.azure-api.net/azureops-mcp/mcp&quot;<br>    }<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aT2YwowHQDcxKR3qbw5qDg.png" /></figure><p>Reload VS Code and open Copilot Chat in agent mode. The first connection attempt should trigger a sign-in prompt — VS Code received the 401 + WWW-Authenticate Header discovered the Entra tenant via the PRM document, and is now requesting a token.</p><p>Sign in with an account that has the AzureOps.Operations.Read role assigned. Run:</p><pre>Check deployment status for subscription {sub-id}, resource group {rg}</pre><p>This should succeed — token validated by APIM, role checked by the server, tool executes.</p><p>Now try:</p><pre>Check FinOps tag compliance for subscription {sub-id}, resource group {rg}</pre><p>If your test account only has AzureOps.Operations.Read, this should fail with the role-specific error. Assign the AzureOps.FinOps.Read role and retry — it should now succeed.</p><p><strong>Confirm the network lock independently</strong> — try calling the Container App’s direct URL (not through APIM) with curl:</p><pre>curl https://{container-app-fqdn}/health</pre><p>This should time out or be refused. If it responds, the access restriction from Phase 2 isn’t applied correctly — go back and verify before considering this production-ready.</p><h3>What This Doesn’t Cover</h3><p>Two things deliberately stayed out of scope here, and you should know why:</p><p><strong>On-Behalf-Of (OBO) flow</strong> — if your tools needed to call Microsoft Graph or another downstream API <em>as the signed-in user</em> (reading their calendar, their SharePoint files), you’d need an OBO token exchange. Our tools only call Azure Resource Manager using the server’s own Managed Identity, so this complexity isn’t needed here. If your use case grows into per-user downstream calls, that’s a deliberate architecture change, not a missing step.</p><p><strong>Arbitrary third-party MCP clients</strong> — because Entra ID doesn’t support Dynamic Client Registration, every client must be pre-registered, as we did for VS Code. If you need to support MCP clients you don’t control, you need an OAuth proxy in front of Entra ID — a real added layer of complexity and risk that’s outside this article’s scope. For an internal enterprise tool used through Copilot and Foundry, pre-authorized clients are the right level of complexity, not a shortcut.</p><h3>What’s Next</h3><p>The server is secured for a single caller’s identity. Part 5 takes the next logical step: <strong>multiple users, each with their own data boundary.</strong> Right now, every authorized caller sees the same Azure subscription and resource groups. Part 5 adds per-user data isolation with Azure Cosmos DB — so a multi-tenant deployment of this server can serve different teams or customers without anyone seeing another’s data.</p><h3>Series Progress</h3><ul><li>✅ <a href="https://medium.com/gitconnected/what-is-mcp-and-why-should-every-azure-developer-care-3d65e8eff76c">Part 1 — Mental model, why MCP matters for Azure</a></li><li>✅ <a href="https://medium.com/gitconnected/your-first-mcp-server-in-c-net-build-something-real-in-30-minutes-ea146c8226e2">Part 2 — First MCP server in C# .NET, tested in GitHub Copilot</a></li><li>✅ <a href="https://medium.com/microsoft-azure-in-practice/from-local-to-azure-deploy-your-mcp-server-to-production-78b05bb1e5a9">Part 3 — Deployed to Azure Container Apps with Managed Identity</a></li><li>✅ Part 4 ← You are here</li><li>Part 5 — Multi-user data isolation with Cosmos DB</li><li>Part 6 — Register in Microsoft Foundry Agent Service</li><li>Part 7 — Observability with OpenTelemetry + Azure Monitor</li><li>Part 8 — Full E2E production system + cost breakdown + production checklist</li></ul><p><em>Divyesh writes production-grade Azure + Microsoft Foundry guides with real code and real benchmarks. Follow for Part 5 — multi-tenant data isolation done right.</em></p><p><em>Part 4 of </em><strong><em>MCP on Azure: From Zero to Production</em></strong><em> — published in [Microsoft Azure in Practice].</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18f6404142e0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-azure-in-practice/securing-your-mcp-server-microsoft-entra-id-azure-api-management-18f6404142e0">Securing Your MCP Server: Microsoft Entra ID + Azure API Management</a> was originally published in <a href="https://medium.com/microsoft-azure-in-practice">Microsoft Azure in Practice</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Local to Azure: Deploy Your MCP Server to Production]]></title>
            <link>https://medium.com/microsoft-azure-in-practice/from-local-to-azure-deploy-your-mcp-server-to-production-78b05bb1e5a9?source=rss----a34acb0c483c---4</link>
            <guid isPermaLink="false">https://medium.com/p/78b05bb1e5a9</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[azure-functions]]></category>
            <category><![CDATA[azure-container-apps]]></category>
            <category><![CDATA[mcp-server]]></category>
            <dc:creator><![CDATA[Divyesh Govaerdhanan]]></dc:creator>
            <pubDate>Sat, 20 Jun 2026 12:58:25 GMT</pubDate>
            <atom:updated>2026-06-20T12:58:25.461Z</atom:updated>
            <content:encoded><![CDATA[<h4>One codebase. Real Azure data. One deployment target that actually makes sense.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gDYN9RDUbJE9qEjQ6isNRw.png" /><figcaption>MCP From Local To Azure — Part 3</figcaption></figure><p>In Part 2, we built the AzureOps MCP Server — three tools, a runbook resource, and an incident triage prompt, all returning simulated data on localhost:5100. Copilot called the tools. It worked locally.</p><p>This article takes that server to production in three stages:</p><ol><li><strong>Replace all simulated data with real Azure SDK calls</strong> — in one place, completely</li><li><strong>Validate locally</strong> against your actual Azure subscription before anything touches cloud infrastructure</li><li><strong>Deploy to Azure Container Apps</strong> — the same codebase, containerized, with Managed Identity throughout</li></ol><p>Azure Functions is covered at the end as an alternative. By the end of this article, you’ll understand why most .NET MCP servers belong on Container Apps, and in which narrow cases Functions is the right call.</p><h3>What Changes From Part 2</h3><p><strong>Static → Dynamic:</strong> Three tools returned hardcoded data. All of it gets replaced with Azure.ResourceManager SDK calls returning real deployment history, real tags, and real health states.</p><p><strong>Managed Identity everywhere:</strong> DefaultAzureCredential handles authentication. Locally, it resolves to your az login session. In Azure, it resolves to the Container App&#39;s system-assigned identity. No secrets, no connection strings, no rotation.</p><p><strong>Async tool methods:</strong> Real SDK calls are async. The tool class becomes an instance type to support constructor injection, and all tool methods become async Task&lt;T&gt;.</p><h3>Phase 1 — Update the Codebase</h3><p>All changes happen in the existing AzureOpsMcpServer project from Part 2. No new project.</p><h3>1.1 — Add Packages</h3><pre>dotnet add package Azure.ResourceManager --version 1.14.0<br>dotnet add package Azure.ResourceManager.Resources --version 1.11.2<br>dotnet add package Azure.ResourceManager.ResourceHealth --version 1.0.0<br>dotnet add package Azure.Identity --version 1.21.0</pre><p>Your .csproj should now look like this:</p><pre>&lt;ItemGroup&gt;<br>  &lt;PackageReference Include=&quot;Azure.Identity&quot; Version=&quot;1.21.0&quot; /&gt;<br>  &lt;PackageReference Include=&quot;Azure.ResourceManager&quot; Version=&quot;1.14.0&quot; /&gt;<br>  &lt;PackageReference Include=&quot;Azure.ResourceManager.ResourceHealth&quot; Version=&quot;1.0.0&quot; /&gt;<br>  &lt;PackageReference Include=&quot;Azure.ResourceManager.Resources&quot; Version=&quot;1.11.2&quot; /&gt;<br>  &lt;PackageReference Include=&quot;Microsoft.AspNetCore.OpenApi&quot; Version=&quot;10.0.3&quot; /&gt;<br>  &lt;PackageReference Include=&quot;Microsoft.Extensions.AI&quot; Version=&quot;10.6.0&quot; /&gt;<br>  &lt;PackageReference Include=&quot;ModelContextProtocol.AspNetCore&quot; Version=&quot;1.4.0&quot; /&gt;<br>&lt;/ItemGroup&gt;</pre><h3>1.2 — Update Program.cs</h3><p>Replace Program.cs in full:</p><pre>using Azure.Identity;<br>using Azure.ResourceManager;<br>using ModelContextProtocol.Server;<br><br>var builder = WebApplication.CreateBuilder(args);<br><br>// ArmClient resolves to az login locally, system-assigned Managed Identity in Azure<br>builder.Services.AddSingleton(_ =&gt; new ArmClient(new DefaultAzureCredential()));<br>builder.Services.AddMcpServer()<br>    .WithHttpTransport(options =&gt; { options.Stateless = true; })<br>    .WithToolsFromAssembly()<br>    .WithResourcesFromAssembly()<br>    .WithPromptsFromAssembly();<br><br>builder.Services.AddCors(options =&gt;<br>{<br>    options.AddDefaultPolicy(policy =&gt;<br>    {<br>        policy<br>            .WithOrigins(<br>                &quot;https://vscode.dev&quot;,<br>                &quot;https://*.vscode.dev&quot;<br>            )<br>            .AllowAnyHeader()<br>            .AllowAnyMethod();<br>    });<br>});<br><br>var app = builder.Build();<br>app.UseCors();<br>app.MapMcp(&quot;/mcp&quot;);<br>app.MapGet(&quot;/health&quot;, () =&gt; Results.Ok(new { status = &quot;healthy&quot;, server = &quot;AzureOps MCP&quot; }));<br><br>// app.Run() with no argument reads ASPNETCORE_HTTP_PORTS from the environment.<br>// Local: set to 5100 in launchSettings.json. Container: set to 8080 in Dockerfile.<br>app.Run();</pre><p>Port handling is now clean: app.Run() with no explicit URL reads ASPNETCORE_HTTP_PORTS from the environment. No hardcoded ports, no PORT variable guessing.</p><h3>1.3 — Update launchSettings.json</h3><p>Set the local port in Properties/launchSettings.json:</p><pre>{<br>  &quot;profiles&quot;: {<br>    &quot;http&quot;: {<br>      &quot;commandName&quot;: &quot;Project&quot;,<br>      &quot;dotnetRunMessages&quot;: true,<br>      &quot;launchBrowser&quot;: false,<br>      &quot;applicationUrl&quot;: &quot;http://localhost:5100&quot;,<br>      &quot;environmentVariables&quot;: {<br>        &quot;ASPNETCORE_ENVIRONMENT&quot;: &quot;Development&quot;<br>      }<br>    }<br>  }<br>}</pre><p>This keeps localhost:5100 for local development. The Dockerfile will set 8080 for the container — no code change required between environments.</p><h3>1.4 — Replace AzureOpsTools.cs (Full File)</h3><p>This is the only file where all three tools live. Replace it entirely:</p><pre>using Azure.ResourceManager;<br>using Azure.ResourceManager.Resources;<br>using Azure.ResourceManager.ResourceHealth;<br>using System.ComponentModel;<br>using ModelContextProtocol.Server;<br>using AzureOpsMcpServer.Models;<br><br>namespace AzureOpsMcpServer.Tools;<br><br>[McpServerToolType]<br>public class AzureOpsTools(ArmClient armClient)<br>{<br>    private readonly ArmClient _arm = armClient;<br>    // ─────────────────────────────────────────────────────────────────<br>    // TOOL 1: Deployment Status<br>    // ─────────────────────────────────────────────────────────────────<br>    [McpServerTool(Name = &quot;get_deployment_status&quot;)]<br>    [Description(<br>        &quot;Returns recent deployment history for an Azure resource group. &quot; +<br>        &quot;Includes deployment name, provisioning status (Succeeded/Failed/Running), &quot; +<br>        &quot;timestamp, duration, and correlation ID for tracing. &quot; +<br>        &quot;Use this to understand what changed in an environment before an incident.&quot;)]<br>    public async Task&lt;DeploymentStatusResult&gt; GetDeploymentStatusAsync(<br>        [Description(&quot;Azure subscription ID (GUID format)&quot;)] string subscriptionId,<br>        [Description(&quot;Resource group name to query&quot;)] string resourceGroup,<br>        [Description(&quot;Number of recent deployments to return (1–20)&quot;)] int count = 5)<br>    {<br>        var subscription = _arm.GetSubscriptionResource(<br>            SubscriptionResource.CreateResourceIdentifier(subscriptionId));<br>        var rg = await subscription.GetResourceGroupAsync(resourceGroup);<br>        var deployments = rg.Value.GetArmDeployments();<br>        var results = new List&lt;DeploymentEntry&gt;();<br>        await foreach (var d in deployments.GetAllAsync())<br>        {<br>            if (results.Count &gt;= Math.Min(count, 20)) break;<br>            results.Add(new DeploymentEntry<br>            {<br>                Name            = d.Data.Name,<br>                Status          = d.Data.Properties.ProvisioningState?.ToString() ?? &quot;Unknown&quot;,<br>                Timestamp       = d.Data.Properties.Timestamp ?? DateTimeOffset.MinValue,<br>                DurationSeconds = (int)(d.Data.Properties.Duration?.TotalSeconds ?? 0),<br>                // SystemData.CreatedBy is populated for deployments triggered via portal/CLI/CI<br>                // Falls back to CorrelationId for programmatic deployments<br>                TriggeredBy     = d.Data.SystemData?.CreatedBy<br>                                  ?? d.Data.Properties.CorrelationId?.ToString()<br>                                  ?? &quot;unknown&quot;<br>            });<br>        }<br>        var latest = results.FirstOrDefault();<br>        return new DeploymentStatusResult<br>        {<br>            ResourceGroup = resourceGroup,<br>            Deployments   = results,<br>            Summary       = latest is not null<br>                ? $&quot;Last deployment &#39;{latest.Name}&#39; {latest.Status} at {latest.Timestamp:u}&quot;<br>                : &quot;No deployments found in this resource group&quot;<br>        };<br>    }<br><br>    // ─────────────────────────────────────────────────────────────────<br>    // TOOL 2: Resource Tags<br>    // ─────────────────────────────────────────────────────────────────<br>    [McpServerTool(Name = &quot;get_resource_tags&quot;)]<br>    [Description(<br>        &quot;Fetches all tags on an Azure resource group and identifies missing required FinOps tags. &quot; +<br>        &quot;Required tags: Environment, Owner, CostCenter, Application. &quot; +<br>        &quot;Do NOT use this tool for individual resources - it operates at the resource group level.&quot;)]<br>    public async Task&lt;ResourceTagsResult&gt; GetResourceTagsAsync(<br>        [Description(&quot;Azure subscription ID (GUID format)&quot;)] string subscriptionId,<br>        [Description(&quot;Resource group name to check&quot;)] string resourceGroup)<br>    {<br>        var subscription = _arm.GetSubscriptionResource(<br>            SubscriptionResource.CreateResourceIdentifier(subscriptionId));<br>        var rg = await subscription.GetResourceGroupAsync(resourceGroup);<br>        var tags = rg.Value.Data.Tags ?? new Dictionary&lt;string, string&gt;();<br>        var required = new[] { &quot;Environment&quot;, &quot;Owner&quot;, &quot;CostCenter&quot;, &quot;Application&quot; };<br>        var missingTags = required.Except(tags.Keys, StringComparer.OrdinalIgnoreCase).ToList();<br>        return new ResourceTagsResult<br>        {<br>            ResourceId        = rg.Value.Data.Id.ToString(),<br>            Tags              = new Dictionary&lt;string, string&gt;(tags),<br>            MissingRequiredTags = missingTags,<br>            Compliant         = missingTags.Count == 0,<br>            ComplianceSummary = missingTags.Count == 0<br>                ? &quot;Resource group is fully tagged&quot;<br>                : $&quot;Missing {missingTags.Count} required tag(s): {string.Join(&quot;, &quot;, missingTags)}&quot;<br>        };<br>    }<br><br>    // ─────────────────────────────────────────────────────────────────<br>    // TOOL 3: Resource Health<br>    // ─────────────────────────────────────────────────────────────────<br>    [McpServerTool(Name = &quot;check_resource_health&quot;)]<br>    [Description(<br>        &quot;Returns the current health state of an Azure resource group from Azure Resource Health. &quot; +<br>        &quot;Health states: Available, Degraded, Unavailable, Unknown. &quot; +<br>        &quot;Use this to determine whether degradation is platform-initiated or application-caused.&quot;)]<br>    public async Task&lt;ResourceHealthResult&gt; CheckResourceHealthAsync(<br>        [Description(&quot;Azure subscription ID (GUID format)&quot;)] string subscriptionId,<br>        [Description(&quot;Resource group name to check&quot;)] string resourceGroup)<br>    {<br>        var subscription = _arm.GetSubscriptionResource(<br>            SubscriptionResource.CreateResourceIdentifier(subscriptionId));<br>        var rg = await subscription.GetResourceGroupAsync(resourceGroup);<br>        // GetAvailabilityStatusAsync is an extension method from Azure.ResourceManager.ResourceHealth<br>        // It returns the current availability status for any ARM resource scope<br>        var statusResponse = await _arm.GetAvailabilityStatusAsync(rg.Value.Id);<br>        var data = statusResponse.Value;<br>        return new ResourceHealthResult<br>        {<br>            ResourceType      = &quot;ResourceGroup&quot;,<br>            ResourceName      = resourceGroup,<br>            HealthState       = data.Properties?.AvailabilityState?.ToString() ?? &quot;Unknown&quot;,<br>            ReasonCode        = data.Properties?.ReasonType,<br>            RecommendedAction = data.Properties?.RecommendedActions<br>                                    ?.FirstOrDefault()?.Action,<br>            LastChecked       = DateTimeOffset.UtcNow<br>        };<br>    }<br>}</pre><p>Two naming changes from Part 2: DeployedBy is now TriggeredBy (accurate — ARM exposes SystemData.CreatedBy or CorrelationId, not a free-form deployer name), and the tag comparison now uses StringComparer.OrdinalIgnoreCase so environment and Environment don&#39;t both fail compliance.</p><h3>1.5 — Add .dockerignore</h3><p>Before the Dockerfile. Add .dockerignore at the project root:</p><pre>bin/<br>bin<br>obj/<br>obj<br>.vs/<br>.vs<br>.vscode/<br>*.user<br>.git/<br>.gitignore<br>*.slnx<br>Dockerfile<br>.dockerignore<br>README.md<br>Properties/launchSettings.json</pre><p>Without this, the Docker build context includes bin/, obj/, and local VS config — bloating build times and leaking local configuration into the image.</p><h3>1.6 — Project Structure Check</h3><p><strong><em>Source Code: </em></strong><a href="https://github.com/divyeshg94/AzureOpsMcpServer/tree/part2">https://github.com/divyeshg94/AzureOpsMcpServer/tree/part</a>3</p><pre>AzureOpsMcpServer/<br>├── .vscode/<br>│   └── mcp.json                    ← still points to localhost:5100<br>├── Properties/<br>│   └── launchSettings.json         ← ✅ added (sets local port 5100)<br>├── Tools/<br>│   └── AzureOpsTools.cs            ← ✅ updated (real Azure SDK, async)<br>├── Resources/<br>│   └── RunbookResource.cs          ← unchanged<br>├── Prompts/<br>│   └── IncidentPrompt.cs           ← unchanged<br>├── .dockerignore                   ← ✅ added<br>├── AzureOpsMcpServer.csproj        ← ✅ updated (Azure SDK packages)<br>└── Program.cs                      ← ✅ updated (ArmClient + app.Run())</pre><p>Four files changed or added. Everything else carries forward from Part 2.</p><h3>Phase 2 — Validate Locally</h3><p>Before any infrastructure is provisioned, confirm the SDK calls work against your Azure subscription from your machine. Never deploy code that hasn’t been locally verified against real data.</p><h3>2.1 — Prerequisites</h3><pre># Login<br>az login<br><br># Confirm active subscription<br>az account show --query &quot;{name:name, id:id}&quot; -o table<br><br># Grant yourself Reader on the resource group you&#39;ll test against<br>az role assignment create \<br>  --role &quot;Reader&quot; \<br>  --assignee $(az ad signed-in-user show --query id -o tsv) \<br>  --scope /subscriptions/{your-sub-id}/resourceGroups/{your-rg}</pre><p>Resource Health Reader is a separate built-in role from Reader. Without it, GetAvailabilityStatusAsync returns a 403.</p><h3>2.2 — Start the Server</h3><pre>dotnet run</pre><p>Expected output:</p><pre>info: Microsoft.Hosting.Lifetime[14]<br>      Now listening on: http://localhost:5100</pre><p>Health check:</p><pre>curl http://localhost:5100/health<br># {&quot;status&quot;:&quot;healthy&quot;,&quot;server&quot;:&quot;AzureOps MCP&quot;}</pre><h3>2.3 — Test Each Tool in Copilot</h3><p>Open Copilot Chat (Ctrl+Alt+I), switch to Agent mode, and confirm azureops-mcp is listed in the Tools panel. Run one prompt per tool.</p><p><strong>Tool 1 — Deployment Status:</strong></p><pre>Get the last 3 deployments for subscription {your-sub-id},<br>resource group {your-rg}</pre><p>Expected structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fsVRZRcyvS05UtOGvVnYJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WBzxGvXWuvWkx_v-zALL9w.png" /></figure><p>Real deployment names, real timestamps from your resource group — Tool 1 is working.</p><p><strong>Tool 2 — Resource Tags:</strong></p><pre>Check FinOps tag compliance for subscription {your-sub-id},<br>resource group {your-rg}</pre><p>Expected structure:</p><pre>{<br>  &quot;resourceId&quot;: &quot;/subscriptions/.../resourceGroups/rg-payments-prod&quot;,<br>  &quot;tags&quot;: { &quot;Environment&quot;: &quot;Production&quot;, &quot;Owner&quot;: &quot;platform-team@contoso.com&quot; },<br>  &quot;missingRequiredTags&quot;: [&quot;CostCenter&quot;, &quot;Application&quot;],<br>  &quot;compliant&quot;: false,<br>  &quot;complianceSummary&quot;: &quot;Missing 2 required tag(s): CostCenter, Application&quot;<br>}</pre><p><strong>Tool 3 — Resource Health:</strong></p><pre>Check the health of resource group {your-rg}<br>in subscription {your-sub-id}</pre><p>Expected structure:</p><pre>{<br>  &quot;resourceType&quot;: &quot;ResourceGroup&quot;,<br>  &quot;resourceName&quot;: &quot;rg-payments-prod&quot;,<br>  &quot;healthState&quot;: &quot;Available&quot;,<br>  &quot;reasonCode&quot;: null,<br>  &quot;recommendedAction&quot;: null,<br>  &quot;lastChecked&quot;: &quot;2026-06-15T10:45:00Z&quot;<br>}</pre><h3>2.4 — Common Errors and Fixes</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatawrapper.dwcdn.net%2FDjIGj%2F2%2F&amp;display_name=Datawrapper&amp;url=https%3A%2F%2Fdatawrapper.dwcdn.net%2FDjIGj%2F2%2F&amp;image=https%3A%2F%2Fdatawrapper.dwcdn.net%2FDjIGj%2Fplain-s.png%3Fv%3D2&amp;type=text%2Fhtml&amp;schema=dwcdn" width="600" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/0aa1de41d7de8936368edcfd242bf0a6/href">https://medium.com/media/0aa1de41d7de8936368edcfd242bf0a6/href</a></iframe><p>✅ <strong>Local checkpoint:</strong> All three tools return real data from your Azure subscription. Simulated responses are gone. Move to Phase 3.</p><h3>Phase 3 — Deploy to Azure Container Apps</h3><p>The existing ASP.NET Core project deploys to Container Apps with one addition: a Dockerfile. No code restructuring, no new project, no trigger wrappers.</p><h3>3.1 — Add the Dockerfile</h3><p>Add Dockerfile at the project root:</p><pre># Build stage<br>FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build<br>WORKDIR /src<br>COPY [&quot;AzureOpsMcpServer.csproj&quot;, &quot;.&quot;]<br>RUN dotnet restore<br>COPY . .<br>RUN dotnet publish -c Release -o /app/publish<br><br># Runtime stage<br>FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final<br>WORKDIR /app<br><br># Port 8080 — standard for ACA. app.Run() reads ASPNETCORE_HTTP_PORTS automatically.<br>ENV ASPNETCORE_HTTP_PORTS=8080<br>EXPOSE 8080<br><br>COPY --from=build /app/publish .<br>ENTRYPOINT [&quot;dotnet&quot;, &quot;AzureOpsMcpServer.dll&quot;]</pre><p>ASPNETCORE_HTTP_PORTS=8080 is the correct way to set the Kestrel port in a container. It&#39;s read automatically by app.Run() — No code change needed between environments.</p><h3>3.2 — Create Azure Resources</h3><pre># Variables — set these once, use throughout<br>$RG=&quot;rg-azureops-mcp&quot;<br>$LOCATION=&quot;eastus&quot;<br>$ACR=&quot;azureopsmcpacr&quot;<br>$ACA_ENV=&quot;azureops-mcp-env&quot;<br>$ACA_APP=&quot;azureops-mcp-server&quot;<br>$SUB_ID=$(az account show --query id -o tsv)<br><br># Resource group<br>az group create --name $RG --location $LOCATION<br><br># Container Registry (admin disabled - we use Managed Identity for pulls)<br>az acr create --resource-group $RG --name $ACR --sku Basic  --admin-enabled false<br><br># Container Apps environment<br>az containerapp env create --name $ACA_ENV --resource-group $RG --location $LOCATION</pre><h3>3.3 — Build and Push the Image</h3><pre># Build and push directly via ACR Tasks — no local Docker required<br>az acr build --registry $ACR --image azureops-mcp-server:latest .</pre><p>az acr build runs the Docker build in Azure — faster, no local Docker Desktop dependency, and the image never leaves Azure infrastructure.</p><h3>3.4 — Deploy with Managed Identity</h3><p>This is a three-step sequence: create the app with system identity, assign roles, then switch the registry to use that identity. No admin credentials ever touch the deployment.</p><pre>az acr update --name $ACR --admin-enabled true<br>$ACR_PASS = az acr credential show --name $ACR --query &quot;passwords[0].value&quot; -o tsv<br><br># Create app<br>az containerapp create `<br>  --name $ACA_APP --resource-group $RG --environment $ACA_ENV `<br>  --image &quot;$($ACR).azurecr.io/azureops-mcp-server:latest&quot; `<br>  --target-port 8080 --ingress external `<br>  --min-replicas 1 --max-replicas 10 `<br>  --cpu 0.25 --memory 0.5Gi `<br>  --system-assigned `<br>  --registry-server &quot;$($ACR).azurecr.io&quot; `<br>  --registry-username $ACR `<br>  --registry-password $ACR_PASS<br><br># Get MI principal<br>$PRINCIPAL_ID = az containerapp identity show --name $ACA_APP --resource-group $RG --query principalId -o tsv<br><br># AcrPull<br>$ACR_ID = az acr show --name $ACR --query id -o tsv<br>az role assignment create --role AcrPull --assignee $PRINCIPAL_ID --scope $ACR_ID<br><br># Switch to MI, disable admin<br>az containerapp registry set --name $ACA_APP --resource-group $RG --server &quot;$($ACR).azurecr.io&quot; --identity system<br>az acr update --name $ACR --admin-enabled false<br><br># SDK roles<br>az role assignment create --role &quot;Reader&quot; --assignee $PRINCIPAL_ID --scope &quot;/subscriptions/$SUB_ID&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x5btW70aPwFT_-QDZ9TaIw.png" /></figure><p>Steps 3 and 4 together complete the Managed Identity loop: the Container App pulls its image from ACR using its own identity, and calls the Azure Management API using that same identity. No secrets anywhere.</p><h3>3.5 — Get the Endpoint</h3><pre>$FQDN=$(az containerapp show \<br>  --name $ACA_APP \<br>  --resource-group $RG \<br>  --query &quot;properties.configuration.ingress.fqdn&quot; -o tsv)</pre><pre>echo &quot;MCP endpoint: https://$FQDN/mcp&quot;<br>echo &quot;Health: https://$FQDN/health&quot;</pre><h3>3.6 — Validate the Deployment</h3><p>Health check first:</p><pre>curl https://$FQDN/health<br># {&quot;status&quot;:&quot;healthy&quot;,&quot;server&quot;:&quot;AzureOps MCP&quot;}</pre><p>Tool discovery:</p><pre>curl -X POST https://$FQDN/mcp \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;id&quot;:1,&quot;method&quot;:&quot;tools/list&quot;,&quot;params&quot;:{}}&#39;</pre><p>Expected: JSON listing all three tools — get_deployment_status, get_resource_tags, check_resource_health.</p><p>Then update .vscode/mcp.json to point at the live endpoint:</p><pre>{<br>  &quot;servers&quot;: {<br>    &quot;azureops-mcp&quot;: {<br>      &quot;type&quot;: &quot;http&quot;,<br>      &quot;url&quot;: &quot;https://{your-fqdn}/mcp&quot;<br>    }<br>  }<br>}</pre><p>Reload VS Code. Run the same three prompts from Phase 2 — now against the live Container App. Confirm all three tools return real Azure data from the deployed endpoint.</p><p>✅ <strong>Production checkpoint:</strong> The same Copilot prompt that returned simulated data in Part 2 now returns real data from a deployed, identity-authenticated Azure Container App. That’s the line crossed.</p><h3>Alternative: Azure Functions</h3><p>If your team already runs a Functions-based codebase, you can deploy MCP tools there using Microsoft.Azure.Functions.Worker.Extensions.Mcp v1.4.0.</p><p>One thing to keep in mind before you go that route: <strong>Azure Functions requires a separate project.</strong> The ASP.NET Core hosting model (WebApplication.CreateBuilder) and the Functions isolated worker model (FunctionsApplication.CreateBuilder) are not compatible in the same project. Each tool becomes a separate [McpToolTrigger]-decorated Function, and the deployment toolchain (func CLI) is different from Container Apps.</p><p>This is not a reason to avoid Functions — it’s a reason to make the choice deliberately.</p><p><strong>Functions are worth a separate project if:</strong></p><ul><li>You’re extending an existing Functions app that already has timers, queues, or other triggers — MCP tools belong alongside those</li><li>You need per-invocation billing granularity at the individual tool level</li><li>Your traffic pattern is genuinely bursty — quiet for hours, spike, then quiet again — and Consumption plan economics matter</li></ul><p><strong>Container Apps is the simpler path if:</strong></p><ul><li>This is a new project (which it is, if you followed Parts 1 and 2)</li><li>You want the same binary running locally and in production with no structural difference</li><li>You need Dapr, custom domains, or non-MCP HTTP endpoints alongside your tools</li></ul><p>Microsoft’s own Microsoft Learn tutorials for deploying .NET MCP servers use Container Apps. That’s not accidental.</p><h3>What’s Still Missing</h3><p>The Container App endpoint is publicly accessible. Anyone with the URL can call your tools with any subscription ID. There’s no authentication, no authorization, no audit trail.</p><p><strong>Part 4</strong> addresses this: Azure API Management in front of the MCP endpoint, Microsoft Entra ID OAuth 2.1 for caller authentication, and per-tool authorization policies so only identities with the right roles can invoke specific tools.</p><p>The security model for MCP has some non-obvious failure modes that most implementations get wrong. Part 4 is specific about what those are.</p><h3>Series Progress</h3><ul><li>✅ <a href="https://medium.com/gitconnected/what-is-mcp-and-why-should-every-azure-developer-care-3d65e8eff76c">Part 1 — Mental model, why MCP matters for Azure</a></li><li>✅ <a href="https://medium.com/gitconnected/your-first-mcp-server-in-c-net-build-something-real-in-30-minutes-ea146c8226e2">Part 2 — First MCP server in C# .NET, tested in GitHub Copilot</a></li><li>✅ Part 3 ← You are here</li><li><strong>Part 4</strong> — Secure with Entra ID + APIM</li><li>Part 5 — Multi-user data isolation with Cosmos DB</li><li>Part 6 — Register in Microsoft Foundry Agent Service</li><li>Part 7 — Observability with OpenTelemetry + Azure Monitor</li><li>Part 8 — Full E2E production system + cost breakdown + production checklist</li></ul><p><em>Divyesh writes production-grade Azure + Microsoft Foundry guides with real code and real benchmarks. Follow for Part 4 — security that doesn’t cut corners.</em></p><p><em>Part 3 of </em><strong><em>MCP on Azure: From Zero to Production</em></strong><em> — published in [Microsoft Azure in Practice].</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78b05bb1e5a9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-azure-in-practice/from-local-to-azure-deploy-your-mcp-server-to-production-78b05bb1e5a9">From Local to Azure: Deploy Your MCP Server to Production</a> was originally published in <a href="https://medium.com/microsoft-azure-in-practice">Microsoft Azure in Practice</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microsoft Build 2026 Day 1: The Platform Has Shifted — Here’s What It Means for Azure Developers]]></title>
            <link>https://medium.com/microsoft-azure-in-practice/microsoft-build-2026-day-1-the-platform-has-shifted-heres-what-it-means-for-azure-developers-beacdb0a2d81?source=rss----a34acb0c483c---4</link>
            <guid isPermaLink="false">https://medium.com/p/beacdb0a2d81</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[microsoft-build]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Divyesh Govaerdhanan]]></dc:creator>
            <pubDate>Tue, 02 Jun 2026 21:33:25 GMT</pubDate>
            <atom:updated>2026-06-02T21:33:24.990Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Every year, Build tells you where the next 18 months are going. This year, it wasn’t subtle.</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qCAgKdz3AVRN-1lHcB9hGA.png" /><figcaption>Microsoft Build 2026</figcaption></figure><p>Microsoft Build 2026 kicked off in San Francisco today (02 Jun 2026), and if there’s one thing the announcements make clear, it’s this: the “AI features bolted onto existing products” era is over. What’s replacing it is deeper, more opinionated, and frankly more interesting for anyone building on Azure.</p><p>Here’s an honest breakdown of what matters, what’s still marketing-speak, and what you should actually care about as an Azure developer — ordered by what changes your architecture, not by what Microsoft put first in their press release.</p><h3>The Thing Everyone Missed: OpenClaw, MXC, and the Agent-Native OS</h3><p>Most of today’s coverage will lead with the new models. That’s the wrong place to start. The announcement with the deepest long-term implications for Azure developers — and the one that got the least airtime — is the OS-level agent execution stack Microsoft quietly shipped today.</p><p><strong>Microsoft Execution Containers (MXC)</strong>, now in preview, adds OS-enforced sandboxing for agent execution directly into Windows. You describe the containment policy once; Windows enforces it everywhere your agents run. No custom runtime, no third-party isolation layer — the operating system itself is the trust boundary.</p><p>Built on top of MXC: <strong>OpenClaw on Windows</strong>, enabling multi-step agentic workflows inside those OS-enforced boundaries on local machines. NVIDIA’s <strong>OpenShell</strong> adds policy management, inference routing, and PII obfuscation on the same primitive. Together, they give you a genuinely safe local execution environment and not a sandpit for demos, but a governance-ready surface for production agent workloads.</p><p>Here’s why this matters in concrete terms. Imagine you’re deploying a Copilot agent that processes HR documents or handles financial reconciliation on-device. Today, the risk is that a compromised or misbehaving agent can read outside its scope, exfiltrate data to a sideloaded process, or escalate privileges. MXC closes that surface at the OS layer — the containment is enforced before the agent ever gets to make a bad call. That’s a different class of security guarantee than anything you can achieve in application code.</p><p>And riding on top of all of this: <strong>Microsoft Scout</strong> — a personal work agent built on OpenClaw and Work IQ, rolling out to Frontier customers today. It handles meeting prep, scheduling conflicts, and routine tasks autonomously using Teams and Outlook natively. No new interface. No separate app. It operates from inside the tools your organization already lives in, backed by OS-level containment.</p><p><strong>The honest take:</strong> MXC is the piece that finally makes “local agent execution” a real enterprise story rather than a developer experiment. If you’ve been hesitant to push agent workloads to end-user devices because you couldn’t answer the governance question, this is the architectural answer. Watch the MXC preview closely, this is the primitive that everything else will build on.</p><h3>Microsoft IQ: Finally, Context That Means Something (But We’ve Heard This Before)</h3><p>The headline enterprise announcement is <strong>Microsoft IQ</strong>, now generally available across GitHub Copilot, Microsoft Foundry, and Copilot Studio. It’s a context layer — not a chatbot feature, not a search upgrade, a programmable intelligence foundation that grounds your agents in both enterprise knowledge and world knowledge simultaneously.</p><p>It ships in four components:</p><ul><li><strong>Work IQ</strong> — workplace intelligence derived from Microsoft 365: emails, documents, meetings, org structure, people relationships. The Work IQ APIs go GA on June 16. This is what makes an agent understand <em>how your company operates</em>, not just what’s in a database.</li><li><strong>Fabric IQ</strong> — semantic layer over structured business data. If your BI stack lives in Fabric, your agents can now reason over it natively.</li><li><strong>Foundry IQ</strong> — an orchestration layer that plans retrieval across enterprise knowledge <em>and</em> the live web in a single query path.</li><li><strong>Web IQ</strong> — new today: an AI-first, MCP-native web search stack that Microsoft claims returns relevant passages at nearly 2.5x the speed of the next best alternative. Model-agnostic, which matters for heterogeneous Foundry setups.</li></ul><p><strong>The honest take:</strong> Work IQ deserves a closer look — but with eyes open. Microsoft has promised programmable enterprise context before. Microsoft Graph was supposed to unlock this a decade ago. Then Semantic Kernel’s memory abstractions. Then the original Copilot extensibility model. Each iteration got closer and hit different walls around latency, schema drift, and cross-system identity resolution.</p><p>The difference this time is meaningful but not yet proven: the APIs are GA on June 16 — not in perpetual preview, and the grounding operates at the retrieval-planning layer rather than as a thin wrapper over search. That’s architecturally the right approach. Whether it holds under real enterprise data volume and the inevitable messiness of production M365 tenants is what the next 90 days will tell us. Mark June 16 in your calendar and actually test the Work IQ APIs against your own data before committing to this as a core dependency.</p><h3>MAI Model Family: Seven New Models, One Important Caveat</h3><p>Microsoft’s AI Superintelligence Team shipped a family of <strong>seven new in-house models</strong> today. The headliner is <strong>MAI-Thinking-1</strong> — Microsoft’s first reasoning model, and the one that will attract the most scrutiny.</p><p>It’s a mid-sized model with 35 billion active parameters and a 256K context window, trained entirely from scratch with no distillation from competing models. That last part matters more than the benchmark numbers: the training data is commercially licensed and enterprise-grade. MAI-Thinking-1 has a cleaner answer than almost anything else on the market.</p><p>Microsoft claims it matches Opus 4.6 on SWE-Bench Pro coding tasks and is preferred over Sonnet 4.6 in blind human evaluations run by Surge, their independent rating partner. It’s available in private preview on Azure AI Foundry today.</p><p>One important caveat: Surge was commissioned by Microsoft, and the SWE-Bench Pro results haven’t been independently replicated yet. The benchmark story is compelling on paper — hold your conviction loosely until the community gets hands-on access.</p><p>The rest of the family fills real production gaps. <strong>MAI-Image-2.5</strong> and its Flash variant handle both text-to-image (#3 on Arena AI leaderboard) and image-to-image (#2) workloads — rolling out in PowerPoint and OneDrive today, landing on Foundry with what Microsoft calls market-leading quality per dollar. <strong>MAI Transcribe 1.5</strong> covers 43 languages with streaming on the way. <strong>MAI-Voice-2 + Flash</strong> add 15+ new languages with expanded voice options. <strong>MAI-Code-1</strong> is an inference-efficient coding model tuned specifically for GitHub, already live in Copilot and VS Code.</p><p>Also worth flagging: <strong>Frontier Tuning</strong>, now in private preview, applies reinforcement learning entirely within your compliance boundary, using your own data, domain knowledge, and workflows, so agents can learn how your business actually operates rather than just generalizing from pre-training. This is the feature that turns a capable foundation model into one that genuinely reflects your organization’s processes. If you’re building agents that need to get better over time rather than staying static, Frontier Tuning is where that loop lives.</p><p><strong>The honest take:</strong> The IP-clean training data story is genuinely the strongest card in this hand for enterprise buyers, not the benchmarks. What matters most for Azure developers is that these models are built for Foundry-native deployment: lower latency, tighter governance integration, and no data leaving your Azure boundary. The benchmark claims will be stress-tested by the community quickly. The data lineage story is structurally harder for competitors to replicate.</p><h3>MDASH: Security Finally Catches Up to the Threat</h3><p><strong>Codename MDASH</strong> is Microsoft’s new multi-model agentic security system, and it’s the most architecturally honest answer to a question the industry has been dodging: who secures the agents?</p><p>MDASH deploys 100+ specialized agents to find exploitable bugs — not by pattern-matching against known CVEs, but by reasoning about data flow, business logic, and exploit chains in context. Fixes surface directly in the Defender Portal.</p><p>This pairs with two new open-source governance projects that are worth understanding separately from the product announcement:</p><ul><li><strong>ASSERT</strong> (Adaptive Spec-driven Scoring for Evaluation and Regression Testing) — policy-driven safety evaluation for agents. The significance here is that it’s spec-driven: you write your intent as a policy, ASSERT generates executable evals from it. This closes the gap between what you meant the agent to do and what you can actually test.</li><li><strong>Agent Control Specification</strong> — an open standard for where and how controls apply in the agent execution loop. This matters because right now every framework (Semantic Kernel, LangChain, AutoGen) has its own control surface. A shared specification is how the ecosystem avoids fracturing into incompatible governance models.</li></ul><p><strong>The honest take:</strong> MDASH is the most concrete answer Microsoft has given to the “who secures the agents?” question. The agentic DevSecOps angle, security that reasons about code intent, is the right direction. Whether 100+ agents find what experienced pentesters miss is something we’ll know from practice. The open-source governance layer is the more durable story: if ASSERT and the Agent Control Specification get broad adoption, they become the compliance baseline every enterprise will need to meet.</p><h3>Surface RTX Spark Dev Box: When Does Local Beat Cloud?</h3><p>Hardware at Build is usually an afterthought. This year, it has a real use-case argument behind it.</p><p>The <strong>Surface RTX Spark Dev Box</strong> is powered by NVIDIA RTX Spark and delivers up to one petaflop of AI compute across 128 GB of unified memory. It runs models up to 120B parameters locally with up to a million token context window, with no cloud GPU instances required. Windows Subsystem for Linux 2 (WSL2) ships preconfigured with native GPU passthrough and full CUDA support, alongside VS Code and GitHub Copilot out of the box. Available later this year in the US.</p><p>The honest question to ask is when this makes economic and operational sense over Azure GPU instances. Running a large model continuously on Azure GPU compute runs into thousands of dollars per month for a single always-on workload — costs that compound quickly across a team running multiple experiments in parallel. The Surface RTX Spark Dev Box is a capital expenditure, not an operational one, which changes the calculus for teams running sustained, long-horizon agent pipelines or frequent local fine-tuning experiments. If your team is spinning up GPU instances repeatedly for iteration rather than burst inference, the economics shift in favor of local hardware faster than you’d expect.</p><p><strong>The honest take:</strong> The 128 GB unified memory is the number that actually matters here — that’s what enables running serious parameter counts without hitting the memory wall that makes local inference painful. This isn’t a machine for hobbyist experimentation. It’s for teams running sustained agentic pipelines or local fine-tuning loops who are tired of watching cloud GPU bills scale with iteration count.</p><h3>Microsoft Discovery: A Reference Architecture Worth Studying</h3><p><strong>Microsoft Discovery</strong> is now generally available, an enterprise-grade agentic AI platform for scientific research workflows, built on Azure. Real customers using it in production today: BHP cutting time-to-solution on copper-leaching R&amp;D from years to months, Syensqo accelerating semiconductor materials research, GSK iterating through drug discovery pipelines.</p><p>A free Discovery local app also launched in preview, requiring only a GitHub Copilot account — no enterprise Azure commitment needed to start exploring it.</p><p>The reason this matters beyond the scientific use cases is architectural. Discovery is a fully realized production example of the agentic pattern most teams are trying to build right now: a persistent, domain-grounded agent that runs long, multi-step tool-use loops, maintains memory across sessions, and retrieves information from specialized knowledge sources rather than from general web context. It’s the same pattern you’d implement in Foundry Agent Service — persistent memory, multi-step reasoning chains, domain-specific retrieval grounding, but here Microsoft has shipped it at production scale, with paying enterprise customers validating the approach. Before you design your own long-running agentic workflow architecture, it’s worth understanding how Discovery handles session persistence and retrieval planning.</p><h3>Majorana 2: Why the Numbers Actually Matter</h3><p>Microsoft’s next-generation quantum computing chip, <strong>Majorana 2</strong> closes the event with the longest time horizon, but the headline numbers deserve more than a bullet list.</p><p>The key metric is qubit lifetime: Majorana 2 achieves an average of 20 seconds, with some instances reaching a full minute. To understand why that’s significant, current superconducting qubit generations — the kind that power most commercial quantum computers today — typically achieve coherence times measured in milliseconds, sometimes microseconds. Majorana 2’s 20-second average represents roughly a 20,000x improvement in the metric that most directly constrains what quantum algorithms can actually compute before errors accumulate and the calculation collapses. The 1,000x reliability improvement over Microsoft’s previous generation compounds on top of that. The path to one million qubits on a single chip — with a 2029 target for a scalable quantum machine — becomes plausible under these numbers in a way it simply wasn’t before.</p><p>For Azure developers, the practical implication isn’t immediate. But the developer platform you’re building on today — Foundry, Azure AI services, the MCP tooling ecosystem — is the same platform that will surface quantum compute primitives when they arrive. The teams that understand the abstraction layer early will have a meaningful head start when hybrid classical-quantum workloads become a real architectural option, particularly in chemistry simulation, logistics optimization, and post-quantum cryptography readiness.</p><h3>The Azure Developer Takeaway</h3><p>Strip away the product branding and here’s what Day 1 of Build 2026 actually said:</p><p><strong>1. The OS is now part of your agent architecture.</strong> MXC and OpenClaw mean that Windows is no longer just the environment your agent runs in — it’s an active participant in governance and containment. Design accordingly.</p><p><strong>2. The context layer is the new competitive moat.</strong> Work IQ, Fabric IQ, Foundry IQ — Microsoft is building the plumbing to make enterprise context programmable. Your agents’ differentiator isn’t which model they call; it’s what they know about your organization. June 16 is when you find out if the Work IQ APIs deliver on that.</p><p><strong>3. Model diversity is now a first-class platform feature.</strong> Foundry is explicitly multi-model — MAI models, Anthropic models, Fireworks AI models, all under the same governance wrapper. The right response is to stop defaulting to a single provider and start matching models to workloads intentionally.</p><p><strong>4. The security story is finally coherent.</strong> MDASH, MXC, ASSERT, Agent Control Specification, Agent 365 — there’s now a connected answer to “how do you govern agents in production?” That wasn’t true twelve months ago. Enterprise deployments that stalled on security and governance justification have less cover for delay.</p><p><strong>5. Local execution is a serious architectural option.</strong> MXC sandboxing, OpenClaw, the Surface RTX Spark Dev Box — running governed AI workloads locally is no longer a developer toy. For the right workload profile, it’s now the economically and operationally correct answer.</p><p>Day 2 starts tomorrow. I’ll be watching the Foundry Agent Service deep-dives and the Work IQ API documentation closely — those are the two announcements where the gap between the keynote story and the implementation reality will show up fastest.</p><h3>Further Reading</h3><p>All announcements covered in this article are sourced directly from Microsoft’s official Build 2026 communications, NDA-free and publicly available:</p><ul><li><strong>Microsoft Build 2026 Live Blog</strong> — full Day 1 announcement stream: <a href="https://news.microsoft.com/build-2026-live-blog">news.microsoft.com/build-2026-live-blog</a></li><li><strong>Official Microsoft Blog: “Be Yourself at Work”</strong> — the keynote narrative and product framing: <a href="https://blogs.microsoft.com/blog/2026/06/02/microsoft-build-2026-be-yourself-at-work/">blogs.microsoft.com/blog/2026/06/02/microsoft-build-2026-be-yourself-at-work</a></li><li><strong>Microsoft Build 2026 Homepage</strong> — sessions, demos, and speaker schedule: <a href="https://news.microsoft.com/build-2026/">news.microsoft.com/build-2026</a></li></ul><p><em>Follow along on </em><a href="https://medium.com/@divyeshg94"><em>Medium</em></a><em> and the </em><a href="https://medium.com/microsoft-azure-in-practice"><em>Microsoft Azure in Practice</em></a><em> publication for ongoing coverage.</em></p><p><em>Thoughts on any of these announcements? Drop them in the comments — particularly interested in what others think about MXC’s real-world governance guarantees and whether the Work IQ APIs hold up against messy production M365 tenants.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=beacdb0a2d81" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-azure-in-practice/microsoft-build-2026-day-1-the-platform-has-shifted-heres-what-it-means-for-azure-developers-beacdb0a2d81">Microsoft Build 2026 Day 1: The Platform Has Shifted — Here’s What It Means for Azure Developers</a> was originally published in <a href="https://medium.com/microsoft-azure-in-practice">Microsoft Azure in Practice</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I built a tool to measure my own team. The results were uncomfortable.]]></title>
            <link>https://medium.com/microsoft-azure-in-practice/i-built-a-tool-to-measure-my-own-team-the-results-were-uncomfortable-cdde80649818?source=rss----a34acb0c483c---4</link>
            <guid isPermaLink="false">https://medium.com/p/cdde80649818</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[dora-metrics]]></category>
            <dc:creator><![CDATA[Divyesh Govaerdhanan]]></dc:creator>
            <pubDate>Sun, 19 Apr 2026 23:35:49 GMT</pubDate>
            <atom:updated>2026-04-19T23:35:49.832Z</atom:updated>
            <content:encoded><![CDATA[<h4>How I tracked DORA metrics across Azure DevOps pipelines using Azure AI Foundry, and what I found when I finally looked.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dqd7gB6Hy9epyCsZbkEd3Q.png" /><figcaption>Image from Velo (ADO Extension)</figcaption></figure><p>There’s a moment every engineering lead knows.</p><p>You’re in a sprint retrospective. Someone asks how the team is doing on deployments. You open Azure DevOps, squint at a list of pipeline runs, scroll for a few seconds, and say something like “looks pretty good, we’re deploying often.”</p><p>You have no idea if that’s actually true.</p><p>That was me. Nine years into cloud engineering, leading a team building production systems on Azure, and I couldn’t answer one of the most basic questions about our delivery health. Not because the data didn’t exist. It did. Every pipeline run, every PR, every failure was right there in Azure DevOps. But it was scattered across four tabs, three filters, and a mental spreadsheet I was maintaining in my head.</p><p>I wasn’t measuring my team’s performance. I was guessing.</p><p>That frustration sat with me for a long time. And about a year ago, I decided to stop being frustrated and start building.</p><h3>What I actually wanted to know</h3><p>I kept coming back to four questions.</p><p>How often are we shipping? When we push code, how fast does it actually reach production? When things break, how bad is it? And when an incident happens, how long before we’re back?</p><p>These aren’t novel questions. Google’s DevOps Research and Assessment team spent years studying thousands of engineering organizations and landed on exactly these four signals as the strongest predictors of software delivery performance. They called them DORA metrics: Deployment Frequency, Lead Time for Changes, Change Failure Rate, and Mean Time to Restore.</p><p>Elite teams deploy multiple times per day. Their lead time from commit to production is under one hour. Their failure rate sits below 5%. And when something breaks, they recover in under an hour.</p><p>I knew what the benchmarks were. What I didn’t have was a single place to see where my team actually stood, in real time, without manually exporting data and building my own pivot tables.</p><p>So I built Velo.</p><h3>The build, honestly</h3><p>The first version was a simple dashboard. Pull pipeline runs, compute four numbers, display them. I built that in a weekend. It worked, and it was immediately useful, but it felt incomplete. Knowing you have a 51.1% change failure rate is interesting. Understanding <em>why</em> and knowing specifically what to do about it is what actually moves the needle.</p><p>That’s when I brought Azure AI Foundry into the picture.</p><p>I connected Velo to a Foundry agent backed by GPT-4o, grounded entirely on your real Azure DevOps data. Not a generic chatbot answering general questions about DevOps. An agent that reads your actual pipeline runs, your actual PR history, your actual failure patterns, and tells you what’s happening in your specific organization.</p><p>The Foundry integration is straightforward once you understand the model: you point Velo at your Azure AI Foundry project endpoint, optionally provide an existing agent ID, and specify your model deployment name. The agent operates within a 50,000 token daily budget so you stay in control of costs.</p><p>The data flows in two directions. First, builds are ingested automatically via webhook every time a pipeline run completes. Second, pull request events stream in through a separate webhook for git.pullrequest.created and git.pullrequest.updated, which is what lets Velo compute real cycle time and approval rate metrics instead of estimated ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yKVdTtJlMWgAjvl6ABo4VA.png" /><figcaption>Connections Tab in Velo</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c-UJly28dQtSLONPHOnftg.png" /><figcaption>Webhook Ingestion</figcaption></figure><p>That real-time ingestion matters. By the time you open the dashboard, the data reflecting your last deployment is already there.</p><h3>What you see when you open it</h3><p>The first screen is the Engineering Command Center.</p><p>On my own project over the last 30 days, here’s what Velo is showing me right now:</p><p><strong>DORA Overall Score: 62 out of 100. High Performer.</strong></p><p>Breaking that down:</p><p>Deployment Frequency is 1.5 per day, rated Elite. Lead Time for Changes is 1 minute commit-to-production, also Elite. That’s the part I’m genuinely proud of. Trunk-based development and a well-optimized Azure DevOps YAML pipeline getting code into production in under 60 seconds.</p><p>Then the honest part.</p><p>Change Failure Rate is 51.1%, rated Low. That means roughly half of all deployments are causing degraded service or requiring remediation. Mean Time to Restore is 10.9 hours, rated High. Rework Rate is 98.9%, also Low.</p><p>This is my own project, and it’s humbling to see it laid out like that. The velocity is Elite. The stability is not. That tension is something I’ve been aware of intuitively, but seeing it scored and ranked against the DORA benchmark thresholds made it concrete in a way that changes how I think about the next sprint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VCXmqFMZxP5ttwYh2KC6vw.png" /><figcaption>Image from Velo — Dashboard</figcaption></figure><p>Below the metrics are two panels that I’ve found myself using the most: Priority Actions and Performance Insights.</p><p>Priority Actions ranks the metrics by impact. It tells me to address the Change Failure Rate first: “High change failure rate requires immediate attention. Audit pipeline configurations and consider feature flags for risky changes.” Then Rework Rate: “Mandatory peer reviews and definition-of-done checklists are recommended.”</p><p>Performance Insights gives the same signal from a different angle. The Lead Time panel reads: “Commits are reaching production in under an hour. Your CI/CD pipeline is well-optimized. Maintain trunk-based development.” The MTTR panel reads: “Good recovery time. Improving incident runbooks and on-call handoffs could help achieve Elite recovery speeds.”</p><p>These aren’t templated strings. They’re generated by the Foundry agent reading the actual metric values and producing contextual recommendations for that specific team, in that specific moment.</p><h3>The Team Health tab surprised me</h3><p>I built the DORA metrics view first. The Team Health tab came out of a question I kept getting from myself: DORA tells me about delivery outcomes, but what about the pipeline health underneath that’s driving those outcomes?</p><p>Team Health computes a score from four signals: test pass rate, flaky pipeline rate, deployment risk score, and CI gate pass rate.</p><p>My current score is 63 out of 100. Fair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E6pobpL30mUZQBJoNeC3tw.png" /><figcaption>Image from Velo — Team Health</figcaption></figure><p>Cycle time breakdown: 41 minutes in coding, 1 minute in CI, 1 minute for merge, and the deploy step showing a dash because it’s measured separately. Total end-to-end is 42 minutes.</p><p>The quality signals panel is where things get interesting. Test pass rate is 47.2%. That number, combined with the 51.1% change failure rate, tells a clear story: the tests aren’t catching enough before code reaches production. The CI gate pass rate is also 47.2%, which effectively confirms that pattern.</p><p>Flaky pipeline rate is 0.0%, which is the one metric I can feel genuinely good about. Zero flaky tests means the signal from failing pipelines is real, not noise.</p><p>Deployment Risk Score is 26.4. Velo describes this as a composite of failure rate, flakiness, and deploy duration, where lower is better.</p><p>I didn’t know any of these numbers before I built this.</p><h3>The pipeline view and team mappings</h3><p>The Pipelines tab shows every run, ranked by recency, with result, duration, and trigger. You can filter to deployments only or drill down by repository. It’s simple but useful for diagnosing which pipelines are contributing most to your failure rate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F6QyPHqENf5Xz44M8AbqeA.png" /><figcaption>Velo — Pipelines</figcaption></figure><p>The Teams tab lets you map repositories to team names so that DORA and Health metrics can be filtered per team. This is the feature that makes Velo useful at scale. Once your repositories are mapped, every view in the product gains a filter-by-team dropdown, and you can see platform team performance separately from product teams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n2E6y9EtWCcL96sHUEDjaw.png" /><figcaption>Velo — Team Mappings</figcaption></figure><h3>What building this taught me</h3><p>The hardest part wasn’t the Azure AI Foundry integration or the webhook plumbing. It was deciding what not to build.</p><p>The temptation with any metrics product is to show everything. Every data point, every trend, every possible slice. I had to keep asking: what does an engineering lead actually do differently on Monday morning after seeing this? Everything else is noise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*raXte3BM41AlzGRosbBdaw.png" /><figcaption>Velo — AI Agents</figcaption></figure><p>The second hard part was making the AI recommendations feel earned rather than generic. The difference between “consider feature flags” and “your Change Failure Rate is 51.1%, which is in the Low tier, meaning roughly half your production deployments are causing issues, here is what typically drives that pattern and what to look at first” is the difference between a tool people open once and a tool they open every week.</p><p>Getting that right required a lot of iteration on how the agent is prompted, how the data is structured before it reaches the model, and how the output is surfaced in the UI so it reads as specific rather than boilerplate.</p><h3>What’s next</h3><p>Velo is live today on the Azure DevOps Marketplace. It’s free.</p><p>Velo is available free on the <a href="https://marketplace.visualstudio.com/items?itemName=IngeniousLabs.velo#review-details">Azure DevOps Marketplace</a>. Source code is on <a href="https://github.com/divyeshg94/Ingenious.Velo">GitHub</a>.</p><p>The roadmap includes a self-hosted deployment option using Bicep for teams that cannot send pipeline data to an external service, a Slack and Teams notification integration for weekly digest reports, and deeper AI analysis that can compare team-to-team performance across an organization.</p><p>If you’re running pipelines in Azure DevOps and you’re not entirely sure how your team is performing against the DORA benchmarks, give it 10 minutes. Connect your organization, hit Sync, and the dashboard populates in seconds.</p><p>I’d genuinely value your feedback. Every review on the Marketplace, every GitHub issue, and every message reaching out to say what’s working and what isn’t directly shapes what I build next.</p><p><em>If this article was useful to you, </em><strong><em>clap </em></strong><em>a few times. It tells me the topic is worth writing more about, and it helps other engineers find it.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cdde80649818" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-azure-in-practice/i-built-a-tool-to-measure-my-own-team-the-results-were-uncomfortable-cdde80649818">I built a tool to measure my own team. The results were uncomfortable.</a> was originally published in <a href="https://medium.com/microsoft-azure-in-practice">Microsoft Azure in Practice</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Write for Microsoft Azure in Practice]]></title>
            <link>https://medium.com/microsoft-azure-in-practice/write-for-microsoft-azure-in-practice-9243daa39049?source=rss----a34acb0c483c---4</link>
            <guid isPermaLink="false">https://medium.com/p/9243daa39049</guid>
            <category><![CDATA[publishers]]></category>
            <category><![CDATA[article-writing]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[blogging]]></category>
            <dc:creator><![CDATA[Divyesh Govaerdhanan]]></dc:creator>
            <pubDate>Sat, 18 Apr 2026 16:52:19 GMT</pubDate>
            <atom:updated>2026-04-18T16:52:19.124Z</atom:updated>
            <content:encoded><![CDATA[<h4>Contributor Guide, Standards, and How to Get Published</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XE3NiUUs27Gwb-80oYuKbA.jpeg" /><figcaption>Image from Pexels by <a href="https://www.pexels.com/@anntarazevich/">Anna Tarazevich</a></figcaption></figure><p>We’re building <strong>Microsoft Azure in Practice</strong> into a high-quality, practitioner-first publication focused on <strong>real-world cloud architecture, DevOps, and AI systems on Azure</strong>.</p><p>If you’ve built, scaled, optimized, or solved real problems in Azure, we want your story.</p><h3>What We Publish</h3><p>We prioritize <strong>experience-driven, high-impact content</strong>:</p><h3>High Priority Topics</h3><ul><li>Azure architecture (real-world systems)</li><li>DevOps &amp; CI/CD (Azure DevOps, GitHub Actions)</li><li>Microservices &amp; distributed systems</li><li>AI/LLM systems on Azure</li><li>Performance &amp; cost optimization</li><li>Security (Zero Trust, cloud security patterns)</li></ul><h3>What We Avoid</h3><ul><li>Basic beginner tutorials</li><li>Rewritten documentation</li><li>Generic or surface-level content</li><li>Pure opinions without technical depth</li></ul><h3>What Makes a Strong Article</h3><p>A high-quality article should include:</p><h3>1. Real Problem</h3><p>Explain the actual challenge:</p><ul><li>What was not working?</li><li>What needed improvement?</li></ul><h3>2. Practical Solution</h3><p>Show:</p><ul><li>Architecture decisions</li><li>Trade-offs</li><li>Why did you choose a specific approach</li></ul><h3>3. Metrics &amp; Results (Critical)</h3><p>Include measurable outcomes:</p><ul><li>Performance improvements</li><li>Cost reductions</li><li>Efficiency gains</li></ul><h3>4. Visuals</h3><p>Use:</p><ul><li>Architecture diagrams</li><li>Flowcharts</li><li>Before/after comparisons</li></ul><h3>5. Lessons Learned</h3><p>Share insights:</p><ul><li>What didn’t work</li><li>What would you change</li></ul><h3>Writing Standards</h3><h3>Style</h3><ul><li>Clear, simple English</li><li>Short, readable sentences</li><li>Avoid unnecessary jargon</li></ul><h3>Formatting</h3><ul><li>Use headings and subheadings</li><li>Break content into sections</li><li>Include code snippets where relevant</li></ul><h3>Readability</h3><ul><li>Keep it concise and structured</li></ul><h3>Tools We Recommend</h3><p>To maintain consistency and quality:</p><ul><li><strong>Images:</strong> <a href="https://www.pexels.com/">https://www.pexels.com/</a></li><li><strong>Code snippets:</strong> <a href="https://gist.github.com/">https://gist.github.com/</a></li><li><strong>Tables &amp; data:</strong> <a href="https://app.datawrapper.de/">https://app.datawrapper.de/</a></li><li><strong>Diagrams:</strong> draw.io / Excalidraw</li></ul><h3>Suggested Article Structure</h3><p><strong>Title</strong><br>Outcome-driven and specific</p><p><strong>Introduction</strong><br>Context + what the reader will learn</p><p><strong>Problem</strong><br>Real-world challenge</p><p><strong>Approach</strong><br>Architecture/design decisions</p><p><strong>Implementation</strong><br>Steps, code, configurations</p><p><strong>Results</strong><br>Metrics and improvements</p><p><strong>Lessons Learned</strong><br>Key takeaways</p><p><strong>Conclusion</strong><br>Summary and practical advice</p><h3>How to Submit</h3><p>We follow a simple and structured submission process.</p><h3>Step 1: Prepare Your Draft</h3><ul><li>Write your article in Medium</li><li>Keep it as a <strong>draft (not published)</strong></li></ul><h3>Step 2: Send Us an Email</h3><p>Email us with:</p><ul><li>To: <strong>divyeshgovardhanan@gmail.com</strong></li><li>Your <strong>Medium draft link</strong></li><li>Proposed title</li><li>2–3 lines explaining the value of the article</li></ul><h3>Step 3: Review Process</h3><p>We will:</p><ul><li>Review for quality, clarity, and relevance</li><li>Suggest edits if needed</li><li>Align the article with publication standards</li></ul><p>Once approved, we will:</p><ul><li>Add you as a writer</li><li>Publish the article under the publication</li></ul><h3>Contributor Standards</h3><p>All submissions must:</p><ul><li>Be <strong>original and unpublished content</strong></li><li>Follow ethical writing practices</li><li>Avoid plagiarism (strictly enforced)</li><li>Provide references where applicable</li></ul><h3>Why Write With Us</h3><ul><li>Build <strong>technical authority and visibility</strong></li><li>Showcase <strong>real-world expertise</strong></li><li>Strengthen your professional profile</li><li>Reach a focused audience in the cloud and Azure</li></ul><p>We value <strong>practical knowledge over theory</strong>.</p><p>If you’ve solved something meaningful, optimized a system, or learned something valuable through experience, your story belongs here.</p><p>Send us your <strong>Medium draft link via email</strong>, and we’ll take it from there.</p><p>Let’s build a strong, high-quality Azure engineering community together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9243daa39049" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-azure-in-practice/write-for-microsoft-azure-in-practice-9243daa39049">Write for Microsoft Azure in Practice</a> was originally published in <a href="https://medium.com/microsoft-azure-in-practice">Microsoft Azure in Practice</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Fast Is Microsoft Foundry Local on an NVIDIA RTX 6000?]]></title>
            <link>https://medium.com/microsoft-azure-in-practice/how-fast-is-microsoft-foundry-local-on-an-nvidia-rtx-6000-bc756fdbfd3a?source=rss----a34acb0c483c---4</link>
            <guid isPermaLink="false">https://medium.com/p/bc756fdbfd3a</guid>
            <category><![CDATA[local-llm]]></category>
            <category><![CDATA[microsoft-foundry-local]]></category>
            <category><![CDATA[nvidia]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[microsoft-foundry]]></category>
            <dc:creator><![CDATA[Divyesh Govaerdhanan]]></dc:creator>
            <pubDate>Mon, 12 Jan 2026 00:25:56 GMT</pubDate>
            <atom:updated>2026-01-12T00:25:55.592Z</atom:updated>
            <content:encoded><![CDATA[<h3>How Fast Is Microsoft Foundry Local on an NVIDIA RTX 6000? Real Benchmarks with Phi-3.5, Qwen 2.5 &amp; GPT-OSS-20B</h3><p><em>Real Benchmarks with Qwen, GPT-OSS-20B &amp; Friends (Plus Open-Source .NET)</em></p><p>On-device AI is no longer a “<em>someday</em>” story.</p><p>With <strong>Microsoft Foundry Local</strong>, you can pull optimized models from the Azure AI / Microsoft Foundry catalog, cache them on your machine, and run them entirely <strong>offline</strong>, accelerated by ONNX Runtime on your local CPU/GPU/NPU.</p><p>And if you happen to have a workstation-class GPU — in my case, an <strong>NVIDIA RTX 6000 with 96 GB VRAM</strong> in a custom-configured Dell tower — you start to wonder:</p><p><em>“What does Foundry Local actually feel like on serious hardware?<br>Can I treat local models as real alternatives to cloud-only LLMs?”</em></p><p>So instead of guessing, I built a small <strong>benchmark harness in .NET</strong>, ran multiple real-world prompts against different models, and logged the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kPGZkjInx5JJWwP2" /><figcaption>Microsoft Foundry Local</figcaption></figure><p>This post walks through:</p><ul><li>The <strong>hardware &amp; software setup</strong></li><li>The <strong>models under test</strong> (Qwen 2.5, GPT-OSS-20B, etc.)</li><li>The <strong>benchmark scenarios</strong> (reasoning, C# coding, KPI analysis)</li><li>The <strong>patterns I saw</strong> — which models feel “instant”, which feel “cloud-like.”</li><li>A link to the <strong>full benchmark code on GitHub</strong> so you can run your own tests</li></ul><h3>Why Foundry Local is worth benchmarking</h3><p>Microsoft Foundry Local is an <strong>on-device AI runtime</strong> that:</p><ul><li>Let&#39;s you <strong>discover and pull</strong> optimized ONNX models from the Foundry catalog</li><li>Caches them locally so you can run with <strong>zero internet connectivity</strong></li><li>Uses <strong>ONNX Runtime</strong> under the hood to select the best execution provider (CUDA, DirectML, QNN, etc.) for your hardware</li><li>Exposes an <strong>OpenAI-compatible REST API</strong>, so existing apps can usually just switch the base URL</li><li>It sits alongside cloud-hosted models in <strong>Microsoft Foundry (formerly Azure AI Foundry)</strong>, but runs entirely on your hardware as an on-device LLM runtime.</li></ul><p>The model catalog already includes:</p><ul><li><strong>Qwen 2.5</strong> instruct and coder variants (great quality/latency trade-off)</li><li><strong>Phi 3 / 3.5 / 4</strong> mini and reasoning models from Microsoft</li><li><strong>Mistral</strong> 7B variants</li><li><strong>DeepSeek R1</strong> reasoning models</li><li>And, crucially, <strong>OpenAI’s GPT-OSS-20B</strong>, which brings “near o3-mini-class” reasoning to local PCs with ~16 GB+ VRAM.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6OD_cMs4qkixhxhOTtWCKA.jpeg" /><figcaption>Foundry Model List</figcaption></figure><p>Theoretically, this is beautiful. But I wanted to see:</p><ul><li>How do these models <strong>compare in practice</strong> on a big RTX GPU?</li><li>Where’s the sweet spot between <strong>latency</strong> and <strong>quality</strong> for day-to-day dev/data work?</li><li>Does <strong>GPT-OSS-20B</strong> actually feel usable locally, or is it just a demo?</li></ul><h3>My setup: hardware &amp; software</h3><p><strong>Hardware</strong></p><ul><li>Dell tower workstation (custom “Pro Max Power T2” build)</li><li><strong>GPU:</strong> NVIDIA RTX 6000 (96 GB VRAM)</li><li><strong>CPU:</strong> Intel Core i9, 128GB RAM</li><li><strong>Storage:</strong> NVMe SSD (models + Foundry cache on SSD)</li></ul><p><strong>Software</strong></p><ul><li>Windows 11 Enterprise (64-bit)</li><li><strong>Microsoft Foundry Local</strong> (version 0.8.117)</li><li><strong>ONNX Runtime</strong> (bundled via Foundry Local)</li><li>.NET 10 SDK</li><li>nvidia-smi for GPU monitoring</li></ul><p><em>I intentionally ran everything </em><strong><em>locally</em></strong><em> — no calls to Azure OpenAI or remote endpoints. Every token you see in this post came from the RTX 6000 under my desk.</em></p><h3>Benchmark methodology</h3><p>Rather than ping each model with “Hello world” and call it a day, I used <strong>four realistic scenarios</strong> that look like actual day-to-day work.</p><h4>Architecture &amp; reasoning</h4><p><em>Prompt:</em></p><p><em>“You are a senior cloud architect. Explain this setup: an event-driven microservices system using Azure Service Bus + Azure Functions + Cosmos DB. Identify 3 scalability risks and 3 cost optimizations.”</em></p><p>What I looked for:</p><ul><li>Can the model <strong>identify real architectural bottlenecks</strong>?</li><li>Does it <strong>prioritize practical cloud patterns</strong> (batching, partitioning, TTL, etc.)?</li></ul><h4>Mathematical Reasoning</h4><p><em>Prompt:</em></p><p>“<em>Calculate the integral of x² from 0 to 1.</em>”</p><p>Here I looked for:</p><ul><li>Get the right numeric answer</li><li>Apply the Fundamental Theorem of Calculus correctly</li><li>Explain the steps</li></ul><h4>C# coding assistant</h4><p><em>Prompt:</em></p><p>“You are a senior C# engineer. Write a C# method that validates an IBAN (basic format check is enough) and add 5 xUnit tests that cover valid and invalid edge cases.”</p><p>Here I care about:</p><ul><li>Correctness (or at least plausibility) of the validation logic</li><li>Diversity and relevance of the test cases</li><li>How “copy-paste-able” the code feels for a .NET dev</li></ul><h4>KPI &amp; analytics reasoning</h4><p><em>“You are a SaaS product analyst. </em>Summarize the health of the product and list the top 2 risks.<em><br> Given this data:</em></p><pre>Month,MRR,Churn,NPS<br>Jan,100000,4.1,45<br>Feb,102500,3.9,48<br>Mar,105000,4.7,38</pre><p>Here I’m testing:</p><ul><li>Whether the model notices <strong>trends</strong> (e.g., MRR up, churn slightly up, NPS drop)</li><li>Ability to explain risks in <strong>plain language</strong></li></ul><h3>Metrics I recorded</h3><p>For each (model, scenario) pair, the harness recorded:</p><ul><li><strong>Total latency (ms)</strong> for the completion</li><li><strong>Output length</strong> (characters/tokens — approximate)</li><li>A <strong>manual “quality” score</strong> I assigned (1–5) based on:</li><li>correctness</li><li>clarity</li></ul><p>All runs were logged to CSV/JSON so I could later build tables and charts.</p><p><strong>You can find the full benchmark harness here:</strong><br> https://github.com/divyeshg94/FoundryLocalBench<br> (and specifically, Program.cs for the main loop).</p><h3>The .NET benchmarking harness (high-level)</h3><p>The harness utilizes the <strong>Foundry Local SDK for .NET,</strong> along with the OpenAI-style chat client surface. The pattern is:</p><ol><li>Initialize FoundryLocalManager with a config.</li><li>For each model alias:</li></ol><ul><li>Ensure the model is <strong>downloaded</strong> and <strong>loaded</strong></li><li>Create a chat client bound to that model</li><li>Run each benchmark prompt</li><li>Measure and log latency + output stats</li></ul><p>Here’s a simplified view of the main benchmark loop in Program.cs.</p><pre>var models = new[]<br>{<br>    &quot;phi-3.5-mini&quot;,<br>    &quot;mistral-7b-v0.2&quot;,<br>    &quot;qwen2.5-1.5b&quot;,<br>    &quot;deepseek-r1-14b&quot;,<br>    &quot;gpt-oss-20b&quot;<br>};<br><br>var tasks = new[]<br>{<br>    (&quot;reasoning&quot;, &quot;You are a senior cloud architect. Explain this setup: an event-driven microservices system using Azure Service Bus + Azure Functions + Cosmos DB. Identify 3 scalability risks and 3 cost optimizations.&quot;),<br>    (&quot;reasoning-Math&quot;, &quot;Calculate the integral of x^2 from 0 to 1.&quot;),<br>    (&quot;coding&quot;, &quot;You are a senior C# engineer. Write a C# method that validates an IBAN (basic format check is enough) and add 5 xUnit tests that cover valid and invalid edge cases.&quot;),<br>    (&quot;kpi&quot;, &quot;You are a SaaS product analyst. Given this data:\n\nMonth,MRR,Churn,NPS\nJan,100000,4.1,45\nFeb,102500,3.9,48\nMar,105000,4.7,38\n\nSummarize the health of the product, and list the top 2 risks.&quot;)<br>};<br><br>foreach (var (taskName, prompt) in tasks)<br>{<br>    foreach (var alias in models)<br>    {<br>        Console.WriteLine($&quot;\nRunning {alias} …&quot;);<br><br>        var (client, model) = await TryInvokeAgentAsync(alias);<br>        // Capture GPU metrics before inference<br>        var gpuBefore = GetNvidiaMetrics();<br>        var sw = Stopwatch.StartNew();<br><br>        // Simple retry with exponential backoff for transient errors<br>        string responseText = await GetChat(client, model, prompt);<br><br>        sw.Stop();<br>        var cpuEnd = proc.TotalProcessorTime;<br><br>        // Capture GPU metrics after inference<br>        var gpuAfter = GetNvidiaMetrics();<br><br>        var content = responseText;<br>        var ms = sw.ElapsedMilliseconds;<br>        if (ms == 0) ms = 1; // avoid divide-by-zero leading to Infinity in metrics<br>        var chars = content.Length;<br>        var tokens = EstimateTokens(content);<br>        var elapsedSeconds = Math.Max(sw.Elapsed.TotalSeconds, 0.000001);<br>        var tokensPerSec = tokens / elapsedSeconds;<br><br>        var result = new BenchResult(alias, taskName, ms, chars);<br>        results.Add(result);<br>}</pre><h3>What the benchmarks actually showed on the RTX 6000</h3><p>I ran four realistic tasks (reasoning, math reasoning, C# coding, KPI analysis) across five models:</p><ul><li>phi-3.5-mini</li><li>qwen2.5-1.5b</li><li>gpt-oss-20b</li><li>deepseek-r1-14b</li><li>mistral-7b-v0.2</li></ul><p><strong><em>Note:</em></strong><em> On smaller cards (16–24 GB VRAM), start with </em><em>qwen2.5-0.5b, </em><em>qwen2.5-1.5b, and </em><em>phi-3-mini. Keep </em><em>gpt-oss-20b as an optional “big gun” if your GPU can handle it.</em></p><p>Each (model, task) pair logged latency, token count, tokens/sec, CPU + GPU metrics, and the full response. Below is what the <strong>real runs on an NVIDIA RTX PRO 6000 (96 GB)</strong> looked like.</p><p><strong><em>NOTE:</em></strong>mistral-7b-v0.2 consistently failed in all tasks (latencies like 2–18 ms with zero output) and deepseek-r1-14b produced <strong>text only for the math-reasoning task</strong>. For the other three tasks, DeepSeek ran for ~100–200 seconds and then failed.<br>For that reason, I <strong>exclude Mistral completely</strong> and treat DeepSeek’s non-math runs as <strong>failures/timeouts</strong>, not valid completions.</p><h3>Reasoning over architecture</h3><p><strong>Median latencies &amp; output:</strong></p><ol><li><strong>Phi-3.5-mini</strong></li></ol><ul><li>~<strong>10.3 s</strong></li><li>~<strong>596 tokens</strong> (~4,260 characters)</li><li>~<strong>58 tokens/sec</strong></li></ul><p>2. G<strong>PT-OSS-20B</strong></p><ul><li>~<strong>36.3 s</strong></li><li>~<strong>1,289 tokens</strong> (~9,237 chars)</li><li>~<strong>35 tokens/sec</strong></li></ul><p>3. <strong>Qwen-2.5–1.5B</strong></p><ul><li>~<strong>45.9 s</strong></li><li>~<strong>547 tokens</strong> (~3,752 chars)</li><li>~<strong>12 tokens/sec</strong></li></ul><p><strong>How it felt</strong></p><ul><li><strong>Phi-3.5-mini</strong> was the clear sweet spot: fast enough to feel interactive and detailed enough to give a genuinely useful cloud-architecture review.</li><li><strong>GPT-OSS-20B</strong> produced the richest and most thorough breakdown (the longest answer and best structure), but you pay roughly three times the latency compared to Phi-3.5.</li><li><strong>Qwen-2.5–1.5B</strong> was surprisingly slower in this setup. Quality was good, but the latency of ~46 s makes it more of a “batch reasoning” model than an interactive assistant.</li></ul><h3>Math-heavy reasoning</h3><p><strong>Prompt:</strong> Compute the definite integral of x² from 0 to 1 and explain the steps.</p><p><strong>Median latencies &amp; output:</strong></p><ol><li><strong>GPT-OSS-20B</strong></li></ol><ul><li>~<strong>3.0 s</strong></li><li>~<strong>39 tokens</strong> (~390 chars)</li><li>~<strong>13 tokens/sec</strong></li></ul><p>2. <strong>Phi-3.5-mini</strong></p><ul><li>~<strong>3.3 s</strong></li><li>~<strong>153 tokens</strong> (~814 chars)</li><li>~<strong>47 tokens/sec</strong></li></ul><p>3. <strong>Qwen-2.5–1.5B</strong></p><ul><li>~<strong>22.4 s</strong></li><li>~<strong>171 tokens</strong> (~981 chars)</li><li>~<strong>7.6 tokens/sec</strong></li></ul><p>4. <strong>DeepSeek-R1–14B</strong></p><ul><li>~<strong>63.6 s</strong></li><li>~<strong>200 tokens</strong> (~1,187 chars)</li><li>~<strong>3.1 tokens/sec</strong></li></ul><p>Again, <strong>Mistral 7B reported 3 ms with 0 tokens</strong>, so I treat that as a failure.</p><p><strong>How it felt</strong></p><ul><li>For this kind of math reasoning, <strong>GPT-OSS-20B and Phi-3.5-mini were essentially tied on latency (~3 s)</strong>.</li><li>GPT-OSS-20B gave a compact, very confident derivation.</li><li>Phi-3.5-mini took slightly longer but wrote a more verbose, tutorial-style answer.</li><li><strong>Qwen-2.5–1.5B</strong> was accurate but much slower (~22 s).</li><li><strong>DeepSeek-R1–14B</strong> did complete here, but at ~64 s, it felt more like a batch job than an assistant.</li></ul><h3>C# coding assistant (IBAN validator)</h3><p><strong>Median latencies &amp; output:</strong></p><ol><li><strong>Phi-3.5-mini</strong></li></ol><ul><li>~<strong>12.5 s, </strong>~<strong>454 tokens</strong> (~3,928 chars), ~<strong>36 tokens/sec</strong></li></ul><p>2. <strong>GPT-OSS-20B</strong></p><ul><li>~<strong>35.9 s, </strong>~<strong>1,174 tokens</strong> (~7,526 chars), ~<strong>33 tokens/sec</strong></li></ul><p>3. Q<strong>wen-2.5–1.5B</strong></p><ul><li>~<strong>40.6 s, </strong>~<strong>235 tokens</strong> (~2,139 chars), ~<strong>5.8 tokens/sec</strong></li></ul><p><strong>How it felt</strong></p><ul><li><strong>Phi-3.5-mini</strong> shines as a <strong>local dev helper</strong>: it generates clean C# plus realistic unit tests in ~12 seconds.</li><li><strong>GPT-OSS-20B</strong> is slower but very thorough: more explanation, more nuanced tests, and generally “senior-dev review” vibes.</li><li><strong>Qwen-2.5–1.5B</strong> works, but at ~40 s for code generation it’s better suited for less interactive workflows.</li><li><strong>DeepSeek-R1–14B</strong> timed out again with no code emitted.</li></ul><h3>KPI &amp; analytics reasoning</h3><p><strong>Median latencies &amp; output:</strong></p><p>1. <strong>Phi-3.5-mini</strong></p><ul><li>~<strong>8.5 s, </strong>~<strong>548 tokens</strong> (~3,546 chars), ~<strong>64 tokens/sec</strong> (fastest of all)</li></ul><p>2. G<strong>PT-OSS-20B</strong></p><ul><li>~<strong>15.1 s, </strong>~<strong>519 tokens</strong> (~3,281 chars), ~<strong>34 tokens/sec</strong></li></ul><p>3. <strong>Qwen-2.5–1.5B</strong></p><ul><li>~<strong>39.6 s, </strong>~<strong>315 tokens</strong> (~2,073 chars), ~<strong>8 tokens/sec</strong></li></ul><p><strong>How it felt</strong></p><ul><li><strong>Phi-3.5-mini</strong> is almost tailor-made for this: it quickly spots churn trends, NPS dip, and articulates business risks in human language.</li><li><strong>GPT-OSS-20B</strong> is again the “deluxe” option: slightly slower, but very structured and “consultant-grade” in the way it writes risks and recommendations.</li><li><strong>Qwen-2.5–1.5B</strong> produces decent product-analytics commentary but with significantly higher latency on this hardware.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*kmR5F1BYvjr5ZVq48u-Y4w.jpeg" /><figcaption>Summary of Task vs model’s perf</figcaption></figure><h3>GPU usage snapshot</h3><p>For the successful runs (tasks where tokens &gt; 0):</p><ul><li><strong>Phi-3.5-mini</strong> and <strong>Qwen-2.5–1.5B</strong> hovered around <strong>~20 GB GPU memory</strong> used.</li><li><strong>GPT-OSS-20B</strong> and <strong>DeepSeek-R1–14B</strong> sat around <strong>~23–24 GB</strong> in my logs.</li></ul><p>On a 96 GB RTX 6000 that’s trivial, but this matters if you’re on a 16–24 GB card:</p><ul><li>Phi-3.5 and Qwen-2.5 are friendlier for smaller GPUs.</li><li>GPT-OSS-20B is still viable, but you’ll want at least ~16 GB free.</li></ul><h3>TL;DR of the benchmarks</h3><p>If you’re already using <strong>Azure OpenAI</strong> in Microsoft Foundry, Foundry Local is a natural way to bring some of that power closer to your RTX GPU.</p><p>Based on real runs from the benchmarks.csv / .jsonl:</p><p><strong>Phi-3.5-mini</strong> is the <strong>star of this test</strong></p><ul><li>Fastest across all four tasks, where it produced output</li><li>Highest tokens/sec</li><li>Good balance of detail vs latency</li><li>Great default “local assistant” and coding helper</li></ul><p><strong>GPT-OSS-20B</strong> is the <strong>local heavy hitter</strong></p><ul><li>Slower (15–36 s on non-math tasks), but strongly reasoned and very detailed answers</li><li>Feels like a local substitute when you want to “think hard before answering.”</li></ul><p><strong>Qwen-2.5–1.5B</strong> is <strong>stable but noticeably slower in this setup</strong></p><ul><li>Reasonable quality, especially in math and KPI analysis</li><li>Latency (~22–46 s) pushes it toward batch/offline usage rather than a constantly-on assistant</li></ul><p><strong>Mistral-7B-v0.2</strong> and <strong>DeepSeek-R1–14B</strong> had <strong>stability issues</strong> with this version of Foundry Local</p><ul><li>Mistral failed on all tasks</li><li>DeepSeek only produced text for the math scenario; other tasks timed out or returned empty content</li><li>I excluded them from any serious quality comparison until I can debug model/runtime compatibility</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LZVtDhDxdsvz5fHx_QVyMA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2DQ6QzQ8d43wllVT7G2LAw.png" /><figcaption>Sum of Tokens &amp; Time for each model</figcaption></figure><p>The biggest surprise for me was how often <strong>Phi-3.5-mini</strong> beat everything else, not just on speed but on <em>how usable</em> its answers were for architecture reviews and KPI analysis.</p><h3>How to reproduce this on your own machine</h3><h4>Install Foundry Local</h4><pre>### 3 steps to reproduce this benchmark<br>#Install Microsoft Foundry Local <br><br>winget install Microsoft.FoundryLocal<br>foundry --version<br><br>#List available models<br><br>foundry model list --filter task=chat-completion<br>#Pick a handful that match your GPU and interest (Qwen, Phi, Mistral, GPT-OSS).<br><br><br>#Clone the benchmark repo<br>git clone https://github.com/divyeshg94/FoundryLocalBench.git<br>cd FoundryLocalBench<br>dotnet run -c Release<br><br>#Watch your GPU<br>nvidia-smi -l 2</pre><p><a href="https://learn.microsoft.com/en-us/azure/ai-foundry/foundry-local/get-started?view=foundry-classic">https://learn.microsoft.com/en-us/azure/ai-foundry/foundry-local/get-started?view=foundry-classic</a></p><p>With Microsoft Foundry Local, swapping models is usually a one-line change in code or config. You’re not rewriting your whole stack, just changing which brain you plug in.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc756fdbfd3a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-azure-in-practice/how-fast-is-microsoft-foundry-local-on-an-nvidia-rtx-6000-bc756fdbfd3a">How Fast Is Microsoft Foundry Local on an NVIDIA RTX 6000?</a> was originally published in <a href="https://medium.com/microsoft-azure-in-practice">Microsoft Azure in Practice</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Observability for Microsoft Foundry Agents with Azure Monitor & OpenTelemetry (.NET First)]]></title>
            <link>https://medium.com/microsoft-azure-in-practice/observability-for-microsoft-foundry-agents-with-azure-monitor-opentelemetry-net-first-f1940262fc6c?source=rss----a34acb0c483c---4</link>
            <guid isPermaLink="false">https://medium.com/p/f1940262fc6c</guid>
            <category><![CDATA[azure-monitor]]></category>
            <category><![CDATA[microsoft-foundry]]></category>
            <category><![CDATA[ai-observability]]></category>
            <category><![CDATA[opentelemetry]]></category>
            <category><![CDATA[observability]]></category>
            <dc:creator><![CDATA[Divyesh Govaerdhanan]]></dc:creator>
            <pubDate>Sat, 10 Jan 2026 17:29:58 GMT</pubDate>
            <atom:updated>2026-01-10T17:29:30.719Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve built <em>any</em> serious AI agent in the last year, you’ve probably had this moment:</p><p><em>“The demo looked perfect… but in prod, some requests are slow, some tools fail, and sometimes the agent just… vibes. What on earth is it doing inside?”</em></p><p>Playground demos don’t prepare you for <strong>production debugging</strong>.</p><p>Microsoft Foundry (formerly Azure AI Foundry) has quietly made observability a first-class citizen: tracing, evaluations, metrics, and monitoring are now built into the platform, not an afterthought.</p><p>In this post, I’ll show you how to turn your agents from <strong>black boxes</strong> into <strong>glass boxes</strong> using:</p><ul><li><strong>Microsoft Foundry</strong> for agent-level tracing and evaluation</li><li><strong>Azure Monitor / Application Insights</strong> for metrics and dashboards</li><li><strong>OpenTelemetry in .NET</strong> to stitch everything together end-to-end</li></ul><p>This is written from a <strong>.NET + Azure</strong> perspective, but the concepts apply to any stack.</p><h3>Why observability for agents is different</h3><p>Traditional apps talk about three pillars:</p><ul><li><strong>Logs</strong> — what happened</li><li><strong>Metrics</strong> — how often / how slow</li><li><strong>Traces</strong> — how a request flowed through services</li></ul><p>Generative AI and agents add at least two more:</p><ul><li><strong>Evaluations</strong> — did the model/agent output actually meet quality &amp; safety expectations?</li><li><strong>Governance</strong> — who can run what, on which data, under which policies?</li></ul><p>Microsoft calls this out explicitly: Foundry’s observability isn’t just “App Insights inside the portal”; it’s a platform for <strong>tracing, monitoring, and evaluating AI agents over their full lifecycle</strong>.</p><p>So the questions change from:</p><ul><li>“What’s my p95 latency?”<br> to also:</li><li>“Which tools did the agent call?”</li><li>“Why did this run go down a different branch?”</li><li>“How many tokens did we burn…and was it worth it?”</li></ul><h3>Microsoft Foundry</h3><p>Microsoft Foundry unifies models, tools, and agents under a single control plane, with built-in capabilities for <strong>tracing, monitoring, and evaluation</strong>. You build agents in the Foundry portal or via SDKs, orchestrate them with Workflows / Agent Service, and then observe them via the Foundry observability experience (plus export to Azure Monitor).</p><p>In other words:</p><p><strong><em>Foundry = AI app &amp; agent factory<br>Azure Monitor = your single pane of glass</em></strong></p><p>Your job as a .NET / Azure engineer is to wire them together cleanly.</p><h3>What we want to see</h3><p>Here’s the mental model for a “glass box” agent run:</p><ol><li>A request hits your <strong>.NET API</strong> (App Service / Container Apps / Functions).</li><li>That API calls a <strong>Foundry agent</strong> (hosted in the Foundry control plane).</li><li>The agent calls <strong>tools</strong> (search, internal APIs, MCP tools, etc.).</li><li>Everything emits <strong>OpenTelemetry traces and metrics</strong>, which land in:</li></ol><ul><li>Foundry’s built-in observability (for agent-centric views)</li><li><strong>Azure Monitor / Application Insights</strong> (for app-centric views)</li></ul><p>With Application Insights, you should be able to answer, for a single user request:</p><ul><li>Which agent was called?</li><li>Which tools did it invoke, in what order?</li><li>How long did each step take?</li><li>How many tokens were used?</li><li>Did any evaluation flags fire?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NUdRgRueTLBfOBzNPYooMw.png" /><figcaption>Observability for Microsoft Foundry Agents</figcaption></figure><h3>Step 1 — Let Foundry trace your agents <em>for you</em></h3><p>Microsoft’s “Agent Tracing” concepts explain that Foundry captures <strong>inputs, outputs, tool calls, retries, latencies, and costs for each agent run</strong>. You can visualize these traces in the portal and drill into multi-step workflows.</p><p>Recent updates add:</p><ul><li>Native support for <strong>multi-agent workflows</strong>, where you can see how agents call each other inside a Workflow.</li><li><strong>Agent Framework integrations</strong> — if you build agents using Microsoft Agent Framework or integrated frameworks (like LangChain), you can get tracing “for free” when configured with Foundry.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ph8mVq6vt6XZUeP_LIc7eA.png" /><figcaption>Microsoft Foundry — Monitor — Operational Metrics</figcaption></figure><p>This gives you <strong>agent-level transparency</strong>.</p><p>But you still need <strong>app-level</strong> observability (for your .NET services, gateways, and tools). That’s where OpenTelemetry and Azure Monitor come in.</p><h3>Step 2 — Instrument your .NET service with OpenTelemetry + Azure Monitor</h3><p>Microsoft has fully adopted OpenTelemetry (OTel) as the primary method for collecting traces/logs/metrics into Azure Monitor and Application Insights.</p><p>At a high level, for ASP.NET Core or minimal APIs, the pattern is:</p><ol><li><strong>Add the Azure Monitor OTel distro</strong> NuGet package.</li><li>Configure OpenTelemetry with UseAzureMonitor() in Program.cs.</li><li>Set the APPLICATIONINSIGHTS_CONNECTION_STRING.</li><li>Run the app and see traces/logs in Application Insights.</li></ol><h4>Minimal example</h4><p>Here’s a trimmed .NET 8 example</p><pre>using Azure.Monitor.OpenTelemetry.AspNetCore;<br>using OpenTelemetry.Trace;<br>using OpenTelemetry.Resources;<br><br>var builder = WebApplication.CreateBuilder(args);<br><br>// 1. Add OpenTelemetry + Azure Monitor<br>builder.Services.AddOpenTelemetry()<br>    .UseAzureMonitor() // sends logs, metrics &amp; traces to App Insights<br>    .WithTracing(tracerProviderBuilder =&gt;<br>    {<br>        tracerProviderBuilder<br>            .SetResourceBuilder(<br>                ResourceBuilder.CreateDefault()<br>                    .AddService(&quot;foundry-agent-api&quot;))<br>            .AddAspNetCoreInstrumentation()<br>            .AddHttpClientInstrumentation();<br>    });<br><br>// 2. Usual ASP.NET services<br>builder.Services.AddHttpClient();<br>builder.Services.AddControllers();<br><br>var app = builder.Build();<br>app.MapControllers();<br>app.Run();</pre><h4>Configuration:</h4><ul><li>Create an Application Insights resource in Azure.</li><li>Set APPLICATIONINSIGHTS_CONNECTION_STRING in your app settings or environment.</li></ul><p>Now every incoming request, outgoing HTTP call, and internal span gets traced.</p><h3>Step 3 — Add AI-specific attributes to your traces</h3><p>Classic tracing will tell you, <em>“This request took 900ms</em>.” For AI workloads, you want to know:</p><ul><li>Which <strong>model</strong> was used?</li><li>How many <strong>tokens</strong> did we spend?</li><li>Was this a “cheap routing” call or an “expensive deep reasoning” call?</li></ul><p>The AI in Production guide from Microsoft specifically calls out tracking <strong>latency, token usage, prompt patterns, and failure modes</strong> as key telemetry for generative apps.</p><p>You can capture this with custom OTel attributes.</p><p>Assuming you have a helper that calls a Foundry agent/model via the OpenAI client, you can wrap it with an activity:</p><pre>using System.Diagnostics;<br>using OpenAI;<br>using OpenAI.Chat;<br><br>public class FoundryAgentClient<br>{<br>    private static readonly ActivitySource ActivitySource =<br>        new(&quot;Foundry.Agent&quot;);<br><br>    private readonly OpenAIClient _client;<br><br>    public FoundryAgentClient(OpenAIClient client)<br>    {<br>        _client = client;<br>    }<br><br>    public async Task&lt;string&gt; RunAsync(string deployment, string userPrompt)<br>    {<br>        using var activity = ActivitySource.StartActivity(&quot;foundry.agent.call&quot;);<br>        activity?.SetTag(&quot;ai.system&quot;, &quot;microsoft-foundry&quot;);<br>        activity?.SetTag(&quot;ai.deployment&quot;, deployment);<br>        activity?.SetTag(&quot;ai.operation&quot;, &quot;chat-completion&quot;);<br><br>        var chat = _client.GetChatClient(deployment);<br><br>        var response = await chat.CompleteChatAsync(<br>            new[]<br>            {<br>                new SystemChatMessage(&quot;You are a concise internal assistant.&quot;),<br>                new UserChatMessage(userPrompt)<br>            });<br><br>        // Attach usage data if available<br>        var usage = response.Usage;<br>        if (usage is not null)<br>        {<br>            activity?.SetTag(&quot;ai.tokens.input&quot;, usage.InputTokenCount);<br>            activity?.SetTag(&quot;ai.tokens.output&quot;, usage.OutputTokenCount);<br>            activity?.SetTag(&quot;ai.tokens.total&quot;, usage.TotalTokenCount);<br>        }<br><br>        return response.Content[0].Text;<br>    }<br>}</pre><p>Because you’ve hooked OpenTelemetry to Azure Monitor, these tags show up in <strong>App Insights</strong> and allow you to:</p><ul><li>Plot tokens per endpoint</li><li>Spot requests that always trigger heavy usage</li><li>Correlate token spikes with performance issues</li></ul><p>This is the glue that joins app telemetry with Foundry’s agent-side traces.</p><h3>Step 4 — Connecting Foundry’s view with Azure Monitor’s view</h3><p>At this point, you have two complementary lenses:</p><ol><li><strong>Agent-centric view (Foundry observability)</strong></li></ol><ul><li>See a single agent run: prompts, tool calls, responses, latencies, costs.</li><li>Useful for debugging prompt logic, tools, and workflow branching.</li></ul><p><strong>2. App-centric view (Azure Monitor / App Insights)</strong></p><ul><li>See all web/API requests, dependencies, token usage, and failures over time.</li><li>Useful for SLOs, p95 latency, error budgets, and capacity planning.</li></ul><p>Microsoft’s guidance for Foundry emphasizes this combination: <strong>agent-level traces &amp; evaluations in Foundry, along with platform-level telemetry via Azure Monitor</strong>, often utilizing OpenTelemetry as the common language.</p><h3>Step 5 — Evaluations: Is the agent actually good?</h3><p>Observability isn’t just “the system is up and responsive” — for generative AI, it’s also “the <strong>answers</strong> are safe and useful”.</p><p>Foundry’s “Observability in Generative AI” concepts and the AI Evaluation tooling focus on:</p><ul><li>Collecting test sets or production samples</li><li>Running <strong>automatic evaluators</strong> (quality, safety, groundedness, etc.)</li><li>Viewing evaluation results and trends in the portal</li></ul><p>Find the other articles related to the Microsoft Foundry:</p><ol><li><strong>What changed?</strong> (rename + platform)</li></ol><p><a href="https://medium.com/microsoft-azure-in-practice/azure-ai-foundry-is-now-microsoft-foundry-what-changed-and-why-it-matters-c65756317bd8">https://medium.com/microsoft-azure-in-practice/azure-ai-foundry-is-now-microsoft-foundry-what-changed-and-why-it-matters-c65756317bd8</a></p><p><strong>2. How to build agents?</strong> (multi-tool, .NET)</p><p><a href="https://medium.com/microsoft-azure-in-practice/extending-the-multi-tool-azure-ai-agent-now-with-image-audio-video-generation-in-net-7640a8629fcf">Extending the Multi-Tool Azure AI Agent — Now with Image, Audio, &amp; Video Generation in .NET</a></p><p><a href="https://medium.com/microsoft-azure-in-practice/build-a-multi-tool-azure-ai-agent-in-net-with-real-time-rest-api-b2dca9bfc896">https://medium.com/microsoft-azure-in-practice/build-a-multi-tool-azure-ai-agent-in-net-with-real-time-rest-api-b2dca9bfc896</a></p><p><a href="https://medium.com/microsoft-azure-in-practice/from-charts-to-insights-n8n-azure-ai-stock-analysis-bot-on-telegram-356e48847c50">https://medium.com/microsoft-azure-in-practice/from-charts-to-insights-n8n-azure-ai-stock-analysis-bot-on-telegram-356e48847c50</a></p><p><strong>3. How to choose models?</strong></p><ul><li><a href="https://medium.com/microsoft-azure-in-practice/choosing-the-right-ai-model-in-microsoft-foundry-bc9098450940">https://medium.com/microsoft-azure-in-practice/choosing-the-right-ai-model-in-microsoft-foundry-bc9098450940</a></li></ul><p><strong>4. How to reduce costs?</strong></p><p><a href="https://medium.com/microsoft-azure-in-practice/how-to-cut-azure-ai-costs-by-70-while-scaling-gpt-5-91e5627d0574">https://medium.com/microsoft-azure-in-practice/how-to-cut-azure-ai-costs-by-70-while-scaling-gpt-5-91e5627d0574</a></p><p><strong>5. How to <em>trust</em> and <em>debug</em> them?</strong> (this post)</p><p>References:</p><ol><li><a href="https://learn.microsoft.com/en-us/azure/ai-foundry/observability/how-to/trace-agent-framework?view=foundry">https://learn.microsoft.com/en-us/azure/ai-foundry/observability/how-to/trace-agent-framework?view=foundry</a></li><li><a href="https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-enable?tabs=aspnetcore">https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-enable?tabs=aspnetcore</a></li><li><a href="https://learn.microsoft.com/en-us/azure/ai-foundry/observability/concepts/trace-agent-concept?view=foundry">https://learn.microsoft.com/en-us/azure/ai-foundry/observability/concepts/trace-agent-concept?view=foundry</a></li><li><a href="https://learn.microsoft.com/en-us/azure/ai-foundry/concepts/observability?view=foundry-classic">https://learn.microsoft.com/en-us/azure/ai-foundry/concepts/observability?view=foundry-classic</a></li><li><a href="https://learn.microsoft.com/en-us/azure/ai-foundry/observability/concepts/trace-agent-concept?view=foundry">https://learn.microsoft.com/en-us/azure/ai-foundry/observability/concepts/trace-agent-concept?view=foundry</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1940262fc6c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/microsoft-azure-in-practice/observability-for-microsoft-foundry-agents-with-azure-monitor-opentelemetry-net-first-f1940262fc6c">Observability for Microsoft Foundry Agents with Azure Monitor &amp; OpenTelemetry (.NET First)</a> was originally published in <a href="https://medium.com/microsoft-azure-in-practice">Microsoft Azure in Practice</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>