{
  "name": "Monitor Azure subscription resources with cost and usage tracking and reports",
  "nodes": [
    {
      "id": "sticky-main-overview",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        240
      ],
      "parameters": {
        "width": 480,
        "height": 460,
        "content": "## How it works\n\nThis workflow connects to your Azure subscription via OAuth2 and queries two main APIs. It uses Azure Resource Graph to get all resources (VMs, databases, storage, etc.) and Cost Mana"
      }
    },
    {
      "id": "sticky-config",
      "name": "Sticky Note - Config",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        240
      ],
      "parameters": {
        "width": 340,
        "height": 180,
        "content": "## Configuration\n\nSet your subscription ID, tenant ID, and billing period dates. The workflow defaults to the current month but can be customized for any date range."
      }
    },
    {
      "id": "sticky-data-collection",
      "name": "Sticky Note - Data Collection",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1240,
        240
      ],
      "parameters": {
        "width": 340,
        "height": 180,
        "content": "## Data Collection\n\nQueries Azure Resource Graph for all resources and Cost Management API for spending data. Both calls execute in parallel for faster results."
      }
    },
    {
      "id": "sticky-processing",
      "name": "Sticky Note - Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        240
      ],
      "parameters": {
        "width": 340,
        "height": 180,
        "content": "## Processing & Reporting\n\nMerges resource data with cost information, calculates totals, identifies top expensive resources, and generates formatted text and HTML reports."
      }
    },
    {
      "id": "sticky-outputs",
      "name": "Sticky Note - Outputs",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2640,
        240
      ],
      "parameters": {
        "width": 340,
        "height": 180,
        "content": "## Output Options\n\nExport to Excel, send to Power BI dashboards, or return JSON via webhook. Enable the nodes you need (currently disabled)."
      }
    },
    {
      "id": "manual-trigger",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        820,
        680
      ]
    },
    {
      "id": "set-configuration",
      "name": "Set Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        1040,
        680
      ]
    },
    {
      "id": "query-azure-resources",
      "name": "Query Azure Resources",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1480,
        680
      ]
    },
    {
      "id": "get-cost-data",
      "name": "Get Cost Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1480,
        880
      ]
    },
    {
      "id": "merge-and-process-data",
      "name": "Merge and Process Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1920,
        780
      ]
    },
    {
      "id": "format-report",
      "name": "Format Report",
      "type": "n8n-nodes-base.code",
      "position": [
        2160,
        780
      ]
    },
    {
      "id": "check-if-data-exists",
      "name": "Check If Data Exists",
      "type": "n8n-nodes-base.if",
      "position": [
        2400,
        780
      ]
    },
    {
      "id": "output-report",
      "name": "Output Report",
      "type": "n8n-nodes-base.set",
      "position": [
        2640,
        680
      ]
    },
    {
      "id": "export-to-excel",
      "name": "Export to Excel",
      "type": "n8n-nodes-base.spreadsheetFile",
      "position": [
        2880,
        580
      ]
    },
    {
      "id": "prepare-powerbi-data",
      "name": "Prepare Power BI Data",
      "type": "n8n-nodes-base.set",
      "position": [
        2880,
        720
      ]
    },
    {
      "id": "send-to-powerbi",
      "name": "Send to Power BI",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3120,
        720
      ]
    },
    {
      "id": "respond-to-webhook",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2880,
        860
      ]
    },
    {
      "id": "no-data-found",
      "name": "No Data Found",
      "type": "n8n-nodes-base.set",
      "position": [
        2640,
        880
      ]
    }
  ],
  "connections": {
    "Format Report": {
      "main": [
        [
          {
            "node": "Check If Data Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Cost Data": {
      "main": [
        [
          {
            "node": "Merge and Process Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Output Report": {
      "main": [
        [
          {
            "node": "Export to Excel",
            "type": "main",
            "index": 0
          },
          {
            "node": "Prepare Power BI Data",
            "type": "main",
            "index": 0
          },
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Set Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Configuration": {
      "main": [
        [
          {
            "node": "Query Azure Resources",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Cost Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If Data Exists": {
      "main": [
        [
          {
            "node": "Output Report",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Data Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Power BI Data": {
      "main": [
        [
          {
            "node": "Send to Power BI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Azure Resources": {
      "main": [
        [
          {
            "node": "Merge and Process Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge and Process Data": {
      "main": [
        [
          {
            "node": "Format Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}