# dolevshor/azure-orphan-resources architecture

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

- Interactive diagram: https://gitdiagram.com/dolevshor/azure-orphan-resources
- Repository: https://github.com/dolevshor/azure-orphan-resources

## Overview

##### Project type and purpose
- It ships as a JSON workbook that you import into **Azure Workbooks** in the Azure Portal. Under the hood it runs **Azure Resource Graph** queries and (optionally) issues ARM delete actions.

##### File structure
- Top-level directories:
- Docs/ – integration and how-to documentation
- Queries/ – Kusto Resource Graph queries (orphan-resources-queries.md)
- Workbook/ – the actual workbook files:
- “.workbook” – gallery-compatible export you import into Azure
- No backend code, no database; everything is client-side in Azure.

##### README for additional insights
- Explains the import process via the Azure Portal (Advanced Editor → paste JSON → save).

##### Elements
- User → Portal UI → Workbooks service
- Workbooks service → Resource Graph → returns data → service → UI
- Workbooks service → ARM → resource deletion → Resource Graph refresh
- Gray rectangles for local artifacts (Docs/, Queries/, Workbook/)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User
    User["Azure Administrator"]:::user

    %% Azure Portal and Services
    PortalUI["Azure Portal UI"]:::azure
    WorkbooksService["Azure Workbooks Service"]:::azure
    ResourceGraph["Azure Resource Graph Service"]:::azure
    ARMAPI["Azure Resource Manager REST API"]:::azure

    %% Local artifacts
    subgraph "Local Artifacts"
        Docs["Docs/"]:::local
        README["README.md"]:::local
        License["LICENSE"]:::local
        Queries["Queries/"]:::local
        RawJSON["Workbook JSON Template"]:::local
        WorkbookExport["Gallery-compatible Workbook"]:::local
    end

    %% Data Flows
    User -->|"opens workbook"| PortalUI
    PortalUI -->|"loads template"| WorkbooksService
    Docs -->|"docs source"| WorkbooksService
    README -->|"overview & instructions"| WorkbooksService
    Queries -->|"query definitions"| WorkbooksService
    RawJSON -->|"workbook panels & UI"| WorkbooksService
    WorkbookExport -->|"importable template"| WorkbooksService

    WorkbooksService -->|"executes queries"| ResourceGraph
    ResourceGraph -->|"returns data"| WorkbooksService
    WorkbooksService -->|"renders results"| PortalUI

    PortalUI -->|"click delete"| WorkbooksService
    WorkbooksService -->|"ARM delete calls"| ARMAPI
    ARMAPI -->|"deletion confirmation"| WorkbooksService
    WorkbooksService -->|"refresh via RG"| ResourceGraph
    ResourceGraph -->|"updated data"| PortalUI

    %% Click Events
    click Docs "https://github.com/dolevshor/azure-orphan-resources/blob/main/Docs/integrations.md"
    click README "https://github.com/dolevshor/azure-orphan-resources/blob/main/README.md"
    click License "https://github.com/dolevshor/azure-orphan-resources/tree/main/LICENSE"
    click Queries "https://github.com/dolevshor/azure-orphan-resources/blob/main/Queries/orphan-resources-queries.md"
    click RawJSON "https://github.com/dolevshor/azure-orphan-resources/blob/main/Workbook/Azure Orphaned Resources v3.0.json"
    click WorkbookExport "https://github.com/dolevshor/azure-orphan-resources/blob/main/Workbook/Azure Orphaned Resources v3.0.workbook"

    %% Styles
    classDef user fill:#a3e635,stroke:#65a30d,color:#065f46,stroke-width:2px;
    classDef azure fill:#60a5fa,stroke:#1e40af,color:#1e3a8a,stroke-width:2px;
    classDef local fill:#e5e7eb,stroke:#6b7280,color:#374151,stroke-width:2px;
```
