Book a free call

AI Agents on Azure: How to Build and Run Them

Azure gives you a managed agent service, a no-code builder and the search and code tools an agent needs, so you can start small and grow into production.

Hertiv engineering teamReviewed by a senior engineer
6 min read
AI Agents on Azure: How to Build and Run Them
On this page

Short answer

AI agent development on Azure means building software agents with Microsoft's cloud platform, mainly through the Azure AI Foundry Agent Service and Microsoft Copilot Studio. The platform supplies the model, the tools, the identity and the monitoring, so a team can focus on what the agent should do rather than on running servers.

What does building an AI agent on Azure mean?

Building an AI agent on Azure means creating a software agent that runs on Microsoft's cloud and uses Azure services for its model, its tools and its data. The agent takes a request, plans the steps, calls tools such as search or code execution, and returns an answer or completes a task.

The main route is the Azure AI Foundry Agent Service, a managed service that designs, deploys and scales agents. A team writes instructions, picks a model from the Foundry catalogue, and adds tools. The service handles the running, the conversation history and the scaling.

For teams that prefer no code, Microsoft Copilot Studio builds agents with a visual builder and ships them into Microsoft 365 apps such as Teams. Both routes sit on the same Azure platform, so a team can start no-code and move to code later without changing cloud.

Which Azure services build agents?

Azure offers several services that fit different parts of an agent build. Most projects use two or three of them together, not the whole list.

ServiceWhat it doesBest for
Foundry Agent ServiceManaged agent runtimeProduction agents in code
Copilot StudioNo-code agent builderBusiness teams and quick pilots
Azure OpenAIModels such as GPT-4oThe agent's reasoning
Azure AI SearchSearch over your documentsGrounding answers in your data
Azure FunctionsSmall pieces of codeCustom tools the agent calls
Logic AppsWorkflows across systemsConnecting to business apps

Identity comes from Microsoft Entra ID, which gives each agent its own identity so a team can see exactly what the agent can reach. Monitoring comes from Azure Monitor and Application Insights, which show what the agent did and what it cost.

Prompt agents or hosted agents?

Foundry offers two ways to run an agent, and the choice shapes how much code a team writes. A prompt agent is fully managed: the team writes instructions, picks a model and adds tools in the portal, and the service runs it. There is no code to deploy and no runtime to manage.

A hosted agent is the team's own code, packaged and run on Azure. The team writes the agent loop, picks a framework such as the Microsoft Agent Framework, LangGraph or the OpenAI Agents SDK, and controls every step. That control suits complex cases, such as multi-agent workflows or custom approval steps.

Start with a prompt agent. It is faster to build and cheaper to test, and it shows whether the agent idea works before a team invests in custom code. Move to a hosted agent only when the prompt agent cannot do what the job needs.

What tools can the agent use?

An agent on Azure can call built-in tools and custom tools. The built-in set covers the jobs most agents need first, and custom tools cover the rest.

Code Interpreter lets the agent write and run Python in a sandbox, which suits analysis and file work. File Search gives the agent managed retrieval over documents, so it can answer from a team's own files. Function Calling lets the agent call a team's own code, such as an Azure Function that checks an order status or updates a record.

Connectors reach more than a thousand enterprise sources, including SharePoint, Microsoft Fabric and third-party systems, so the agent can read the data a team already keeps. Agents can also call each other as tools, which lets a team split a hard job across specialist agents.

How do you keep an agent safe on Azure?

Safety starts with identity. Microsoft Entra Agent ID gives each agent a first-class identity, so a team can see what the agent can access and revoke that access when it is no longer needed. The agent should only reach the data and systems its job requires.

Content filters screen prompts and answers for harmful content, and private networking keeps traffic inside the team's own network where the data is sensitive. Every run is logged, so a team can trace what the agent did, which tools it called, and what it cost.

Set a clear rule for when the agent must stop and ask a person. Reading data and drafting answers are safe to automate. Sending a payment, changing a record or contacting a customer is not, and those steps should need a human approval before they run.

Example (hypothetical): a support agent pilot

Example (hypothetical): a support team of six people handles 200 tickets a week. Each ticket takes about 12 minutes to resolve by hand, which is 200 times 12 minutes, or 40 hours a week across the team.

The team builds a prompt agent on Azure that drafts answers for the 120 straightforward tickets, using File Search over the help centre. A person checks each draft in about 3 minutes, which is 120 times 3 minutes, or 6 hours. The remaining 80 harder tickets still take 12 minutes each, or 16 hours.

The new total is 6 hours of checking plus 16 hours of full handling, or 22 hours a week, against 40 hours before. The team saves about 18 hours a week, and every answer still passes a person before it reaches a customer.

How to start in five steps

Start with one agent, one job, and a small group of users, then grow from what you learn.

  1. Create a Foundry project. Set up a project in the Azure portal and pick a model from the catalogue.
  2. Write the instructions. Describe the agent's job, its limits, and what it must never do, in plain words.
  3. Add one tool. Start with File Search over a small set of documents the agent needs.
  4. Test in the playground. Try the agent on real questions from the team and fix the instructions where it goes wrong.
  5. Ship to a small group. Release it to a few users, watch the logs, and expand only when the answers are good.

Keep the agent's scope written down and visible, so everyone knows what it can do and what it cannot.

What are the common mistakes?

The first mistake is giving the agent too many tools at once. Each tool is a new way for the agent to go wrong, and a team cannot tell which one caused a bad answer. Add one tool, test it, and only then add the next.

The second mistake is skipping the grounding data. An agent with no access to a team's own documents will guess, and its guesses will sound confident. Connect File Search or Azure AI Search before the agent meets real users.

The third mistake is shipping without a human check. An agent that sends answers straight to customers will eventually send a wrong one. Keep a person in the loop for the first weeks, and only remove the check when the logs show the agent is steady.

Key takeaways

  • Azure AI Foundry Agent Service is the main managed route; Copilot Studio is the no-code route
  • Start with a prompt agent and move to a hosted agent only when you need the control
  • Ground the agent in your own documents with File Search or Azure AI Search
  • Give each agent its own Entra identity and keep a human check on risky actions
  • Add one tool at a time and test before adding the next

Frequently asked questions

Do I need to write code to build an agent on Azure?

No, not to start. Copilot Studio builds agents with a visual builder, and the Foundry portal builds prompt agents without code. Code is needed only for hosted agents or custom tools, such as an Azure Function the agent calls.

What is the difference between Copilot Studio and Foundry Agent Service?

Copilot Studio is a no-code builder aimed at business teams, and its agents ship into Microsoft 365 apps such as Teams. Foundry Agent Service is a managed runtime for agents built in code, aimed at developers and production workloads.

Which model should the agent use?

Pick the smallest model that answers well on your test questions, and only move to a larger one when the answers are not good enough. The Foundry catalogue lists the models available, and the playground lets you compare them on the same questions.

How does the agent find my company's data?

Through File Search, Azure AI Search, or connectors to sources such as SharePoint and Microsoft Fabric. The agent searches those sources at run time and uses what it finds to shape its answer, rather than relying only on what the model already knows.

Can agents on Azure work with other clouds?

Yes, in part. Foundry agents can call tools and services outside Azure, and multi-agent workflows can include agents running elsewhere. Data and identity still need care, so check where the data lives before connecting an outside system.

What does it cost?

Pricing depends on the model, the tokens used, the tools called and the runtime chosen, so there is no single figure. Run a small pilot in the playground and read the usage in Azure Cost Management before committing to a budget.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: AI and agent systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Building an agent on Azure? Talk to Hertiv about a pilot that starts small.

A senior engineer replies within one business day. Or see our AI Agent Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to contact@hertiv.com.

Prefer email? Write to contact@hertiv.com
Estimate costBook a call