CRM Crate

How to force sync an user in Dynamics 365 using PowerShell script?

We will learn to force sync an Azure Active Directory or Microsoft Intra ID user in Dynamics 365 using PowerShell script. Before we start, make sure to subscribe to CRM Crate so that you can stay up to date in the field of Power Platform.

How to force sync an user in Dynamics 365 using PowerShell script

In Dynamics 365 Customer Engagement, user and team management encompasses the creation of users & profiles. A user within Dynamics 365 CE refers to an individual employed by a business unit utilizing the platform. Each user is assigned a user account and is required to be affiliated with a singular business unit. This affiliation dictates the specific customer data accessible to the user.

The user’s account comprises details like telephone numbers, email address, and a link to the user’s manager. Every user possesses privileges and rights to administer their personal settings. Each user aligns with a corresponding user in the Active Directory specific to the organization.

 When you create a user, you must assign the user to at least one security role. Even if the user is part of a team that has assigned roles, the user should be assigned to a role.

When we create an user in Azure AAD / Entra ID, they are not synced to Dynamics 365 CE in Realtime. We can use the below solution to force sync users from Azure AAD / Entra ID to Dynamics 365 in realtime.

Syncing & creating users in Dynamics 365 with PowerShell

The below given solution enables you to sync users in Dynamics 365 Customer Engagement in a synchronous fashion (Realtime).

Installing PowerShell for Power Platform Administrators

Follow the below procedure to install PowerShell for Power Platform administrators in your local machine.

  1. Run PowerShell as an administrator.
  2. Import or update the necessary module by using one of the following commands:
    PowerShell Command: Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
  3. Run the below command if you do not have Administrator rights in your local machine.
    PowerShell Command: Save-Module -Name Microsoft.PowerApps.Administration.PowerShell -Path Import-Module -Name Microsoft.PowerApps.Administration.PowerShell
  4. If you receive a prompt to confirm the modification to the InstallationPolicy value of the repository, acknowledge [A] Yes to All modules by entering ‘A’ and pressing Enter for each module.

PowerShell scripts for creating user in Dynamics 365 CE

Below is the PowerShell scripts which you can use for force synchronizing users in Microsoft Dynamics 365 Customer Engagement.

In this demonstration, we will forcefully sync a newly created user named “Pooja Prashant Tirlotkar” in Dynamics 365.

  1. Configure the PowerShell cmdlet as per the instruction given above.
  2. Collect the environment ID and user’s principal ID from Power Platform Admin portal & Microsoft Admin Portal.
  3. Run the PowerShell command as given in the above instruction.
  4. Open your Dynamics 365 CE environment, and you will observe that a new user is automatically created over here.
user sync dynamics 365

In conclusion, force syncing users in Dynamics 365 is a crucial administrative action that ensures the accurate and up-to-date representation of user information within the system. By triggering a synchronization process, administrators can promptly reflect changes in user details as per the requirement.

5 1 vote
Article Rating
Notify of
Newest Most Voted
Inline Feedbacks
View all comments
error: CRM Crate Security Engine - Disabled Right Click & Selection!


Well Done,
Welcome to CRM Crate

Stay tuned with us and get all latest updates and learning in Microsoft CRM and related techonologes.