# coryrburns/azure-recovery-vault-report architecture

> Architecture diagram of the GitHub repository coryrburns/azure-recovery-vault-report, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/coryrburns/azure-recovery-vault-report
- Repository: https://github.com/coryrburns/azure-recovery-vault-report

## Overview

##### Project type and purpose
- This is an automation‐oriented reporting tool, implemented as a set of PowerShell scripts.
- Its goal is to fetch nightly Azure Recovery Services Vault backup job statuses and produce either:
- A CSV table report (backup_report_csv.ps1)
- An HTML email (backup_report_html.ps1 run locally, or backup_report_html_automation.ps1 as an Azure Automation Runbook)

##### File structure
- Top‐level scripts:
- backup_report_csv.ps1 – generates plain CSV output of all vault jobs
- backup_report_html.ps1 – generates and emails an HTML report via SMTP when run interactively
- backup_report_html_automation.ps1 – same HTML/email logic tailored for Azure Automation
- There are no “src” or “lib” folders; all logic lives directly in these three scripts.
- PowerShell modules (Azure.RecoveryServices, AzureRM.RecoveryServices.Backup) are external dependencies, plus SMTP credentials or RunAs credentials in Automation.

##### Key insights from README
- Two run contexts: local PowerShell vs. Azure Automation Runbook
- SMTP server configuration is embedded in the Send-HTML function and must be customized
- Azure Automation requires imported modules and RunAs credentials

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Trigger Mechanism"
        Manual["Manual Execution"]:::trigger
        Schedule["Scheduled Execution"]:::trigger
    end

    subgraph "Execution Hosts"
        LocalHost["Local PowerShell Host"]:::host
        AutomationWorker["Azure Automation Worker"]:::azure
    end

    Manual --> LocalHost
    Schedule --> AutomationWorker

    subgraph "PowerShell Scripts" 
        CSV["CSV Report Generation Script"]:::script
        HTMLL["HTML Report (Local) Script"]:::script
        HTMLA["HTML Report (Azure Automation) Script"]:::script
    end

    LocalHost --> CSV
    LocalHost --> HTMLL
    AutomationWorker --> HTMLA

    subgraph "Azure Environment"
        AzSub["Azure Subscription"]:::azure
        ASRV["Recovery Services Vault API Endpoints"]:::azure
        AA["Automation Account"]:::azure
    end

    Schedule --> AA
    AzSub --> ASRV
    DataRetrieval["Data Retrieval\nInvoke-RsBackupJobList"]:::process
    CSV --> DataRetrieval
    HTMLL --> DataRetrieval
    HTMLA --> DataRetrieval
    DataRetrieval --> ASRV
    ASRV --> DataRetrieval

    Transform["Data Transformation\nGenerate-CSV/HTML"]:::process
    DataRetrieval --> Transform

    SMTPClient["SMTP Client\nSend-MailMessage/Send-HTML"]:::external
    Transform --> SMTPClient

    SMTPServer["SMTP Server"]:::external
    SMTPClient --> SMTPServer

    Recipients["Email Recipients"]:::external
    SMTPServer --> Recipients

    subgraph "Configuration & Docs"
        README["Project Documentation & Configuration Notes"]:::config
    end
    README

    classDef trigger fill:#E1BEE7,stroke:#9C27B0,color:#000;
    classDef host fill:#C8E6C9,stroke:#388E3C,color:#000;
    classDef script fill:#A5D6A7,stroke:#2E7D32,color:#000;
    classDef azure fill:#BBDEFB,stroke:#2196F3,color:#000;
    classDef process fill:#E3F2FD,stroke:#1976D2,color:#000;
    classDef external fill:#FFE0B2,stroke:#FB8C00,color:#000;
    classDef config fill:#F5F5F5,stroke:#9E9E9E,color:#000;

    click CSV "https://github.com/coryrburns/azure-recovery-vault-report/blob/master/backup_report_csv.ps1"
    click HTMLL "https://github.com/coryrburns/azure-recovery-vault-report/blob/master/backup_report_html.ps1"
    click HTMLA "https://github.com/coryrburns/azure-recovery-vault-report/blob/master/backup_report_html_automation.ps1"
    click README "https://github.com/coryrburns/azure-recovery-vault-report/blob/master/README.md"
```
