Try WSO2 Cloud for Free
Sign in

All docs This doc
Skip to end of metadata
Go to start of metadata

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

  1. Go to the Dynamics 365 page. Let's set up a trial account for the purpose of this example.
  2. Fill in the form that opens and click Next.
  3. Give a username in the format and a password and click Create my account. You will use this username to sign in to the new trial account.
  4. Give a valid mobile phone number to which Microsoft can send you a verification code and click Text me.
  5. Enter the verification code that you received and click Next.
  6. Once your request is processed, click Set up.
  7. 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

  1. Log in to Azure, navigate to Active Directory, and click New -> Directory -> Custom Create.

  2. 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.

  3. 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.

  4. Close the browser, reopen the portal and login with your existing Azure credentials. Otherwise, you will get an access-denied error.

  5. 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

  1. Log in to Azure and navigate to Active Directory.
  2. Click the APPLICATIONS tab, open your directory, and click the Add icon at the bottom of the screen.

  3. Click  Add an application my organization is developing.

  4. Give an  application name and select WEB APPLICATION AND/OR WEB API .

  5. 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, then the App ID URI can be something like .

  6. Once the application is successfully added, the Quick Start page opens. Click  Configure in the top menu.

  7. In  permissions to other applications , click  Add application and then Add Dynamics CRM Online and then click the check mark icon.

  8. 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.
  9. Click  Save in the bottom menu.

Get an access token and a refresh token

  1. 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.<YOUR_CLIENT_ID>&redirect_uri=<YOUR_REDIRECT_URI>&response_type=code
  2. Note that the browser redirects you to the call-back URL (redirect URI) of the client application. For example,
  3. 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.

    Content-Type : application/x-www-form-urlencoded 
    grant_type = authorization_code 
    code = aWe...c4w%3D%3D 
    redirect_uri = <YOUR_REDIRECT_URI>
    client_id = <YOUR_CLIENT_ID> 
    client_secret = <YOUR_ CLIENT _SECRET> 
    resource = <YOUR_RESOURCE>
  4. Note that you can get the access token and refresh token for Microsoft Dynamics CRM in the response.
  • No labels