Sr. Content Developer at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
155016 stories
·
33 followers

GitHub Action for Deploying Hosted Agents

1 Share

Introduction

 

With Microsoft's introduction to Hosted Agents comes a next logical question. How to implement this? Organizations need a method that is quick, repeatable, and requires minimal adjustments to their existing tooling and processes. Thus, we will walk through how to deploy a Hosted Agent through a repeatable GitHub Action.

 

If this is new to you this blog is a follow up to Deploying Foundry Hosted Agents via REST API | Microsoft Community Hub.

Before You Start

This action assumes the following are already in place in the workflow that calls it:

 

  • An existing Microsoft Foundry project with a deployed model.
  • A container image already pushed to Azure Container Registry (ACR).
  • An identity with the **Foundry User** role on the Foundry project. See [hosted agent permissions](https://learn.microsoft.com/en-us/azure/foundry/agents/concepts/hosted-agent-permissions) for the full permissions reference.
  • A runner with `az`, `jq`, and `python3` installed. This is true on `ubuntu-latest`; if you self-host, install them explicitly.
  • azure/login configured in the caller workflow **before** this action runs. 

 

⚠️ *Identity prerequisite This action assumes `azure/login` has already run in the caller workflow and that the resulting identity holds a Foundry data-plane role (e.g., Foundry User). Without that, `az account get-access-token` will fail before the REST call is made.

Requirements

Grounding ourselves in our requirements to implement the deployment processes, in the quickest way that leverages minimal adjustments and a repeatable process, we will leverage GitHub Action and Bash. The Bash script will take a series of arguments that will be used to call the REST API.

 

The action requires four inputs: `project_endpoint`, `agent_name`, `image`, and `model_deployment_name`. The example pipeline wires these from the outputs of a preceding IaC step, but the action itself takes plain strings. These strings can come from any tool that can hand them off as workflow inputs. This keeps it flexible and limits adjustments to existing CI/CD processes.

 

If interested, one can use the Azure Developer CLI (`azd up`) command which is documented via Microsoft official examples and MS Learn. This blog chose not to cover this as the majority of enterprise customers already have tooling they are leveraging other than `azd`.

 

Also, one could use the `azure.ai.projects` library to create an agent. This blog made the decision not to go down this route as not all organizations have adopted the philosophy of allowing application code to create underlying compute infrastructure. Additionally, some organizations desire teams outside of developers to control and set the size of the Micro VM (referred to as the "sandbox" in the Foundry docs) that the Hosted Agent is running on.

 

If your organization does not use GitHub Actions this step should be duplicatable in Azure DevOps leveraging the Bash task.

Deployment Steps

For us to do this appropriately let's take a step back and evaluate a CI/CD workflow for an Agent whose definition is stored in a container.

 

Ideally a pipeline should follow steps outlined in CI/CD for AI Agents on Microsoft Foundry. Those pipelines typically take the shape build/push → IaC → update agent → smoke test. For our purposes, since we are hyper-focusing on the Hosted Agent Deployment via REST API we are going to focus on the repeatable GitHub Action of deploying the agent. To emphasize this our workflow will focus on the step called "Update agent — Foundry data plane POST `agents/NAME/versions`".

Based on organization preference, I can understand the need to break out the update agent step into a separate workflow. We traditionally don't recommend this as keeping everything in one pipeline means one set of failures to triage, one history to read, and one CI/CD surface to keep current. but This action though is structured to support a split if your release process requires it.

Hosted Agent REST Deployment Action

This is the crux of why the article exists. If you've followed my style of repeatable DevOps process for YAML Pipelines, this action follows similar principles. We will parametrize with defaults to empower minimal configuration while also optimizing for flexibility. To view the full example check out the Update Foundry Agent action .

 

The Inputs, Outputs, and `runs:` blocks shown below all live in a single file: `.github/actions/update-agent/action.yml`.

Inputs

Here are those parameters with descriptions and defaults:

inputs: project_endpoint: description: Foundry project endpoint URL required: true agent_name: description: Name of the hosted agent required: true image: description: Full container image reference (registry/name:tag) required: true model_deployment_name: description: Name of the AI model deployment required: true cpu: description: CPU allocation for the agent container required: false default: '0.25' memory: description: Memory allocation for the agent container required: false default: '0.5Gi'

Verify the latest sandbox sizes at hosted-agents#sandbox-sizes There is also guidance on right-sizing your Micro VMs. At the time of this writing here are the available combinations:

Outputs

We should output values that make sense for subsequent steps in the workflow. Every instance that calls this action may not use them, but it's always good to expose non-secret values just in case.

 

In our case we are creating a new version of the agent, so let's output that agent version:

outputs: agent_version: description: Version ID returned by the Foundry data plane value: ${{ steps.post.outputs.agent_version }}

`agent_version` is the version identifier returned by the data plane. Capture this in your pipeline (artifact, release tag, etc.) so you have an audit trail and a target to re-deploy against if a future version needs to be rolled back. Subsequent steps in the workflow can reference it via `${{ steps.<step-id>.outputs.agent_version }}`.

Action

The action will need to map our environment variables being passed into the input as the first step. After that we will need to get an access token from Azure so we can then call the REST API endpoint.

 

Once we have this, we will need to prepare the body of our call. Verify against the API for all valid properties. For our example I chose not to set `rai_config` (Responsible AI overview) and `tools` (function/tool bindings) to keep things simple.

runs: using: composite steps: - name: Post agent version to Foundry data plane id: post shell: bash env: PROJECT_ENDPOINT: ${{ inputs.project_endpoint }} AGENT_NAME: ${{ inputs.agent_name }} IMAGE: ${{ inputs.image }} MODEL_DEPLOYMENT_NAME: ${{ inputs.model_deployment_name }} CPU: ${{ inputs.cpu }} MEMORY: ${{ inputs.memory }} run: | FOUNDRY_TOKEN=$(az account get-access-token \ --resource "https://ai.azure.com/" \ --query accessToken -o tsv) AGENT_REQUEST_BODY=$(jq -n \ --arg cpu "$CPU" \ --arg memory "$MEMORY" \ --arg model "$MODEL_DEPLOYMENT_NAME" \ --arg image "$IMAGE" \ '{ definition: { kind: "hosted", container_protocol_versions: [{protocol: "responses", version: "1.0.0"}], cpu: $cpu, memory: $memory, environment_variables: {AZURE_AI_MODEL_DEPLOYMENT_NAME: $model}, image: $image

 

⚠️ **Heads up on logs.** The line that echoes `HTTP ${HTTP_STATUS}: $(cat /tmp/agent_response.json)` dumps the full response body to the job log. If your request body contains sensitive `environment_variables`, the API may return them in the response, where they will appear in plain text in the workflow log. Either scrub the response before echoing, or echo only the `version` field on success.

 

A 2xx response confirms the data plane accepted the new agent version. Confirming the agent behaves as intended is a separate step. This is done typically with a smoke test against the deployed agent in a later workflow job.

 

If something goes wrong the most common failures are:

  • 401/403- `azure/login` didn't run, the identity is missing a Foundry data-plane role, or the wrong subscription is selected. Check the `azure/login` step and confirm the identity holds **Foundry User** (or higher) on the Foundry project (see the *Before You Start* callout above).
  • 404 - wrong `project_endpoint`, or the agent named in `agent_name` does not yet exist on the project. The agent must exist before posting a new version.
  • 400 - body or model issue: invalid `cpu` / `memory` shape, a required field missing, or `model_deployment_name` pointing at a deployment that isn't reachable from this project.

Calling the Action

So now that we have the action, how can we scale this across multiple workflows? Simple, we just need to pass in the required parameters. Here is an example, with a stubbed `deploy-iac` step so can the outputs passed into the action as inputs:

- name: Deploy Bicep infrastructure id: deploy-iac uses: ./.github/actions/deploy-bicep with: environment_name: ${{ inputs.environment_name || 'main' }} location: ${{ inputs.location || 'swedencentral' }} - name: Update agent uses: ./.github/actions/update-agent with: project_endpoint: ${{ steps.deploy-iac.outputs.project_endpoint }} agent_name: ${{ inputs.agent_name }} image: ${{ steps.deploy-iac.outputs.acr_endpoint }}/${{ inputs.image_name }}:${{ inputs.image_tag }} model_deployment_name: ${{ steps.deploy-iac.outputs.model_deployment_name }}

 

And just to show we can call the same action multiple times here are two examples that do just that: Deploy (Bicep) and Deploy (Terraform).

Conclusion

The composite action shown above gives organizations what the introduction called for: a quick, repeatable way to deploy a Hosted Agent that requires minimal adjustments to the GitHub Actions tooling and processes already in use. With it wired into a workflow, deploying a new Hosted Agent version becomes a standard step in your pipeline.

Read the whole story
alvinashcraft
28 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

Deploying Foundry Hosted Agents via REST API

1 Share

Introduction 

At Microsoft Build `26 it was announced that Microsoft Foundry Hosted will soon be generally available. This blog post will outline the deployment process and requirements for creating hosted agents in Foundry. The audience for this blog is designed to range from beginner to more advanced users. We will focus on deploying a Hosted Agent from a local machine using the REST API backed by the Responses protocol. 

 

The key thing to understand upfront: deploying a Hosted Agent is ultimately a data plane operation against the Foundry Service API, not an infrastructure deployment. However, it depends on carefully orchestrated infrastructure, identity, and access configuration being in place first. This post walks through each layer. 

 

The companion repository for this post is available at github.com/JFolberth/simple-hosted-agent-responses and contains the full Infrastructure as Code (IaC) templates, deployment scripts, and agent source code referenced throughout. 

Background 

There's a school of thought that to fully understand and control something you must properly name it. Given this context let's level set on terminology on both what an Agent is and specifically when and how an Agent is defined inside Microsoft Foundry. 

 

For our Definition of an Agent we will leverage the definitions provided and backed by Microsoft Agent Framework. At a process level an Agent can be defined as: 

 

For those that want to go another level this can translate into: 

 

 

 

 

Notice anything missing from these documents? There is no mention of where the Agent is hosted in terms of compute. This is open ended by design as Microsoft believes in providing the flexibility to leverage any part of the agentic technology stack for agent hosting. 

 

We can bring our own compute such as Azure Function, Azure Container App (ACA), App Service, Hosted Virtual Machine, AWS Lambda, etc., to make a call to the Foundry. This is an agentic architecture but is not the same as a Foundry Hosted Agent. This is the key architectural element that is important to understand what makes Foundry Hosted Agents different. 

 

As of this writing there are only three types of Foundry Agents: Prompt, Workflow (preview), and Hosted: 

 

 

We are going to focus on this last type, Hosted Agents. The compute for Hosted Agents is managed entirely by Foundry through per-session Micro VMs, lightweight, isolated compute units that scale to zero when idle and resume automatically on the next request. 

 

 When building agentic applications with open-source frameworks you typically manage many cross-cutting concerns: containerization, web server setup, security, memory persistence, scaling, instrumentation, and version rollbacks. Hosted Agents solve these by letting you bring your own code and framework while the platform handles everything else.  

 

Choose a Hosted Agent over a prompt-based agent when you need to use any framework (Agent Framework, LangGraph, Semantic Kernel), control compute resources like CPU and memory, run stateful workloads that persist files across turns, or use custom protocols for webhook receivers and non-conversational processing.  

 

Each deployed agent automatically receives its own dedicated Microsoft Entra ID and endpoint with no manual identity configuration required. For the full comparison see What are hosted agents? 

 

For us to fully understand the deployment process we first need to understand the required infrastructure, access, and tooling to deploy a Hosted Agent.  

Requirements 

A Hosted Agent can be deployed via either REST API calls or through the azd CLI. We are going to focus on the REST API process. 

To deploy a Hosted Agent via REST API calls the following software needs to be available: 

  • python (not needed but preferred in our walkthrough) 

 

The following infrastructure and sub resources are required to deploy Hosted Agents:  

  • Log Analytics (optional) (Microsoft.OperationalInsights/workspaces) 

 

From an access perspective the following roles will need to be assigned/assignable: 

  • Foundry User (Data plane access is needed to create a new agent) 
  • AcrPull (Foundry Project needs to pull the container from ACR) 
  • AcrPush (To deploy the image to ACR) 

 

To elaborate further the Managed Identity of the Foundry Project will need to have: AcrPull, Log Analytics Reader, Foundry User. Ideally this access provisioning would be contained within your Infrastructure as Code (IaC) processes. 

 

The other access would be required for the user or service principal handling the deployment. These roles would be: Contributor, Foundry Project Manager, Foundry User, AcrPush. In production environments, outside the Contributor role, these roles should be provisioned after the infrastructure has been deployed. Justification being they are one time assignments and it is not a best practice to define the service principal access as part of your template. Luckily, we have a script that will handle all of this for you. 

High Level Steps 

First, the infrastructure will need to be deployed, either directly in the portal or ideally through an IaC template. After successful completion we will need to grab the Managed Identity of the Foundry Project, Azure Container Registry endpoint, Model(s) deployed, and Foundry Project endpoint. We will need this information for deploying our agent and granting the executing user the ability to view the Agent in Foundry. 

 

After the IaC deployment we will grant the user Foundry Project Manager. We chose the Foundry Project Manager role here as not only will it give permission to deploy an agent it will also give the deploying user access to the Foundry Portal to view the agent. If viewing the agent is not a requirement then Foundry User should suffice. 

 

Since the IaC deploys our ACR we will need to build and push our container image. At the time of this writing the image must be built with --platform linux/amd64 as the Foundry Micro VM runtime only supports amd64 architecture. See the hosted agent container requirements for details. 

 

docker build --platform linux/amd64 -t <acr-login-server>/<image-name>:<tag> . az acr login --name <acr-name> docker push <acr-login-server>/<image-name>:<tag>

 

For the Foundry Micro VM runtime to pull your container image at agent startup, a connection must exist between your Foundry Project and the Azure Container Registry. This is configured as a project-scoped connection of category ContainerRegistry that references the ACR login server and uses the project's Managed Identity for authentication (no stored credentials).  

 

The IaC templates in the companion repo handle this automatically, but if provisioning manually you will need to create this connection via the Foundry project connections API or through the Foundry Portal. For more details see Connections in Microsoft Foundry and Configure container registry connections. 

 

The last step is the most important, deploying the agent. At the end of the day a Hosted Agent is actually not an infrastructure change, rather a data plane operation against the Foundry Service API. We pass in the kind as hosted, specify the container image, and provide the CPU and memory allocation for our Micro VMs. 

 

curl -X POST \ "<project-endpoint>/agents/<agent-name>/versions?api-version=2025-11-15-preview" \ -H "Authorization: Bearer $(az account get-access-token --resource https://ai.azure.com --query accessToken -o tsv)" \ -H "Content-Type: application/json" \ -d '{ "kind": "hosted", "configuration": { "container": { "image": "<acr-login-server>/<image-name>:<tag>" }, "resources": { "cpu": "0.25", "memory": "0.5Gi" }, "protocolVersion": "1.0.0", "environmentVariables": { "AZURE_AI_MODEL_DEPLOYMENT_NAME": "<model-deployment-name>" } }, "metadata": { "enableVnextExperience": "true" } }'

Conclusion 

As we covered, deploying a Hosted Agent comes down to a single REST API call, but getting to that point requires the right infrastructure, roles, and container image in place. 

 

Infrastructure first: Your Foundry project, ACR, and model deployments must exist before agent creation. Role assignments, particularly Foundry User for the project managed identity and AcrPull for image access, must be in place before proceeding. 

 

The REST call is the agent: Unlike traditional container deployments where you manage compute directly, the POST to the Foundry data plane is what brings your agent to life. You specify the container image, CPU/memory allocation, and protocol version. Foundry handles the rest, provisioning per-session Micro VMs that scale to zero when idle. 

 

You own only the agent logic: The platform manages the runtime, session isolation, identity, and scaling. This is the fundamental shift from self-hosted patterns. Less operational overhead in exchange for letting Foundry control the compute layer. 

 

To see a complete, working implementation including Bicep and Terraform IaC templates, deployment scripts with proper RBAC handling, and a Python agent using the Responses protocol, visit the companion repository at github.com/JFolberth/simple-hosted-agent-responses. The repo includes a dev container with all prerequisites pre-installed, making it possible to go from clone to deployed agent in a single azd up command. 

Read the whole story
alvinashcraft
28 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

What's new in Windows Subsystem for Linux | DEM346

1 Share
From: Microsoft Developer
Duration: 23:15
Views: 481

Learn about the new core end to end improvements to Windows Subsystem for Linux and the new Container CLI and Apis for your applications

Seating for this session is first-come, first-served. Add it to your schedule to plan your day and arrive early to secure a spot.

To learn more, please check out these resources:
* https://aka.ms/build26/DEM346

𝗦𝗽𝗲𝗮𝗸𝗲𝗿𝘀:
* Craig Loewen
* Pooja Trivedi

𝗦𝗲𝘀𝘀𝗶𝗼𝗻 𝗜𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
This is one of many sessions from the Microsoft Build 2026 event. View even more sessions on-demand and learn about Microsoft Build at https://build.microsoft.com

DEM346 | English (US) | Windows

Demo | (400) Expert

#MSBuild

Chapters:
0:00 - Three key takeaways: local Linux containers, built into WSL, enterprise-ready
00:01:33 - WSL update provides full WSL Containers without extra installs
00:03:54 - Simple container workflow demonstration complete
00:09:07 - Transition Back to Slides: Summary of WSL Containers Interaction
00:11:56 - Introduction to Moonray rendering engine collaboration
00:14:02 - Explanation of transparent VM and API-based container management
00:17:26 - Overview of WSL containers architecture: Windows host and VM components
00:19:42 - Details on storage separation using VHD per application
00:23:02 - Closing remarks: public preview announcement and feedback invitation

Read the whole story
alvinashcraft
28 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

So you want to become an MVP? | DEM375

1 Share
From: Microsoft Developer
Duration: 25:51
Views: 14

Passionate about sharing knowledge and making an impact in tech? Learn what it takes to become a Microsoft MVP from those who’ve done it and hear directly from MVP Program staff. Discover how to expand your influence, showcase your expertise, and practical tips for getting nominated. Walk away with a roadmap for growing your contributions and positioning yourself for MVP success.

Seating for this session is first-come, first-served. Add it to your schedule to plan your day and arrive early to secure a spot.

To learn more, please check out these resources:
* https://aka.ms/build26-next-steps

𝗦𝗽𝗲𝗮𝗸𝗲𝗿𝘀:
* Betsy Weber
* Fernanda Herger
* Jeremy Sinclair
* Stephen Simon
* Christine Flora

𝗦𝗲𝘀𝘀𝗶𝗼𝗻 𝗜𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
This is one of many sessions from the Microsoft Build 2026 event. View even more sessions on-demand and learn about Microsoft Build at https://build.microsoft.com

DEM375 | English (US)

Demo | (100) Foundational

#MSBuild

Chapters:
0:00 - Introduction by Betsy Weber and welcome
00:00:41 - Overview of the Microsoft MVP Program
00:03:45 - Defining Leadership and Community Building
00:04:03 - Starting and Growing a Tech Community
00:07:22 - Benefits of being an MVP including NDA access and insider information
00:07:37 - MVPs provide feedback to Microsoft product groups
00:08:35 - Transition to live MVP introductions and technical setup
00:13:09 - Introduction to Audience Questions Segment
00:20:17 - Balancing Work, Life, and Community Engagement as an MVP

Read the whole story
alvinashcraft
29 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

Building Agents You Can Trust on Windows | BRK262

1 Share
From: Microsoft Developer
Duration: 28:41
Views: 16

Agents now run real commands, modify files, and move data. This breakout highlights the full set of Windows primitives that help agents discover, reason about, and execute AI‑powered activities across the system, while still operating within clear boundaries. Through live demos, you’ll see how agents identify available capabilities, plan and take meaningful actions, and how Windows layers permission scoping, inspection, developer tool capabilities, and rollback to keep developers in control.

Seating for this session is first-come, first-served. Add it to your schedule to plan your day and arrive early to secure a spot.

To learn more, please check out these resources:
* https://aka.ms/build26-next-steps

𝗦𝗽𝗲𝗮𝗸𝗲𝗿𝘀:
* Kirupa Chinnathambi
* Stuart Schaefer
* Patrick Nikoletich

𝗦𝗲𝘀𝘀𝗶𝗼𝗻 𝗜𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
This is one of many sessions from the Microsoft Build 2026 event. View even more sessions on-demand and learn about Microsoft Build at https://build.microsoft.com

BRK262 | English (US) | Windows

Breakout | (300) Advanced

#MSBuild

Chapters:
0:00 - Introduction and Session Overview
00:01:03 - Current Problems with AI Agents and Risks of Autonomy
00:03:04 - GitHub Copilot Insights and Permission Mismatch Issues
00:05:00 - Windows Role in Making Agents Safe by Design
00:06:03 - Agent Identity Concept and Demonstration
00:09:07 - Containment Principle and Microsoft Execution Containers (MXC) Introduction
00:14:14 - MXC Demonstration: Sandbox Configuration and Malicious Agent Test
00:19:03 - Agent Manageability and Continuous Supervision
00:21:00 - GitHub Copilot Sandboxing Integration and CLI Demos
00:26:12 - Summary: Identity, Containment, Manageability and Windows Ecosystem Integration

Read the whole story
alvinashcraft
29 minutes ago
reply
Pennsylvania, USA
Share this story
Delete

Data API Builder and SQL MCP with Jerry Nixon

1 Share

How do you intelligently surface access to your database? While at NDC Toronto, Richard spoke with Jerry Nixon about Data API Builder, Microsoft's tool that enables data professionals using Microsoft databases, including SQL Server, Postgres, CosmosDB, and MySQL, to provide an API layer with security, schema extraction, and governance policies. You can expose the API as a REST interface, a GraphQL interface, and an MCP server! This is a powerful tool for providing controlled access to data while still allowing for ad-hoc access. The potential is huge - you need to check it out!

Links

Recorded May 7, 2026





Download audio: https://cdn.simplecast.com/media/audio/transcoded/5379899c-61c5-43c3-aa3f-1128cffd9ef4/c2165e35-09c6-4ae8-b29e-2d26dad5aece/episodes/audio/group/75ee229f-4e41-4c34-8c5f-26f05aaf1316/group-item/7c54f2bb-59c2-4aec-812a-776ce9c074f1/128_default_tc.mp3?aid=rss_feed&feed=cRTTfxcT
Read the whole story
alvinashcraft
29 minutes ago
reply
Pennsylvania, USA
Share this story
Delete
Next Page of Stories