🔹 Overview
Microsoft Graph API allows you to access Microsoft 365 services and data (e.g., Outlook, SharePoint, Teams, OneDrive, Azure AD) through a unified API. By integrating Power Automate with Microsoft Graph API, you can automate tasks like:
Managing users and groups in Azure AD
Automating emails, calendars, and contacts in Outlook
Managing files and folders in OneDrive/SharePoint
Automating Microsoft Teams messages, channels, and meetings
1️⃣ Prerequisites for Using Microsoft Graph API in Power Automate
Before integrating Power Automate with Microsoft Graph API, ensure you have:
A Microsoft 365 account
Admin access to Azure AD (for app registration)
Power Automate license
API permissions to access Graph services
2️⃣ Steps to Integrate Power Automate with Microsoft Graph API
Step 1: Register an App in Azure AD
To authenticate Power Automate with Microsoft Graph API, you need to create an Azure AD App.
- Go to Azure AD → Open Azure Portal
- Navigate to “App registrations”
- Click “New Registration”, enter a name, and select:
- Accounts in this organizational directory only
- Redirect URI:
https://global.consent.azure-apim.net/redirect
(for Power Automate)
- Click “Register”
Step 2: Generate Client Secret and Grant Permissions
- Open your registered app → Certificates & secrets
- Click “New client secret”, set expiration, and copy the Client Secret Value
- Navigate to “API Permissions” → “Add Permission”
- Select “Microsoft Graph” → Choose Delegated or Application Permissions
- Click “Grant admin consent”
Step 3: Create a Power Automate Flow
Now, we create a flow to connect to Microsoft Graph API using HTTP requests.
Example: Get User Details from Azure AD
1️⃣ Trigger: Choose a trigger like “Manually trigger a flow”
2️⃣ Action: Add “HTTP” action
3️⃣ Configure HTTP Request:
- Method:
GET
- URI:
https://graph.microsoft.com/v1.0/users
- Headers:
{ "Content-Type": "application/json", "Authorization": "Bearer <access_token>" }
Step 4: Authenticate Power Automate with Microsoft Graph API
To authenticate Power Automate:
- Use the “Invoke an HTTP request” connector
- Select “OAuth 2.0” authentication
- Enter Tenant ID, Client ID, and Client Secret from Azure AD
- Run the flow to test the connection
3️⃣ Common Use Cases of Microsoft Graph API in Power Automate
Use Case | Graph API Endpoint | Description |
---|---|---|
Get User Details | /users/{user-id} | Fetch user profile information |
List All Users | /users | Retrieve all users in Azure AD |
Send an Email | /me/sendMail | Send an email from Outlook |
Create a Teams Message | /teams/{team-id}/channels/{channel-id}/messages | Post a message in a Teams channel |
Get OneDrive Files | /me/drive/root/children | Fetch files from OneDrive |
Create a SharePoint List Item | /sites/{site-id}/lists/{list-id}/items | Add an item to a SharePoint list |
4️⃣ Best Practices for Using Microsoft Graph API in Power Automate
Use the right permissions: Only grant required API permissions to enhance security.
Use Application Permissions for Background Tasks: Delegated permissions need a signed-in user, while application permissions work without user login.
Monitor API Limits: Microsoft Graph API has rate limits; avoid excessive requests in a short time.
Secure Client Secrets: Store secrets securely in Azure Key Vault instead of embedding in Power Automate.
Use Graph Explorer: Test API requests in Microsoft Graph Explorer before adding them to Power Automate.