What Is Microsoft-hosted agent in DevOps?
On This Page
Quick Definition
A Microsoft-hosted agent is a pre-configured virtual machine that Microsoft provides for you to run automated tasks like building software or running tests. You don't need to set up or maintain these machines yourself. They are ready to use and include common tools for many programming languages and platforms. This lets you focus on your code instead of managing servers.
Commonly Confused With
A self-hosted agent is a virtual machine or physical server that you set up and manage yourself. Unlike Microsoft-hosted agents, you have full control over the operating system, installed software, network access, and hardware resources. You must also handle patching, security, and scaling.
If you need a build server that stays on 24/7 and has custom database software installed, you would set up a self-hosted agent. A Microsoft-hosted agent would reset every time and lose the database installation.
Azure Pipelines is the CI/CD service that includes both Microsoft-hosted and self-hosted agents. The agent is the compute resource that runs the pipeline tasks, while Pipelines is the orchestrator that manages the workflow, triggers, and artifact management. You can use multiple types of agents within the same Pipelines setup.
Think of Azure Pipelines as the food truck festival organizer who coordinates where each truck goes and when. The Microsoft-hosted agent is the food truck itself. The organizer (Pipelines) tells the truck (agent) what to do.
Azure Virtual Machines are IaaS compute resources that you manage entirely, from the OS up. Microsoft-hosted agents are also VMs, but they are managed by Microsoft and are ephemeral. You cannot RDP or SSH into a Microsoft-hosted agent, whereas you have full admin access to your own Azure VMs.
An Azure VM is like owning a house that you can decorate and fix yourself. A Microsoft-hosted agent is a hotel room that is cleaned and prepared by the hotel staff for each new guest.
An agent pool is a logical collection of agents that are used to run pipeline jobs. Both Microsoft-hosted and self-hosted agents belong to pools. The pool itself is not a compute resource; it is a queue manager. Learners sometimes confuse the pool (which is just a grouping) with the actual agents.
An agent pool is like a waiting line at a taxi stand. The vehicles (agents) can be various types (taxis, personal cars), but the line (pool) just helps organize which vehicle takes the next passenger.
Must Know for Exams
Microsoft-hosted agents are a key topic in Azure DevOps-related certification exams, particularly the Azure DevOps Engineer Expert (AZ-400) and the Azure Administrator Associate (AZ-104) when covering pipeline infrastructure. For the AZ-400 exam, the topic is explicitly listed under the skill 'Design and implement build and release pipelines,' which includes selecting the appropriate agent pool. Learners need to understand the trade-offs between Microsoft-hosted and self-hosted agents, including cost, customization, and limitations.
In exam questions, you will often be presented with a scenario where a team has specific requirements, such as needing to install a custom certificate or running a build that exceeds the 6-hour limit. The correct answer usually involves recognizing that a self-hosted agent is required for those scenarios. Conversely, a question about minimizing administrative overhead and cost for a standard build would point toward using a Microsoft-hosted agent.
Another common exam objective is understanding the agent pool hierarchy. You need to know how to create custom agent pools, and that you can add both Microsoft-hosted and self-hosted agents to the same pool. The exam may ask about how to handle agents when you have multiple projects with different security or compliance needs.
The AZ-104 exam may touch on hosted agents in the context of managing Azure resources and automation. For example, questions about setting up automated deployments using Azure DevOps might ask which type of agent is appropriate for deploying resources to a secure virtual network that has no internet access. In that case, a Microsoft-hosted agent would not work because it cannot access resources inside a private network, so a self-hosted agent inside that network would be required.
the exams often test the concept of 'parallel jobs' and quota management. You might see a scenario where a team's builds are taking longer to queue, and you need to identify the cause. The solution could be purchasing additional parallel jobs or optimizing the pipeline to use fewer resources.
Microsoft also updates the list of pre-installed software on hosted agents. Exam questions may reference specific tools being available by default, like 'Is Docker installed on the Ubuntu hosted agent?' The answer is yes, but the learner must know that Docker requires privileged mode, which is not available on hosted agents. This nuance is frequently tested.
Overall, understanding Microsoft-hosted agents is not just a theoretical concept. It is a practical decision you will face in real projects, and the exams reflect that by asking you to apply knowledge to realistic scenarios.
Simple Meaning
Think of a Microsoft-hosted agent like a rented food truck at a festival. You don't own the truck, you don't have to clean it, maintain its engine, or store it after the event. You just show up, cook your food, and leave. The truck is fully stocked with basic kitchen tools, a stove, a fridge, and cleaning supplies. If you need a special ingredient, you bring it yourself. If the truck breaks down, the festival organizers replace it quickly.
In the world of software development, a Microsoft-hosted agent is exactly this kind of temporary, ready-to-use work environment. When you want to automatically build or test your software using Azure DevOps, Microsoft provides a clean, fresh virtual machine (VM) for each job. This VM already has common tools installed, such as Git, Visual Studio, Node.js, Python, and .NET. You do not have to worry about installing the operating system, patching security updates, or managing disk space. Once your task is done, the VM is destroyed, and a new one is created for the next task.
This is incredibly helpful because it saves you time and money. You do not have to buy or maintain your own physical or virtual servers for running builds. You do not need a dedicated IT person to keep those servers working. It also ensures that every build starts in a consistent, clean environment. There is no risk of leftover files from a previous build affecting your current build. This consistency makes debugging much easier, because you know the environment was identical to what everyone else is using.
However, there are limits. You cannot install custom software on a Microsoft-hosted agent unless you do it during the build process. You also have a time limit on how long a job can run, and you cannot access the machine interactively, which means you cannot log in to fix something manually. It is designed purely for automated, scripted tasks.
Full Technical Definition
A Microsoft-hosted agent is a virtual machine that is provisioned on demand by Azure DevOps Pipelines to execute continuous integration and continuous delivery (CI/CD) jobs. These agents run on Microsoft Azure infrastructure and are managed entirely by Microsoft. Each agent is created fresh for each pipeline job and is destroyed after the job completes, ensuring a clean, isolated execution environment every time.
From an infrastructure perspective, Microsoft-hosted agents are based on Azure Virtual Machines. They support multiple operating system families, including Windows Server (2019, 2022), Ubuntu (18.04, 20.04, 22.04 LTS), and macOS (various versions). Each VM image comes with a curated set of pre-installed tools and SDKs. For Windows images, this includes Visual Studio community editions, .NET frameworks, PowerShell, SQL Server LocalDB, and Azure CLI. Linux images include Git, various compilers (GCC, Clang), Python, Node.js, Ruby, Docker, and Kubernetes tools (kubectl, helm).
When a pipeline is triggered, Azure DevOps selects an available agent from a pool. The agent pool is a logical grouping of agents that share a common queue. For Microsoft-hosted agents, there are predefined pools such as Azure Pipelines, Azure Pipelines (Windows 2022), and Azure Pipelines (Ubuntu 22.04). The job is then assigned to a specific VM instance. The agent software on that VM listens for instructions, downloads the repository, runs the pipeline tasks defined in the YAML file, and uploads artifacts or test results back to Azure DevOps.
Communication between the agent and Azure DevOps uses HTTPS and a secure REST API. The agent authenticates using a job-level access token that is short-lived, typically valid for the duration of the job only. This token is created by Azure DevOps and passed to the agent during job assignment. The agent does not have access to your Azure subscription unless you explicitly configure a service connection.
One important limitation is the maximum job duration. For GitHub Free repositories using Azure Pipelines, the limit is 360 minutes (6 hours) per job. For private projects, it can be higher depending on your licensing. Another limitation is disk space, which is capped at about 200 GB for standard agents. If your build requires more space, you may need to use a self-hosted agent with attached storage.
Microsoft-hosted agents also charge against your free or paid parallelism quota. Each time you run a job on a hosted agent, it consumes one parallel job minute. If you run out of quota, jobs will be queued until new capacity becomes available. You can purchase additional parallel jobs if needed.
Real-Life Example
Imagine you are a chef who moves between different pop-up restaurants each week. You never own a kitchen. Instead, each pop-up location gives you a clean, fully equipped kitchen with standard appliances, pots, pans, and basic ingredients like salt and oil. You bring your own secret sauces and fresh produce. After you finish cooking for the evening, you leave, and the kitchen is cleaned and prepared for the next chef.
This is exactly how a Microsoft-hosted agent works. The pop-up restaurant is the temporary virtual machine. The standard equipment represents the pre-installed tools like compilers, interpreters, and version control software. Your secret sauces are the custom scripts or configuration files you include in your repository. The clean-up after your meal is the agent being destroyed after the job completes.
Now consider a more complex scenario: you are running a chain of multiple pop-ups simultaneously. Each location needs to be independently stocked and cleaned. In software terms, this is like having many pipeline jobs running in parallel, each on its own Microsoft-hosted agent. You don't have to worry about one kitchen’s mess affecting another. You don't need to hire a janitor for each location. Microsoft handles all of that behind the scenes.
The key difference is that you cannot install a permanent specialized oven in the pop-up kitchen. You have to bring your own portable version or work within the limitations. Similarly, on a Microsoft-hosted agent, you cannot install software permanently. You can install it during the job using a script, but it will not persist after the job ends. This is fine for most tasks, but if you need a highly specialized environment that takes a long time to configure, you might want to use your own permanent kitchen, which is a self-hosted agent.
Why This Term Matters
In practical IT work, the ability to automate builds and deployments without managing infrastructure is a game changer. Microsoft-hosted agents remove the burden of server maintenance, updates, and scaling from the team. This means even small teams with limited IT resources can adopt robust CI/CD practices that were once only feasible for large organizations with dedicated operations teams.
Consider a typical scenario in a development team. Before hosted agents, teams had to set up and maintain their own build servers. This involved installing the operating system, configuring network security, installing and updating development tools, managing disk space, and dealing with server failures. If the build server went down, the entire team would be blocked until it was fixed. With Microsoft-hosted agents, if one agent fails, another is automatically provisioned, and your build runs without delay.
For companies that handle multiple projects with different technology stacks, hosted agents are especially valuable. You can have one pipeline using a Windows agent to build a .NET application, and another using a Linux agent to build a Python microservice. You don't need to maintain separate servers for each stack. The agents are pre-configured with the appropriate tools, so you just select the image that matches your needs.
Security is also a major concern. Maintaining a secure build server requires regular patching, vulnerability scanning, and access control. With Microsoft-hosted agents, Microsoft handles the security of the base VM images. They apply patches regularly and release new images that include the latest security updates. This reduces the attack surface and the compliance burden on your team.
From a cost perspective, you pay only for the time you use. There is no idle cost for a server sitting unused overnight. This is ideal for teams that run builds intermittently or have variable workloads. You also avoid the capital expense of purchasing hardware.
Finally, hosted agents support geo-redundancy. Microsoft provision agents in multiple Azure regions. If one region experiences an outage, your jobs can still run in another region, increasing the resilience of your CI/CD pipeline. This level of reliability is difficult and expensive to achieve with self-hosted infrastructure.
How It Appears in Exam Questions
Exam questions about Microsoft-hosted agents usually fall into three categories: scenario-based decisions, configuration steps, and troubleshooting. Scenario-based questions present a team's requirements and ask which agent type to use. For example, 'A team needs to run a build that takes 8 hours due to large test suites. The build environment requires specific proprietary libraries that cannot be installed during the pipeline. Which agent type should they use?' The correct answer is a self-hosted agent, because the build time exceeds the 6-hour limit for hosted agents, and custom software that must persist between builds requires a permanent agent.
Another typical question: 'Your company has a compliance requirement that all build machines must have specific security patches installed before each build. You want to minimize management overhead. Which approach should you recommend?' Here, the answer might be to use Microsoft-hosted agents, because Microsoft applies patches to the VM images before each job starts, ensuring a compliant environment without manual patching.
Configuration questions ask about how to set up a pipeline to use a specific agent pool. For example, 'You need to configure a YAML pipeline to run only on Windows agents. Which agent pool specification should you use?' The answer is to set 'vmImage' to 'windows-2022' or 'windows-2019' under the 'pool' section. The question might also ask about how to define a custom agent pool and add a Microsoft-hosted agent to it, which involves creating a new pool in Azure DevOps and setting it to use Microsoft-hosted agents.
Troubleshooting questions often involve errors or unexpected behavior. A common problem is a pipeline job getting stuck in a 'queued' state. The question might ask: 'Your team notices that builds are taking over 30 minutes just to start. The pipeline is configured to use Microsoft-hosted agents. What is the most likely cause?' The answer is that the parallelism quota is exhausted, meaning all available agents are occupied or the account has hit its concurrency limit.
Another troubleshooting scenario: 'A build fails with an error that a required tool is missing, even though the tool is listed as pre-installed on the Microsoft documentation. What could be the issue?' The answer might be that the pipeline is using an older VM image that does not include the latest tool version. The fix is to update the 'vmImage' specification in the YAML file to use a newer image.
Some questions test knowledge of the agent's network capabilities. For instance: 'Your Azure resources are in a virtual network with no public endpoints. You want to use Azure DevOps Pipelines to deploy to those resources. Which agent type should you use?' The correct answer is a self-hosted agent running inside the virtual network, because Microsoft-hosted agents cannot access private networks without additional configuration like setting up a jump box or a VPN gateway.
Study AZ-400
Test your understanding with exam-style practice questions.
Example Scenario
A small software company, TechFlow Inc., has three developers working on a web application called TaskMaster. They use Azure DevOps to manage their code and want to set up automatic builds every time someone pushes code to the main branch. The company has a limited IT budget and no dedicated DevOps engineer. They need a simple, low-maintenance solution.
TechFlow decides to use Microsoft-hosted agents. Their portfolio contains both a .NET back-end and a React front-end. They configure two separate pipelines: one that uses a Windows agent (for the .NET build) and one that uses an Ubuntu agent (for the React build). In each pipeline's YAML file, they specify the vmImage accordingly.
For the .NET pipeline, they write:
trigger: - main pool: vmImage: 'windows-2022' steps: - script: dotnet build
For the React pipeline, they write:
trigger: - main pool: vmImage: 'ubuntu-22.04' steps: - script: npm install && npm run build
Whenever a developer pushes code, each pipeline triggers automatically. The .NET pipeline runs on a fresh Windows server with Visual Studio and .NET SDK pre-installed. The React pipeline runs on a fresh Ubuntu VM with Node.js and npm ready to go. Both complete in under 10 minutes, and the team receives a success or failure notification.
One day, a developer pushes a large change that includes many unit tests. The build takes 45 minutes, which is well within the 6-hour limit. The team is happy. Later, they decide to add a third pipeline for a mobile app that requires macOS. They simply create a new pipeline with vmImage: 'macOS-12' and it works immediately, without any need to buy a Mac or set up a Mac server.
TechFlow does not have to worry about server maintenance, security patches, or disk cleanup. They are only charged for the minutes their builds run, which in their case is very low. The Microsoft-hosted agent solution perfectly matches their needs: simple, cost-effective, and reliable.
Common Mistakes
Thinking that you can install software permanently on a Microsoft-hosted agent.
Microsoft-hosted agents are ephemeral. They are created fresh for each job and destroyed immediately after. Any software installed during a job will not be available for subsequent jobs. You must install it in every pipeline run if needed.
If you need software that should be available across builds, use a self-hosted agent. Alternatively, include the installation commands in your pipeline script at the start of the job.
Assuming all Microsoft-hosted agents have the same tools and operating system version.
There are multiple VM image families with different operating systems and tool sets. Choosing the wrong vmImage can result in missing tools or different versions. For example, the Ubuntu 18.04 image has older versions of Node.js than the Ubuntu 22.04 image.
Always check the Microsoft documentation for the exact list of software available on each VM image. In your YAML pipeline, specify the exact image name that matches your requirements.
Believing that Microsoft-hosted agents can access resources inside an Azure virtual network without any additional configuration.
Microsoft-hosted agents run on shared Azure infrastructure and do not have direct network access to resources inside a virtual network. They can only reach public endpoints. If you need to deploy to a virtual machine or database inside a VNet, you need a self-hosted agent inside that network or set up a VPN gateway.
For deployments to private networks, use a self-hosted agent in the same virtual network, or configure a service endpoint that uses an on-premises data gateway where applicable.
Assuming that you can use Docker in privileged mode on a Microsoft-hosted agent.
Microsoft-hosted agents run in an environment that does not allow privileged mode for Docker, due to security reasons. You cannot run containers that require elevated privileges, such as building Docker images that need to mount host directories.
If you need privileged Docker operations, use a self-hosted agent where you can control the security settings. Alternatively, use a Docker-based approach that does not require privileged mode, such as using the Docker-in-Docker (DinD) script provided by Azure DevOps.
Believing that a pipeline job can run indefinitely on a Microsoft-hosted agent.
Each job has a maximum timeout, typically 360 minutes (6 hours) for free and many paid plans. If your build or test takes longer, it will be terminated automatically. This can cause incomplete deployments or false failures.
Optimize your pipeline to complete within the time limit. If the work legitimately takes longer, use a self-hosted agent where you can configure the timeout, or split the job into multiple parallel jobs.
Thinking that you can use the same Microsoft-hosted agent for a series of related jobs and preserve state between them.
Each job in a pipeline gets a brand new agent. Even if you have multiple jobs in the same pipeline, they will run on different VMs. State from one job (like compiled binaries) is not automatically passed to the next job unless you use artifact publishing and downloading.
Use pipeline artifacts to pass files between jobs. Use 'PublishBuildArtifact' and 'DownloadBuildArtifact' tasks. Alternatively, combine steps into a single job if the work must be done on the same machine.
Exam Trap — Don't Get Fooled
{"trap":"The question describes a team that needs to run a build that requires a specific version of a tool that is not pre-installed on any Microsoft-hosted agent image. The team wants to minimize overhead. The trap is that learners may think they can use a Microsoft-hosted agent and install the tool at the start of the pipeline, but the question may specify that the installation takes 30 minutes and the total build time including installation must not exceed 4 hours.
The catch is that installation time counts against the build timeout, and the build itself might then exceed the 6-hour limit.","why_learners_choose_it":"Learners often see that Microsoft-hosted agents are low maintenance and think that a simple script at the beginning of the pipeline will solve the missing tool problem. They do not account for the additional time required for installation, which can push the job over the maximum timeout or trigger resource exhaustion in other ways."
,"how_to_avoid_it":"Always read the scenario fully. If the build plus installation time approaches or exceeds the 6-hour limit, then a self-hosted agent is the better choice, even though it requires more setup. Alternatively, if the tool installation is quick (under a few minutes), a hosted agent is fine.
In the exam, also consider whether the tool needs to be persistent across builds, which is a further reason to choose self-hosted."
Step-by-Step Breakdown
Pipeline triggered
When you push code to a repository or schedule a build, Azure Pipelines detects the trigger and starts processing the pipeline definition. It evaluates conditions such as branch filters and path filters before proceeding.
Job assigned to an agent pool
Azure Pipelines looks at the 'pool' specification in your YAML file or release definition. If it specifies 'vmImage' like 'ubuntu-22.04', the system knows to use a Microsoft-hosted agent. The job enters a queue for that pool.
Virtual machine provisioned
When an agent slot becomes available, Microsoft Azure Provisions a new virtual machine from the selected image. This VM is fully patched and includes all the pre-installed software defined for that image. The provisioning happens automatically, typically within a minute.
Agent software initializes
On the newly provisioned VM, the Azure Pipelines agent software starts up. It connects to Azure DevOps using a secure HTTPS connection and authenticates using a short-lived job token. The agent then registers itself with the pool and waits for instructions.
Job execution begins
Azure DevOps sends the pipeline steps to the agent. The agent downloads the source code from the repository, if specified, and then executes each step in order: running scripts, invoking tasks, or calling external services. All output is streamed back to the pipeline log in real-time.
Artifacts and results uploaded
After the steps complete, the agent uploads any published build artifacts (compiled binaries, NuGet packages, etc.) back to Azure DevOps. Test results and code coverage data are also uploaded. The agent then reports the job status as succeeded, failed, or cancelled.
Virtual machine destroyed
Once the job is finished and all artifacts are uploaded, the virtual machine is immediately deallocated and destroyed. It is not reused for any other job. This ensures a clean environment for each run and prevents any data leakage between jobs.
Billing recorded
The total time the VM was running, from provisioning to destruction, is recorded as 'pipeline minutes consumed.' This is deducted from your monthly free quota or billed based on your Azure DevOps plan. You are only charged for actual compute time, not queue time.
Practical Mini-Lesson
When you work with Microsoft-hosted agents in a professional environment, the first step is to understand the available VM images and their tool sets. Microsoft publishes a detailed list of included software for each image. As a professional, you should check this list before designing your pipeline. A common mistake is to rely on a tool that is not included or is an older version. For example, if you need Python 3.10 specifically and the Ubuntu image only has 3.8, you will need to install it during the build. You can do this by adding a script step before your main build step.
Another practical consideration is disk space. Microsoft-hosted agents have a limited disk size, typically around 200 GB. If your project has large dependencies or you generate large build outputs, you might run out of space. You can mitigate this by cleaning up temporary files after each step, using tools like 'Cleanup' tasks. If disk space is still a problem, consider using a self-hosted agent with larger disks.
Networking is a critical topic. Microsoft-hosted agents are outside your corporate network. They cannot access internal databases, APIs, or on-premises file shares unless you expose those resources via public endpoints or use Azure ExpressRoute. Many companies have strict security policies that forbid exposing internal resources. In such cases, you can set up a self-hosted agent inside your virtual network. To still benefit from the ease of hosted agents, some teams use a hybrid approach: they run build and unit tests on Microsoft-hosted agents, and only use self-hosted agents for deployment steps that require internal access.
You can also customize the network behavior of hosted agents. For example, you can use IP address whitelisting by using the list of Azure DevOps agent IP ranges, which Microsoft publishes and updates weekly. This allows you to grant the agent access to a firewall-protected service while keeping it closed to the public. However, this is a static list and may change, so it requires maintenance.
Another professional tip is to use the 'resources' section in YAML to specify which repository triggers the pipeline and to pass variables securely. For secrets, use Azure Key Vault integration rather than embedding them in code. Microsoft-hosted agents can access Key Vault secrets via service connections, which is secure because the agent only has access for the job duration.
Finally, always test your pipeline on a hosted agent before promoting to production. Because the environment is standardized, any issues you encounter are likely due to your build scripts, not the environment. Use the 'validation' pipeline feature to run quick checks on pull requests. This saves time and prevents broken code from being merged.
Memory Tip
Think 'Hotel Room, Not Your House': a Microsoft-hosted agent is like a hotel room, clean, temporary, and managed. It has basic amenities but you cannot paint the walls or install a permanent fixture.
Covered in These Exams
Current Exam Context
Current exam versions that test this topic — use these objectives when studying.
Related Glossary Terms
A 2-in-1 laptop is a portable computer that can switch between a traditional laptop form and a tablet form, usually by detaching or rotating the keyboard.
The 24-pin motherboard connector is the main power cable that connects the computer's power supply unit (PSU) to the motherboard, supplying electricity to the motherboard and its components.
Two-factor authentication (2FA) is a security method that requires two different types of proof before granting access to an account or system.
A 3D printer is a device that creates physical objects by depositing layers of material based on a digital model.
5G is the fifth generation of cellular network technology, designed to deliver faster speeds, lower latency, and support for many more connected devices than previous generations.
The 8-pin CPU connector is a power cable from the power supply that delivers dedicated electricity to the processor on a computer's motherboard.
802.1Q is the networking standard that allows multiple virtual LANs (VLANs) to share a single physical network link by tagging Ethernet frames with VLAN identification information.
802.1X is a network access control standard that authenticates devices before they are allowed to connect to a wired or wireless network.
Frequently Asked Questions
How long can a job run on a Microsoft-hosted agent?
The maximum timeout for a job on a Microsoft-hosted agent is 360 minutes (6 hours) for most plans. If your build or test takes longer, the job will be terminated automatically. You can use a self-hosted agent if you need longer execution times.
Can I install custom software on a Microsoft-hosted agent?
You can install software during the pipeline run using command-line tasks, but the software will not persist after the job ends because each job gets a fresh virtual machine. If you need software to be always available, use a self-hosted agent.
What is the difference between a Microsoft-hosted agent and a self-hosted agent?
A Microsoft-hosted agent is a temporary virtual machine managed by Microsoft that you do not need to maintain. A self-hosted agent is a machine you manage yourself, giving you full control over the environment, network, and installed software, but requiring you to handle maintenance, patching, and scaling.
Can I access a Microsoft-hosted agent via RDP or SSH?
No, Microsoft-hosted agents are not accessible interactively. You cannot log in to a desktop or shell session. All interaction must happen through the pipeline steps defined in your YAML or release definition.
Are Microsoft-hosted agents secure for running sensitive tasks?
Yes, they are designed with security in mind. Each job gets an isolated virtual machine that is destroyed after the job. Communication is encrypted via HTTPS, and authentication uses short-lived tokens. However, you should not store secrets in plain text; use Azure Key Vault or Azure DevOps secret variables.
What happens if my Microsoft-hosted agent job fails because of a missing tool?
The pipeline will fail with an error indicating which command or tool was not found. You can then add a step to install the missing tool at the beginning of your pipeline. Alternatively, consider switching to a different VM image that includes the tool by default.
Can I use a Microsoft-hosted agent to deploy to an on-premises server?
Not directly, because the agent is external to your network. You can use a self-hosted agent on the on-premises network, or use a deployment gateway such as an Azure DevOps on-premises data gateway. Another approach is to have the hosted agent trigger a script on a jump box inside the network.
Will using a Microsoft-hosted agent affect my Azure DevOps parallel job quota?
Yes, each job that runs on a Microsoft-hosted agent consumes one parallel job minute from your quota, which is based on your Azure DevOps license (e.g., free tier, paid tier, or Microsoft-hosted CI/CD). If you exceed your quota, jobs will be queued until capacity is free.
Summary
A Microsoft-hosted agent is a managed virtual machine provided by Azure DevOps to run CI/CD jobs. It is an ephemeral, pre-configured environment that Microsoft maintains, so you do not have to worry about patching, scaling, or hardware failures. This service is a cornerstone of modern DevOps practices because it lowers the barrier to entry for automation. Small teams and large enterprises alike can start using continuous integration and deployment with minimal upfront investment.
In the context of IT certifications, especially the Azure DevOps Engineer Expert (AZ-400) and Azure Administrator (AZ-104) exams, understanding Microsoft-hosted agents is essential. You must know when to use them versus self-hosted agents, their limitations such as timeouts, disk space, and lack of network access to private resources, and how to configure them in YAML pipelines. Common exam traps involve assuming you can install software permanently or access private networks without extra setup.
The key takeaway for your exam preparation is to think of the Microsoft-hosted agent as a standardized, disposable worker. Use it whenever you can, but know that custom environments, long-running jobs, and private network access require a self-hosted agent. With this understanding, you can confidently answer scenario-based questions and configure pipelines correctly in real-world projects.