logo
search
Others

How to Automatically Add a User to a Microsoft 365 Group on First Login

John WilsonJohn Wilson Oct 23, 2026 868 views

Question details

The user wants to automate the process of adding new users to a specific Microsoft 365 group the first time they sign in.

Automatically Add a User to a Microsoft 365 Group on First Login
Product
Microsoft 365, Power Automate, Power Apps
Device & OS
not provided
Scenario
Onboarding new users and automatically assigning them to appropriate groups or workspaces upon their initial login.
Observed behavior
Power Automate lacks a native 'first sign-in' trigger, requiring a custom workaround utilizing Power Apps and Microsoft Graph to capture the event and update group membership.
Before you start

Ensure you have Microsoft 365 administrative privileges, appropriate licensing for Power Apps and Power Automate, and the necessary API permissions to modify group memberships in Azure AD/Microsoft Entra ID.

Solution 1Recommended

Use Power Apps and Power Automate with Microsoft Graph API

Since Power Automate does not provide a standard trigger for a user's first sign-in, you can use a Power Apps login form to capture the user's ID and trigger a flow that adds them to the group via Microsoft Graph.

This workaround relies on establishing a Power App as the first point of entry for new users. When the user opens the app for the first time, it triggers a background flow that executes an API call.

1
Set up a Power Apps login form

Create a Power Apps canvas app and set it as the mandatory landing page for new users. Configure the app to automatically capture the current user's email address or User Principal Name (UPN) upon opening.

2
Create a Power Automate flow

In Power Automate, create a new flow triggered by 'PowerApps'. This will allow the canvas app to pass the captured user credentials directly to your automation workflow.

3
Configure the Microsoft Graph API call

Add an 'HTTP' action in your flow. Set the method to 'POST' and use the endpoint URI 'https://graph.microsoft.com/v1.0/groups/{group-id}/members/$ref', replacing '{group-id}' with your specific Microsoft 365 group ID.

4
Format the request body

In the HTTP action body, format the JSON payload to include the user's ID mapped from the Power Apps trigger: { "@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/{user-id}" }.

5
Link the flow to Power Apps

Return to your Power App, select the screen's 'OnVisible' property, and insert the command to run your flow, passing the User().Email as the required parameter.

Use Power Apps and Power Automate with Microsoft Graph API
API Permissions Required: Your HTTP action will require authentication. You must register an application in Azure AD (Microsoft Entra ID) and grant it 'Group.ReadWrite.All' permissions to successfully execute the Graph API POST request.
Free Microsoft Office alternative

Looking for a Lightweight Alternative to Microsoft Office?

While Microsoft 365 offers extensive enterprise automation like Power Apps and Microsoft Graph, many users simply need a powerful, easy-to-use suite for daily document creation. WPS Office provides a free, highly compatible alternative for Word, Excel, and PowerPoint files without the need for complex administrative workflows.

Fully compatible with Microsoft Office formats (.docx, .xlsx, .pptx)Free and lightweight office suite for PC, Mac, and mobile devicesIncludes built-in PDF editing, conversion, and AI writing toolsFamiliar user interface requiring zero learning curve for seamless migration
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't there a default Power Automate trigger for a user's first login?

Microsoft Power Automate relies on explicit audit logs or database events (like row creation) rather than an explicit 'first sign-in' user trigger. Using a Power App as the initial entry point is currently the most reliable workaround to capture this specific action.

Can I trigger a flow when a new user account is created instead of waiting for login?

Yes. If you do not strictly need the action to happen at first login, you can use the 'When a user is created' trigger in the Azure AD (Microsoft Entra ID) connector within Power Automate to immediately add them to a Microsoft 365 group.

What happens if a user who is already in the group triggers the Power App again?

The Microsoft Graph API will return a 400 Bad Request error stating the user is already a member. To prevent flow failures, you can add a 'Get member groups' action beforehand to check if the user is already in the group, or configure the HTTP action's 'Run after' settings to ignore the error.