How microsoft/ghazdo-resources works
1. This repo is a collection of Azure DevOps resources, scripts, and extension artifacts for demonstrating and accelerating adoption of GitHub Advanced Security on Azure DevOps. It is not a single application; it is a toolkit that wires security scanning, pipeline setup, gating, reporting, and agent preparation together.
2. The main architectural boundary is Azure DevOps itself. Most scripts either:
- configure Azure DevOps pipelines and security features,
- run in build/PR pipelines as gates or helpers,
- or post-process security outputs into reports.
The repo is therefore organized around pipeline lifecycle, not around a runtime service.
3. The src/setup area is the core provisioning layer. It contains PowerShell scripts and pipeline definitions used to enable GHAS features, set up CodeQL for classic and PR-based workflows, and drive builds. Files like Enable-GHAS.ps1, Setup_CodeQL_Classic.ps1, Setup_CodeQL_PRs.ps1, and advanced_security.yml indicate this is the main “bootstrap” subsystem for turning on security scanning in ADO projects.
4. The src/agent-setup scripts are a separate infrastructure layer for build agents. They install CodeQL on Windows, macOS, and Ubuntu agents so downstream pipeline jobs can run analysis locally on the agent rather than relying on the repository to carry the tool binaries.
5. The src/extensions tree is an Azure DevOps extension subsystem. It includes:
- decorator-based autoinjection extensions,
- a CodeQL autoinjection extension,
- and a codeql-autosetup extension with a TypeScript task packaged as an ADO extension.
These pieces sit at the Azure DevOps platform boundary and automate pipeline decoration or task insertion rather than running as standalone tools.
6. The src/3p-sarif directory handles third-party scanner integration. Its .ado subfolders contain YAML examples for tools such as Bandit, Brakeman, OpenGrep, PMD, Psalm, and Security Code Scan. The architectural role here is to normalize external scanner output into SARIF so Azure DevOps/GHAS can ingest and display results consistently.
7. Reporting is split into dedicated post-processing utilities. src/csv-report generates CSV reports from GH/ADO security data, and src/committer-report produces committer-focused reporting via PowerShell. These are downstream consumers of pipeline or scan results, meant for aggregation and visibility rather than enforcement.
8. Gating and verification are handled by src/gating and src/pr-gating. These scripts implement quality/security gates around pipeline execution, especially for pull requests. CIGate.ps1, CIVerify.yml, and related documentation indicate a boundary where scan findings or build state are evaluated before merge or continuation.
9. src/matrix contains YAML for matrix-driven pipeline execution, likely used to fan out tests or scans across multiple targets or configurations. This is an orchestration aid rather than a functional subsystem, but it matters because it determines how broad the security/demo coverage is across environments.
10. src/sbom-tool is a packaging/compliance subsystem for generating or demonstrating software bill of materials artifacts. The presence of a manifest and pipeline YAML suggests it fits into the broader supply-chain security story alongside scanning and reporting.
11. The repo also includes specialized demo/support scripts such as src/exit-code-32 and the various setup/readme files under subsystem folders. These look like scenario-specific examples used to demonstrate particular pipeline or security behaviors rather than production components.
12. In terms of data flow, the typical path is: Azure DevOps pipeline or extension triggers setup scripts -> agents get CodeQL or other scanners installed -> scans run and emit findings/SARIF -> gating scripts evaluate results -> reporting scripts summarize outcomes into CSV or committer reports. That flow is the key architecture to capture in a diagram.
13. Tooling is mostly PowerShell and YAML, with a small TypeScript-based Azure DevOps task and some JavaScript for PR gating. The repo is therefore operational/integration heavy: it is centered on pipeline configuration, extension packaging, and agent-side automation, not on a long-running backend service or UI.
Main entry points: setup Setup Scripts · agent-setup Agent Install · 3p-sarif 3P SARIF · gating Pipeline Gates
Components 20
Provisioning
Azure DevOps project and pipeline setup for GitHub Advanced Security and CodeQL.
- Setup Scripts · Core provisioning layer for enabling GHAS and CodeQL in Azure DevOps projects.
src/setup - Enable GHAS · Enables GitHub Advanced Security features in Azure DevOps.
src/setup/Enable-GHAS.ps1 - Classic CodeQL · Configures CodeQL for classic pipeline workflows.
src/setup/Setup_CodeQL_Classic.ps1 - PR CodeQL · Configures CodeQL for pull-request workflows.
src/setup/Setup_CodeQL_PRs.ps1 - Advanced Security · Pipeline definition tying together setup and build automation.
src/setup/advanced_security.yml
Agent Prep
Scripts that install and prepare tools on build agents.
- Agent Install · Installs CodeQL tooling on hosted or self-hosted agents.
src/agent-setup - Windows · Installs CodeQL on Windows agents.
src/agent-setup/codeql-install-windows.ps1 - macOS · Installs CodeQL on macOS agents.
src/agent-setup/codeql-install-macos.sh - Ubuntu · Installs CodeQL on Ubuntu agents.
src/agent-setup/codeql-install-ubuntu.sh
ADO Extensions
Azure DevOps extension artifacts for decoration and task injection.
- Autoinjection · Decorator-based extension that injects pipeline behavior automatically.
src/extensions/autoinjection - CodeQL Inject · CodeQL-specific decorator extension for automatic pipeline wiring.
src/extensions/codeql-autoinjection - CodeQL Autosetup · Extension packaging a TypeScript task for automated CodeQL setup.
src/extensions/codeql-autosetup
Third-Party Scans
Examples that normalize external scanner output into SARIF for ingestion.
- 3P SARIF · YAML examples for third-party scanners normalized into SARIF.
src/3p-sarif
Controls
Gates and orchestration used to verify or fan out pipeline execution.
- Pipeline Gates · Quality and security gates evaluated during pipeline execution.
src/gating - PR Verify · Pull-request gating and verification logic.
src/pr-gating - Matrix Runs · Matrix-based pipeline fan-out across targets or configurations.
src/matrix/ghazdo-matrix.yml
Reporting
Post-processing outputs for visibility and committer-focused summaries.
- CSV Report · Generates CSV summaries from GitHub/Azure DevOps security data.
src/csv-report - Committer Report · Produces committer-focused reporting and aggregation.
src/committer-report
Compliance
Supply-chain packaging and SBOM generation support.
- SBOM Tool · Supply-chain packaging and SBOM artifact generation support.
src/sbom-tool
Other components
- Exit 32 · Scenario-specific example used to demonstrate pipeline behavior.
src/exit-code-32
Connections 19
- Setup Scripts → Enable GHAS: enables · Bootstrap scripts turn on GHAS features.
- Setup Scripts → Classic CodeQL: configures · Bootstrap provisions classic CodeQL workflows.
- Setup Scripts → PR CodeQL: configures · Bootstrap provisions PR-based CodeQL workflows.
- Setup Scripts → Advanced Security: drives · Setup YAML orchestrates the provisioning workflow.
- Autoinjection → Advanced Security: decorates · Extension injects behavior into pipeline execution.
- CodeQL Inject → Setup Scripts: injects · CodeQL-specific extension automates pipeline wiring.
- CodeQL Autosetup → Setup Scripts: automates · Task extension helps prepare CodeQL setup steps.
- Agent Install → Windows: includes · Agent preparation has OS-specific installers.
- Agent Install → macOS: includes · Agent preparation has OS-specific installers.
- Agent Install → Ubuntu: includes · Agent preparation has OS-specific installers.
- Setup Scripts → Agent Install: depends on · Provisioning expects agents to have CodeQL installed.
- 3P SARIF → Pipeline Gates: feeds · Scanner outputs are evaluated by gates.
- 3P SARIF → CSV Report: feeds · Scan results can be summarized into CSV reports.
- 3P SARIF → Committer Report: feeds · Scan results can be aggregated for committer reporting.
- Pipeline Gates → PR Verify: extends · Pull-request gating is a specialized verification boundary.
- Matrix Runs → 3P SARIF: fans out · Matrix execution broadens scanner and target coverage.
- Setup Scripts → Matrix Runs: orchestrates · Setup pipelines can launch matrix-based runs.
- SBOM Tool → Pipeline Gates: supports · SBOM artifacts participate in compliance and verification workflows.
- Exit 32 → Pipeline Gates: demonstrates · Example scenario used to show gate behavior.