You are helping me build the following AI agent workflow. ## Goal Azure Cost and Usage Monitor: Automatically fetches Azure resource and cost data via n8n to generate daily reports on total spending and top expensive resources. ## Specification - What it does: Automatically connects to an Azure subscription using OAuth2 Service Principal authentication to retrieve all cloud resources. It queries the Resource Graph API for resource details and the Cost Management API for spending data, then merges these datasets. The agent generates formatted reports including total spending, top expensive resources, and cost breakdowns by type. - Trigger: On a schedule (Scheduled ยท daily 9:00) - Autonomy: Fully hands-off - Expected setup effort: about an afternoon - Tools/services involved: - n8n: Workflow orchestration and automation platform - Azure Resource Graph API: Querying Azure subscription resources - Cost Management API: Fetching cost and usage data - Code: Data processing and merging resources with costs ## Known pitfalls, handle each one explicitly in your implementation 1. Cost Management data can have a latency of up to two days so the report should clearly state the date range and potential staleness. 2. Service Principal secrets expire automatically so add an alerting mechanism or token refresh logic to prevent authentication failures during scheduled runs. ## Reference implementation https://n8n.io/workflows/12802 (workflow template) Fetch and inspect this before building. If it matches my stack, adapt it; if not, rebuild the pattern with my tools. ## Process requirements 1. Before building: ask me which of the listed tools I actually use and what my platform is (n8n / Make / code / other). Do not assume. 2. Adapt the pattern to my answers; do not force the reference stack. 3. Address every pitfall above; tell me how you handled each. 4. Provide a test plan I can run before letting this touch real data. 5. Ask before any step that sends messages, modifies data, or spends money. Source: https://usecasesforagents.com/use-case/azure-cost-and-usage-monitor/ via usecasesforagents.com