PUBLIC BETA OFFER

Save 50% off on an Eligible Learning PlanValid for 1-month plan, 3-month plan, 12-month plan · Code LPXBETA50 · Ends Dec 6, 2026

AZ-401: Agents and Runners with Appropriate Trust and Connectivity

Register one Windows Azure Pipelines agent, verify capability-based job routing, and maintain and stop it while separating setup, runtime and job credentials.

Guide

Content version 1.0

AZ-401: Agents and Runners with Appropriate Trust and Connectivity

AZ-401: Agents and Runners with Appropriate Trust and Connectivity

Register an execution host only after choosing its trust boundary, supported software and permitted workloads. For Azure DevOps Services, this means selecting an existing agent pool and supported Windows host, registering a current compatible agent, choosing its runtime identity, and proving that a small job reaches the intended agent through an explicit demand. Registration, successful routing and a successful build are separate observations.

The procedure below uses one nonproduction Windows host and one Azure Pipelines agent. It includes a matching job, an intentionally unmatched demand, capability refresh, a drained update and restoration of the exercise changes. It is an unexecuted worked procedure: record actual results rather than treating the expected observations as evidence that your environment works.

Choose the execution boundary before installing

A pipeline job needs suitable tools, capacity and connectivity, but the machine also receives code and credentials. Compare those requirements before choosing where it runs.

Choice Useful fit Condition to check
Microsoft-hosted Azure Pipelines agent A supported image and disposable job environment meet the workload Select the required image; account for available parallel capacity and access to dependencies
Self-hosted Azure Pipelines agent An existing controlled machine supplies required software or network access Own patching, credentials, persistent state and workload isolation
GitHub Actions self-hosted runner A GitHub workflow needs an approved existing execution environment Route through eligible runner groups and labels; assess the same code and credential trust risks

Microsoft-hosted jobs receive a fresh virtual machine (VM) for each job. Self-hosted machines can retain tools, caches and other state. A successful previous job therefore does not establish that a reused machine is clean. When estimating cost, include administration and idle capacity as well as compute; this procedure assumes no price or free entitlement.

Keep container requirements separate from registration. For GitHub Actions Docker container actions and service containers on self-hosted runners, use Linux with Docker installed. A registered Windows agent is not proof that a Linux container workload is compatible. This Windows exercise neither configures a Docker agent nor registers a second GitHub runner.

Establish the approved host, pool and identities

Use an existing supported Windows machine, existing Azure DevOps Services organization and pool, and an existing authorized nonproduction pipeline. The illustrative names are an existing pool called Az401Lab and a new agent called az401-win-probe; substitute your approved names. Stop if the machine or pool is unavailable rather than provisioning infrastructure.

Use the authorized pipeline prepared through AZ-401: Choosing Delivery Automation and Connecting GitHub Repositories. This exercise changes its execution routing while preserving the source connection.

Before changing anything, agree with the owners on:

  • The host, operating system, processor architecture, agent directory and maintenance window.
  • Who may administer the pool and configure the local machine, and which existing registration credential is approved.
  • The account permitted to run this workload and its required local and network access.
  • The existing manual test definition, its permitted pool access and the person authorized to edit and queue it.
  • The exact original routing block, capability state and agent state to restore.

Use the current supported package for the actual operating system and architecture. The worked path is Azure DevOps Services with a compatible current 4.x Windows agent. The Windows guide also provides 4.x guidance for Server and separate 3.x guidance for Azure DevOps Server 2020/2022. Do not infer that every Server installation requires 3.x or apply an older Server package as the Services baseline.

Keep three identities distinct:

Identity Purpose Boundary
Registration identity Authorizes adding this agent to the selected pool Pool-administrator authority and local configuration permissions do not become the job's authorization
Runtime account Runs the listener and local job processes Its machine and network access must fit the permitted workload
Job credentials Let an assigned job access permitted pipeline resources Their scope is separate from the setup credential and local account

Pool and local administrators must authorize setup. A pipeline operator also needs the appropriate existing edit, queue and pool-use authorization. A capability is a routing declaration, not an access-control grant or proof that a tool is trustworthy.

Restrict this host to approved workloads. Review untrusted code before allowing it onto a persistent runner, and grant credentials only the access needed. GitHub's secure-use guidance also warns that secret redaction is not guaranteed; do not rely on a masked log as permission to expose secrets.

Download, configure and start one Windows agent

Select and extract the package

In the organization, open Organization settings, then Agent pools. Select the approved existing pool, open its agent list and choose New agent. Select Windows and the architecture matching the actual host, then download the compatible package offered for that environment.

Have the local administrator extract it into a dedicated, protected directory without spaces. The illustrative directory below is owned solely by this exercise. Do not extract over an existing agent or replace another registration.

From an elevated ordinary PowerShell console in that directory, start the documented interactive configuration:

Set-Location 'C:\agents\az401-lab'
.\config.cmd

Use the actual extracted location. The Windows guide excludes Windows PowerShell Integrated Scripting Environment (ISE) for configuration. Protect the agent directory from unauthorized modification and arrange the runtime account's required access before proceeding.

Answer the registration prompts deliberately

Enter the correct Azure DevOps Services organization address when asked. For this worked route, select Personal access token (PAT) authentication and enter an existing policy-approved setup credential with authority for the selected pool. Creating that credential is outside this exercise. Never put it in the pipeline, capability values, screenshots or recorded command history.

Choose the approved pool, a unique agent name and an owned work directory. If configuration proposes replacing an existing agent, stop and reconcile the name with its owner. The intended outcome is one additional authorized registration.

Choose interactive operation for this temporary test. Do not enable automatic logon. Start the listener in a session running as the approved runtime account, rather than assuming the elevated setup identity is the right account for every job:

.\run.cmd

Check the listener's actual connection messages and the selected pool's agent list. Record the registered name, version and online state. A registration record without an active listener does not prove the agent can accept work.

A Windows service is an alternative supported mode for an owner who needs managed startup. Select it through the documented configuration, use the approved service account and inspect the corresponding Windows service. Do not change another agent's account or invent unattended flags. This worked test continues with the interactive process; configuring both modes is unnecessary.

Prove routing with one harmless job

In the selected agent's Capabilities view, inspect detected system capabilities and existing user capabilities. Check that sensitive environment values have not been exposed. A friendly capability name cannot conceal a secret value.

Add one previously unused user capability named Az401RoutingProbe with the nonsensitive value exercise-only. First confirm that no other agent in the selected pool already has that name; otherwise choose an equally distinctive exercise marker and use it consistently.

Use the following YAML Ain't Markup Language (YAML) routing and step block in the agreed existing manual test definition. Preserve its owner-approved trigger controls and unrelated configuration. The example is a small routing probe, not a replacement production pipeline.

pool:
  name: Az401Lab
  demands:
    - Az401RoutingProbe

steps:
  - checkout: none
  - powershell: Write-Host 'Routing probe executed.'
    displayName: Routing probe

The demand checks that the capability exists. Its value is not a software installation test. The step deliberately avoids checking out application code and performs no deployment.

Save the approved temporary definition and queue one manual run. Record the definition revision, pool, assigned agent and actual step result. Inspect the assignment and log rather than inferring host identity from the printed message alone.

Then change only the demand to a second marker, such as Az401RoutingProbeMissing, confirmed absent from every agent in that pool. Queue one bounded test and observe the unsatisfied routing condition. It must not execute on the original agent merely because the pool name matches. Depending on validation and queue state, the service can report an unavailable match or leave the job waiting. Record the real message and cancel the test; do not wait indefinitely or label it an application test failure.

Test Expected distinction Evidence to retain
Online agent with the matching marker The selected agent can accept the authorized probe Assigned agent and actual step completion
Marker absent from the entire pool No agent satisfies the requested capability Demand diagnostic or waiting state, plus cancellation
Matching agent offline or busy A capability match alone does not establish immediate availability Agent state and queue explanation
Assigned job fails Routing succeeded, but execution did not Assigned agent, failing step and diagnostic

These are expected cases, not reported run results. Busy agents, unavailable parallel capacity and missing authorization can also prevent assignment. Separate those conditions before altering capabilities or broadening permissions.

GitHub Actions uses its own runs-on labels and runner groups. An eligible, online, idle matching runner can receive a job; otherwise it waits for an appropriate runner. An Azure capability does not create a GitHub label, group membership or runner registration. Keep that comparison separate from the Azure probe.

Refresh tools and update after work drains

After an approved tool change, allow active work to finish, stop the owned interactive listener with Ctrl+C, and restart it with run.cmd. Inspect the refreshed system capabilities before relying on the tool in another job. An old running process can retain its earlier environment; adding a user capability alone does not prove installation or refresh.

For the maintenance test:

  1. Record the current agent version and confirm the approved work is finished. Coordinate the window so another job will not arrive unexpectedly.
  2. In Project settings, open Agent pools and the selected pool. Use the individual agent's menu to request Update agent, then confirm the update.
  3. Observe the request and agent state. The documented update request waits for running jobs to finish before updating; do not kill an active job to hurry it.
  4. After reconnection, record the actual version and capabilities, then repeat the same harmless matching probe.

Avoid the pool-wide update action on a shared pool. If no supported newer version is available, record that an upgrade was not exercised; a request or unchanged version is not evidence of a completed upgrade. Do not install an obsolete package merely to manufacture a version change.

Restore only the exercise changes

Cancel the intentionally unmatched run and let any permitted active probe finish. Restore the exact original pipeline routing and steps, and confirm that no queued test still refers to the temporary marker.

Remove the user capability created by this exercise, preserving pre-existing capabilities and settings. Stop the owned interactive listener with Ctrl+C and verify its offline state in the pool. Leave the registration and retained diagnostics under the pool owner's agreed retention or removal decision; stopping a process is not deregistration.

Do not delete a shared work directory, uninstall unrelated tools or restore an entire machine from assumptions about its earlier state. A service-mode adoption or registration removal needs its owner's documented maintenance procedure.

Use the evidence to locate a failure before repeating setup:

Observation Investigate first
Registration fails Correct organization, approved setup credential and pool/local administrative authority
Registered but offline Listener or service state, runtime account and required connectivity
Online but never selected Actual pool, demand names, capabilities, availability and pipeline authorization
Job starts but tools or access fail Runtime environment, tool installation and job-specific credentials
Capability remains stale Whether the listener restarted after the approved environment change
Update does not complete Active work, compatibility, update request and reconnection evidence

Keep the final record narrow: selected host and agent, package/version, capability changes, actual matching and unmatched observations, maintenance result and restored state. Do not include setup secrets. AZ-401: YAML Triggers Job Dependencies and Parallel Execution develops pipeline orchestration; AZ-401: Diagnosing Pipeline Failures Duration and Flaky Tests addresses broader failure analysis.

Authoritative Sources

0 views