In the Export Salesforce Account Details to Microsoft Dynamics CRM scenario, you work with the Microsoft dynamics CRM connector, which requires you to get an access token. If you do not have this, do the following.
Sign up for a Dynamics 365 trial account
- Go to the Dynamics 365 page. Let's set up a trial account for the purpose of this example.
- Fill in the form that opens and click Next.
- Give a username in the format email@example.com and a password and click Create my account. You will use this username to sign in to the new trial account.
- Give a valid mobile phone number to which Microsoft can send you a verification code and click Text me.
- Enter the verification code that you received and click Next.
- Once your request is processed, click Set up.
- On the following page that opens, check the None of these. Don’t customize my trial. option and click Complete Setup.
Sync CRM Online with Azure Active Directory
Log in to Azure, navigate to Active Directory, and click New -> Directory -> Custom Create.
Select the Use existing directory option from the DIRECTORY drop-down list, check the option that asks you to sign out now, and then click Continue.
Close the browser and log in again with your Dynamics 365 credentials. When asked whether to use your directory with Azure, click continue , and then Sign out now.
Close the browser, reopen the portal and login with your existing Azure credentials. Otherwise, you will get an access-denied error.
Navigate to the Active Directory node and, under Directory , you should now see your Dynamics CRM Online listed.
Register the APP in Azure AD and generate an App ID
- Log in to Azure and navigate to Active Directory.
- Click the
APPLICATIONStab, open your directory, and click the Add icon at the bottom of the screen.
- Click Add an application my organization is developing.
- Give an application name and select
WEB APPLICATION AND/OR WEB API.
Give a sign-on URL (e.g, https://localhost:9443/commonauth) and an App ID URI.
Tip: The App ID URI is a unique identifier for Azure AD to identify your app. Give should be unique to your organization’s Azure AD.
For example, if your organization’s Mail ID is testUser@wso2xyz.onmicrosoft.com, then the App ID URI can be something like .
Once the application is successfully added, the Quick Start page opens. Click Configure in the top menu.
- In permissions to other applications , click Add application and then Add Dynamics CRM Online and then click the check mark icon.
- Under permissions to other applications, click the Delegated Permissions drop-down for Dynamics CRM Online and select the option that allows to access CRM Online as organization users.
- Click Save in the bottom menu.
Get an access token and a refresh token
Replace the <your_client_id> and <your_redirect_uri> in the following URL with the app values that you created earlier and access the URL using your web browser.
- Note that the browser redirects you to the call-back URL (redirect URI) of the client application. For example,
Extract the authorization code from the redirect URL and send the following POST request to the authorization server. Be sure to replace the placeholders with the actual values of your created app.
- Note that you can get the access token and refresh token for Microsoft Dynamics CRM in the response.