agentleFS
Microsoft AzureKnown publisherAzure/azure-monitor-baseline-alerts/.github/copilot-instructions.md

azure-monitor-baseline-alerts

Copilot instructions322 starsChanged 11 months agoMITView on GitHub

Azure Monitor Baseline Alerts (AMBA) is a comprehensive repository providing baseline alerting guidance and Infrastructure as Code (IaC) templates for Azure resources. The project includes a Hugo-based documentation website, Azure ARM/Bicep templates, and Python tooling for alert management. CRITICAL: Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here. NEVER CANCEL any build or test commands. All timing estimates include safety margins. ALWAYS run the…

  • Installs packages

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

19 rules. About 0 are common, 10 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    CRITICAL: Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information …

    line 5
  2. Very specific:

    Start Hugo server: hugo server -D

    line 103
  3. Distinctive:

    Test key pages: Welcome, Patterns/ALZ, Services sections

    line 105
  4. Distinctive:

    Verify search functionality works

    line 106
  5. Distinctive:

    Run export script to verify processing works

    line 110
  6. Distinctive:

    Check generated outputs contain your changes

    line 111
  7. Distinctive:

    Check for any compilation errors

    line 116
  8. Very specific:

    Check Hugo version: hugo version (must be 0.117.0+ Extended)

    line 166
  9. Very specific:

    Verify config file syntax in config/_default/hugo.toml

    line 167
  10. Very specific:

    Check for missing theme: docs/themes/hugo-theme-relearn/ must exist

    line 168
  11. Very specific:

    Check Python version: python3 --version (requires 3.12+)

    line 172
  12. Distinctive:

    Verify YAML syntax in alert definition files

    line 173
  13. Very specific:

    Check Bicep installation: bicep --version

    line 176
  14. Distinctive:

    Verify template syntax and references

    line 177
  15. Distinctive:

    Ensure all referenced files exist

    line 178
  16. Very specific:

    Check generated site at http://localhost:1313/azure-monitor-baseline-alerts/

    line 205
  17. Very specific:

    Test deployment parameters in patterns/alz/alzArm.param.json

    line 211
  18. Very specific:

    alerts.yaml changes: Run export script to update consolidated outputs

    line 217
  19. Distinctive:

    Policy changes: Update and compile relevant policy template files

    line 220

≈ “Common” is an estimate: at least 1 in 5 of the 1,645 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Azure Monitor Baseline Alerts (AMBA)

Azure Monitor Baseline Alerts (AMBA) is a comprehensive repository providing baseline alerting guidance and Infrastructure as Code (IaC) templates for Azure resources. The project includes a Hugo-based documentation website, Azure ARM/Bicep templates, and Python tooling for alert management.

CRITICAL: Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.

Working Effectively

Bootstrap, Build, and Test the Repository

NEVER CANCEL any build or test commands. All timing estimates include safety margins.

  1. Install Hugo Extended (Required for documentation site):
    wget -O /tmp/hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.117.0/hugo_extended_0.117.0_linux-amd64.deb
    sudo dpkg -i /tmp/hugo.deb
    hugo version  # Verify installation
  2. Install Python dependencies:
    # For alert export tooling
    cd tooling/export-alerts
    pip install -r requirements.txt  # Installs pyyaml, openpyxl
    
    # For template generation
    cd ../generate-templates
    pip install -r requirements.txt  # Installs pyyaml
  3. Build Hugo documentation site:
    cd /path/to/repo/root
    hugo --gc --minify
    • Duration: 15 seconds - NEVER CANCEL. Set timeout to 60+ seconds.
    • Output: Static site files in ./public/ directory
    • Pages generated: ~432 pages, ~735 non-page files, ~3001 static files
  4. Export alert definitions (validates Python tooling):
    cd tooling/export-alerts
    python export-alerts.py --path ../../services --template ./alerts-template.xlsx --output-xls ../../services/amba-alerts.xlsx --output-json ../../services/amba-alerts.json --output-yaml ../../services/amba-alerts.yaml
    • Duration: 5 seconds - NEVER CANCEL. Set timeout to 30+ seconds.
    • Output: Generates Excel, JSON, and YAML files with consolidated alert definitions

Run the Development Environment

ALWAYS run the bootstrapping steps first.

  1. Run Hugo development server:
    hugo server -D
  2. Test Bicep compilation:
    # Example: Compile policy set definitions
    bicep build patterns/alz/templates/policySets.bicep --outfile /tmp/policySets.json
    
    # Example: Compile network policies
    bicep build patterns/alz/templates/policies-Network.bicep --outfile /tmp/policies-Network.json
    • Duration: 3-5 seconds per file - NEVER CANCEL. Set timeout to 30+ seconds.

Validation

ALWAYS manually validate any new code via the following steps after making changes.

Required Validation Steps

  1. YAML validation (for alert definitions):
    python .github/yml-schemas/validate_yml.py "path/to/alerts.yaml"
    • Duration: <5 seconds - Set timeout to 30+ seconds.
    • Purpose: Validates alert definition schema compliance
  2. Hugo site build validation:
    hugo --gc --minify
    • Duration: 15 seconds - NEVER CANCEL. Set timeout to 60+ seconds.
    • Purpose: Ensures documentation builds successfully
  3. Alert export validation:
    cd tooling/export-alerts
    python export-alerts.py --path ../../services --template ./alerts-template.xlsx --output-xls /tmp/test-alerts.xlsx --output-json /tmp/test-alerts.json --output-yaml /tmp/test-alerts.yaml
    • Duration: 5 seconds - Set timeout to 30+ seconds.
    • Purpose: Ensures alert processing tooling works correctly

Manual Testing Scenarios

ALWAYS test these scenarios after making changes to ensure functionality:

  1. Documentation Site Navigation:
  2. Alert Definition Processing:
    • Modify an alert in services/{service}/{resource}/alerts.yaml
    • Run export script to verify processing works
    • Check generated outputs contain your changes
  3. Bicep Template Validation:
    • Make changes to templates in patterns/alz/templates/
    • Compile with bicep build to verify syntax
    • Check for any compilation errors

CI Validation Requirements

Always run these commands before committing to ensure CI will pass:

  1. YAML Schema Validation:
    # Test changed YAML files
    python .github/yml-schemas/validate_yml.py "path/to/changed/alerts.yaml"
  2. Hugo Build Check:
    hugo --gc --minify
    • Must complete successfully - site must build without errors
  3. Bicep Compilation Check:
    # For any modified .bicep files
    bicep build path/to/template.bicep --outfile /tmp/output.json

Repository Structure and Key Locations

Most Important Directories

  • docs/: Hugo documentation source files
    • docs/content/: Markdown content for the website
    • docs/themes/hugo-theme-relearn/: Relearn theme for Hugo
  • services/: Alert definitions organized by Azure service
    • services/{Service}/{Resource}/alerts.yaml: Alert definitions
    • services/{Service}/{Resource}/templates/: ARM/Bicep templates
  • patterns/alz/: Azure Landing Zone (ALZ) patterns and policies
    • patterns/alz/templates/: Bicep policy templates
    • patterns/alz/policyDefinitions/: Generated policy definitions
  • tooling/: Python scripts for processing alerts and templates
    • tooling/export-alerts/: Script to export consolidated alert definitions
    • tooling/generate-templates/: Script to generate ARM/Bicep templates

Key Configuration Files

  • config/_default/hugo.toml: Hugo site configuration
  • .github/workflows/: GitHub Actions workflows for CI/CD
  • .github/linters/: Linting configuration (.markdown-lint.yml, .eslintrc.yml)

Common Build Errors and Solutions

  1. Hugo Build Fails:
    • Check Hugo version: hugo version (must be 0.117.0+ Extended)
    • Verify config file syntax in config/_default/hugo.toml
    • Check for missing theme: docs/themes/hugo-theme-relearn/ must exist
  2. Python Script Errors:
    • Install dependencies: pip install -r requirements.txt in appropriate tooling directory
    • Check Python version: python3 --version (requires 3.12+)
    • Verify YAML syntax in alert definition files
  3. Bicep Compilation Errors:
    • Check Bicep installation: bicep --version
    • Verify template syntax and references
    • Ensure all referenced files exist

Timing Expectations

CRITICAL: Set appropriate timeouts for all operations. These are measured times with safety margins:

  • Hugo site build: 15 seconds (set timeout: 60+ seconds)
  • Hugo server startup: 15 seconds (set timeout: 60+ seconds)
  • Python alert export: 5 seconds (set timeout: 30+ seconds)
  • Bicep compilation: 3-5 seconds per file (set timeout: 30+ seconds)
  • YAML validation: <5 seconds (set timeout: 30+ seconds)
  • Python dependency installation: 10-30 seconds (set timeout: 120+ seconds)

Common Development Tasks

Adding New Alert Definitions

  1. Navigate to appropriate service directory: services/{Service}/{Resource}/
  2. Edit alerts.yaml file following existing schema
  3. Test with: python .github/yml-schemas/validate_yml.py "services/{Service}/{Resource}/alerts.yaml"
  4. Regenerate outputs: cd tooling/export-alerts && python export-alerts.py --path ../../services --template ./alerts-template.xlsx --output-xls ../../services/amba-alerts.xlsx --output-json ../../services/amba-alerts.json --output-yaml ../../services/amba-alerts.yaml

Modifying Documentation

  1. Edit markdown files in docs/content/
  2. Test locally: hugo server -D
  3. Verify build: hugo --gc --minify
  4. Check generated site at http://localhost:1313/azure-monitor-baseline-alerts/

Working with ALZ Policies

  1. Modify Bicep templates in patterns/alz/templates/
  2. Compile: bicep build patterns/alz/templates/{template}.bicep --outfile /tmp/{template}.json
  3. Test deployment parameters in patterns/alz/alzArm.param.json

File Type Handlers

Always check these file locations after making changes:

  • alerts.yaml changes: Run export script to update consolidated outputs
  • Bicep template changes: Compile with bicep build to verify syntax
  • Documentation changes: Build Hugo site to verify rendering
  • Policy changes: Update and compile relevant policy template files

This repository does NOT require traditional package managers like npm or traditional build systems like Make. The toolchain is Hugo + Python + Bicep CLI.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.