# Open Valstorm Microsoft 365 / Graph API Plugin (`valstorm-plugin-microsoft`) Connects **Microsoft 365 (Outlook Mail, Outlook Calendar, and Microsoft Teams Meetings)** to Open Valstorm (`platform.microsoft` / `platform.m365`) via Microsoft Entra ID OAuth 2.0 and Microsoft Graph REST API v1.0. --- ## 🤖 Agent-Assisted Quick Setup (Let the Valstorm Agent Set It Up) ### 1. Minimal Human Prerequisite Install the Azure CLI and sign in with an administrator account: ```bash brew install azure-cli az login ``` ### 2. Copy-Paste Prompt for Your Valstorm Agent ```text Set up the Microsoft 365 plugin (`valstorm-plugin-microsoft`) for my workspace using `plugins/valstorm-plugin-microsoft/README.md`: 1. Use `az ad app create` to register a Microsoft Entra ID Web App with redirect URI `/v1/microsoft/auth/callback` and delegated Microsoft Graph scopes (`User.Read`, `Mail.ReadWrite`, `Mail.Send`, `Calendars.ReadWrite`, `OnlineMeetings.ReadWrite`, `offline_access`). 2. Generate a client secret via `az ad app credential reset` and save the credentials into Valstorm via `microsoft_save_credentials`. 3. Verify the OAuth login URL and Graph API connectivity via `microsoft_verify_connection`. ``` --- ## 🛠️ End-to-End DIY Setup Guide ### Step 1: Register an App in Microsoft Entra ID (Azure Portal) 1. Go to **Azure Portal -> Microsoft Entra ID -> App registrations -> New registration**. 2. Set **Supported account types** to *Accounts in any organizational directory (Multi-tenant) and personal Microsoft accounts*. 3. Add **Web Redirect URI**: `https:///v1/microsoft/auth/callback`. 4. Under **Certificates & secrets**, create a **New client secret** and copy its `Value`. 5. Under **API permissions -> Add a permission -> Microsoft Graph -> Delegated permissions**, add: - `User.Read`, `Mail.Read`, `Mail.ReadWrite`, `Mail.Send`, `Calendars.Read`, `Calendars.ReadWrite`, `OnlineMeetings.ReadWrite`, `offline_access` ### Step 2: Save Credentials in Valstorm ```python await platform.microsoft.save_credentials( client_id="00000000-0000-0000-0000-000000000000", client_secret="your-entra-client-secret", tenant_id="common", ) ``` ### Step 3: Run Tests ```bash uv run --project apps/open-api pytest apps/open-api/tests/test_plugin_microsoft.py -v ```