Design and implement Azure DevOps pipelines and GitHub Actions
Learning objectives
- Select automation and worker infrastructure from trust, capacity and connectivity requirements.
- Implement explicit triggers, dependencies, reusable elements and output bindings.
- Separate YAML structure from resource-owner approvals and runtime verification.
- Describe the authoring and controlled-output model of GitHub Agentic Workflows.
Choose the automation service and execution estate together
Azure Pipelines can build GitHub repositories while retaining Azure DevOps agents, service connections and resource checks. GitHub Actions integrates events, workflows and runners with GitHub's repository/organization model. Repository location alone does not force either deployment service. Identify who owns governance, how the repository is authenticated and which execution network reaches the target.
Hosted workers provide fresh job machines and managed images. Self-hosting can supply special tools or private-network access, but the operator owns patching, isolation, cleanup and capacity. Include idle compute, storage/network, licenses and operator effort in cost comparisons; self-hosting is not automatically cheaper. Agentic investigation can complement deterministic build/test/deploy commands without replacing reproducibility with prompts.
For an illustrative private-network release, deploy through a controlled worker with target access while validating untrusted PRs on separate disposable workers. Withholding production secrets does not prevent hostile PR code from compromising a reusable privileged machine.
Size usable capacity, not registrations
One Azure Pipelines agent executes one job at a time. Ten registrations with two allowed parallel jobs do not provide ten simultaneous jobs. A GitHub runner must also be online, idle, permitted by its group and matched by requested labels. Measure queue delay separately from execution before adding machines.
Inventory OS/architecture, SDKs, browsers, software licenses, capabilities/labels, outbound service access, target reach, runtime privileges, patch owner and diagnostic retention. ADO self-hosted demands select capabilities; selecting a hosted image is another mechanism. UI tests can require an interactive desktop, not simply a named service account.
Distinguish Azure VM scale-set pools, Managed DevOps Pools and GitHub ARC/runner scale-set responsibilities. Verify the selected service's subscription/network ownership rather than generalizing an overview. Ephemeral runners unregister after one job, but machine destruction/cleanup and external logs remain operator duties.
For a GitHub repository runner, use the required personal-repository owner or organization-owner/repository-admin authority, machine access and organization policy. Open Settings → Actions → Runners → New self-hosted runner, select the actual OS/architecture, and follow generated download, extraction and configuration commands. The generated registration token expires after one hour; it is not a permanent credential to commit.
Start the runner application or approved service. Check online status and “Listening for Jobs,” select matching runs-on labels/group, then inspect an authorized diagnostic job's actual assignment. Registration without a listener supplies no capacity. Windows service installation requires elevation; this is a prerequisite, not authorization to alter the machine. For ADO too, distinguish the registering identity from the runtime account. No runner was installed for this lesson.
Connect GitHub and review the generated YAML
Create or select the Azure Pipeline with the actual GitHub repository and YAML path. The GitHub App integration supports GitHub Checks; OAuth/PAT alternatives depend on a person's access and can stop when it changes. ADO project membership and GitHub repository rights are independent. Review generated checkout and trigger settings, validate an authorized known commit, and compare the run SHA and GitHub check/status.
PR validation for GitHub through Azure Pipelines filters the PR's target branch and evaluates source/target merge context. CI source-branch filtering differs. Set draft and autoCancel behavior deliberately. Fork settings vary by organization age/policy, and secret withholding does not clean a persistent worker.
Give Copilot the existing YAML, repository layout, exact commands, runtime versions and allowed targets. Keep .github/copilot-instructions.md, scoped instructions or AGENTS guidance aligned with real entry points. Request a minimal change preserving controls. A simple illustrative Azure skeleton is:
trigger:
branches:
include: [main]
pool:
vmImage: ubuntu-latest
steps:
- script: ./ci/build-and-test.sh
displayName: Build and test
The repository-owned script must exist and propagate failures. This fragment installs no toolchain and proves no compatibility. Choose the project's supported image/commands, inspect task versions, checkout revision, secret handling, triggers and exit behavior, then inspect editor/expanded-YAML template resolution with access to referenced repositories. Expansion verifies the configured document, not runtime credentials, network or test success. A deterministic task assistant is not Copilot merely because both can insert YAML.
Specify event and time semantics explicitly
Azure Pipelines implied all-branch YAML CI depends on the Disable implied YAML CI trigger policy. Write root triggers explicitly; runtime variables and template-only trigger text do not substitute for them. YAML schedules use UTC. UI schedules can override YAML, and schedule registration is branch-local, so reconcile overrides and ensure the matching definition exists in the relevant branch.
Pipeline-completion triggers require successful completion and every applicable branch, stage and tag filter. Same-repository producer/consumer runs can use the same commit; cross-repository selection uses the configured default-branch context. Inspect Default branch for manual and scheduled builds when filters unexpectedly fail.
The adopted GitHub schedule documentation supports an optional IANA timezone, unlike ADO UTC YAML scheduling. Scheduled jobs can be delayed or dropped under load, so they are unsuitable as exact-time safety mechanisms. A GitHub workflow_run completed event needs an actual successful conclusion check; “completed” includes unsuccessful outcomes. A privileged downstream job must validate the provenance and trust of upstream artifacts even if the producer had no secrets.
For an illustrative build/package chain, select the producer identity and allowed branch, require successful completion and inspect downstream SHA/run linkage. A manual rerun or schedule must not silently substitute an unrelated latest artifact. These are configuration expectations, not observed executions.
Make dependencies and failure behavior visible
Model the pipeline as a directed acyclic graph. Independent checks may run together, subject to eligible capacity and entitlement; release waits for all required producers/results. ADO stages normally run sequentially, but explicit dependsOn changes the graph. GitHub uses needs.
An Azure stage fragment can express:
- stage: Deploy
dependsOn: [Build, Security]
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
jobs:
- job: VerifyInput
steps:
- script: echo Verify the approved artifact identity before deployment
This references separately defined producers and illustrates a condition, not a deploy implementation. A custom condition replaces the default; omitting succeeded() can permit work after failure. Cancellation and skipped parent stages can still prevent children. A value produced during a job cannot retroactively decide whether that same job starts.
In a GitHub matrix, fail-fast cancels remaining work after a relevant failure. continue-on-error tolerates a specified failing job. Neither decides which variants are required for release. Label experimental variants explicitly and keep failure publication/cleanup conditions separate from permission to deploy.
Reuse contracts and transport outputs explicitly
Azure include templates reuse steps/jobs/stages; extends can impose a controlling pipeline contract, with a required-template check enforcing its use. Templates expand at parse time, so downloading one halfway through a run does not make it prior syntax. Typed parameters select supported variants. Protect secrets as variables/credentials rather than openly expanded parameters. Classic task groups are a different mechanism and cannot simply be pasted as YAML.
Variable groups require pipeline authorization in addition to definition. A group name grants no secret access. Parse-time expressions, runtime variables and shell environment values resolve at different times. A cross-job output needs a named producing step, isOutput=true, a graph dependency and the appropriate mapping:
jobs:
- job: Build
steps:
- bash: echo "##vso[task.setvariable variable=artifactLabel;isOutput=true]example-123"
name: publishIdentity
- job: Inspect
dependsOn: Build
variables:
acceptedLabel: $[ dependencies.Build.outputs['publishIdentity.artifactLabel'] ]
steps:
- bash: echo "$ARTIFACT_LABEL"
env:
ARTIFACT_LABEL: $(acceptedLabel)
The expected nonsecret value is example-123, not a cryptographic verification. A missing producer/binding is different from a legitimate empty business value. Across stages, use the documented stageDependencies mapping and explicit stage dependency; deployment jobs and matrices have different syntax.
A GitHub reusable workflow lives directly in .github/workflows/, declares on: workflow_call with typed inputs and explicit secrets, and is called at job level with uses, for example ./.github/workflows/reusable.yml. Match with: names to declared inputs and ensure that local path exists in the selected revision. It is a workflow, not an action under steps.
The adopted nesting limit is ten workflow levels with no cycles. Permissions may stay equal or decrease through calls, not escalate. Secrets travel only to the immediate callee and need explicit forwarding for another hop. Map step outputs through job and workflow outputs. Matrix reusable calls use the adopted last-successful-output behavior, not aggregation of all variants; use an explicit aggregation artifact when all values matter. Missing vars entries can evaluate to empty strings, so validate required inputs. Handle untrusted context through safely consumed inputs/environment values rather than direct interpolation into shell code.
Reference protected environments without inventing protection
The resource owner creates/selects the Azure environment and configures its checks. A YAML deployment job references it:
- deployment: DeployApproved
environment: production
strategy:
runOnce:
deploy:
steps:
- script: echo Replace with the approved deployment command
The echo neither deploys nor installs approvals. Before the consuming stage starts, checks for every protected resource, including service connections where applicable, must pass. Configure reviewers, branch restrictions, timeout and unknown-protection handling at the resource. Verify network reach and runtime identity separately.
Mutual exclusion needs an exclusive-lock check on the resource. With that check in place, lockBehavior: runLatest favors the latest run, whereas sequential lets waiting runs proceed in order. A YAML property alone creates no lock. Decide whether old queued releases remain useful before choosing sequential. For GitHub, environment reference, plan/visibility and bypass still determine protection, and approval-delayed secrets do not cleanse the runner. An authorized rehearsal should inspect waiting, approval, denial and timeout outcomes; YAML alone is insufficient evidence.
Add agentic reasoning through its compiled contract
GitHub Agentic Workflows compile Markdown with YAML frontmatter into an Actions lock workflow. Frontmatter declares triggers, permissions and tools; the body supplies the reasoning task. Keep deterministic build/test/deploy commands in appropriate ordinary Actions jobs.
The adopted quickstart assumes github.com and a default GitHub-hosted Linux runner. It needs a supported AI account, repository write authority, Actions enabled and authenticated GitHub CLI; Windows uses WSL. Enterprise, residency, self-hosted and containerized variants require their own applicability checks. A component version floor alone does not establish full compatibility.
The authoring route starts with gh extension install github/gh-aw, then gh aw add-wizard githubnext/agentics/repo-status in the intended repository. Inspect the sample before accepting it: repo-status can create a GitHub issue, and the wizard may optionally start a run. Choose the engine and authorized authentication, evaluate sensitivity and tool/network permissions, and retain both .github/workflows/<name>.md and <name>.lock.yml. Recompile after frontmatter changes; changing the Markdown without refreshing its lock does not update the executable contract. gh aw compile --watch, gh aw run and gh aw logs support authoring, execution and observation. They were not invoked for this lesson.
Supported agent jobs default to minimal permissions without direct writes. Configured safe outputs pass through separate jobs before changes are applied; critical effects may require approval. Custom jobs or relaxed settings introduce separate trust boundaries. Treat repository text and tool responses as untrusted, inspect generated content before merge, and avoid privileged pull_request_target paths that check out hostile code.
Summary
Build around actual capacity, identity and trust boundaries. Make triggers, dependency graphs and output contracts explicit, then verify the revision and artifact that flow through them. Resource checks and runtime results remain separate from YAML validity. Agentic workflows add controlled reasoning through compiled configuration and reviewed outputs; they do not remove deterministic verification or ordinary authorization.
