Sync Azure Active Directory User to Dynamics 365

Force Sync Azure Active Directory User to Dynamics 365
Facebook
Twitter
LinkedIn

When we create a user in Azure Active Directory, then we need to wait for about 1 hour to 1 day to sync into the Dynamics 365 Enabled users. It can even take longer in some cases. In our scenario, we created our users in Azure Active Directory, and it took longer. Then I decided to share the solution with you that how can we sync users from Azure Active Directory to MS Dynamics 365.

First of all you should perm the following steps.

Please verify that an appropriate license is assigned to the user.

Remove the security groups from the environment and assign them again – In this way it will trigger sync.

Remove the license from the users and assign it back – it will trigger the sync.

There are two ways to to achieve it.
  1. By using Cloud flow
  2. By Power Shell cmdlet

We will discuss both methods.

First, we will discuss that how we can create a cloud flow to sync the users to dynamics 365 and then I will show you how we can use the cmdlet to sync the users.

By Using Cloud Flow:

Prerequisite: Create the user in the Azure Active Directory

Step 1: Please create the user in the azure active directory. I have already created a user in the Azure Active Directory as you can see in the picture below.

Force Sync Azure Active Directory User to Dynamics 365

 

Step 2: Create a Manually Trigger a Flow

Step 2 Create a Manually Trigger a Flow

Step 3: Please add the Force Sync User Action

When we create a user in Azure Active Directory (3)

In this action we will provide the Environment Id and User Object Id that we have already copied from the Azure.

Step 4: The final Flow will look like this.

When we create a user in Azure Active Directory (4)

Step 5: After running this flow, We can cleary see that the user is already synced with the Dynamics 365 environment.

When we create a user in Azure Active Directory (5)

 

By using cmdlet

Now we will discuss the second method of syncing the users in ms dynamics 365 crm.

For this we will run some commands in Power Sheel. I will immediately sync the users.

For this, we need to install the Power Shell Module

Step 1:

Install the Power Shell Administration Module

Power Shell Administration Module

For the connection we will use one of the following methods.

  • Using Username and Password

  • Using Tenant Id, Client Id and Certificate Thumbprint

-ApplicationId “”

  • Using Client Id, Tenant Id, Client Secret

Here we will need the Environment Name and Guid as well. That we will get by the following command.

This command will give the list of environments in the current org.

We also need the Object Id of the user that we want to synchronize. For that we will go to the Azure Portal.

https://portal.azure.com/

Then go to the Azure AD and then Users.

NOTE: Here EnvironmentName is the Guid of the environment and PrincipalObjectId is the User Object Id that we copied from Azure AD User.

After getting this information, we will run this command

So, after executing this script user will be synced to your Dynamics 365 environment.

Conclusion:

Syncing users in Microsoft Dynamics 365 CRM can be efficiently achieved using PowerShell cmdlets. By installing the PowerApps Administration Module and establishing a connection to the environment, administrators can synchronize users promptly. The process involves obtaining necessary information such as Environment Name, GUID, and User Object ID from Azure Portal, and then utilizing the Add-AdminPowerAppsSyncUser cmdlet to trigger synchronization. This method provides administrators with a convenient and reliable way to ensure user visibility within the Dynamics 365 environment.

FAQs:

Why are users not appearing in Dynamics 365 CRM after assigning licenses or adding them to Azure AD Security Groups?

Users may not appear immediately due to synchronization delays between Azure AD and Dynamics 365 CRM. This delay can occur for various reasons, such as backend processes or network issues. Utilizing PowerShell cmdlets to force synchronization can resolve this issue.

Can I sync multiple users simultaneously using PowerShell cmdlets?

Yes, PowerShell cmdlets provide the capability to sync multiple users at once. Administrators can obtain the Object IDs of multiple users from Azure AD and use a loop or batch process to sync them to the Dynamics 365 environment efficiently. This approach saves time and effort, especially in scenarios where numerous users need synchronization.