This article assumes you already have a working Dynamics 365 application and a Betty Blocks application ready for use.

  1. Login to Azure Portal ( Use the same credentials as your Dynamics account, if it asks you to sign up and setup trial, you can do that)
  2. Once you have logged in, Navigate to the option “Azure Active Directory” and click on “App registration

  1. Click on “New application registration”.
  2. Add the name of the application and select the Application type as “Web App / API”.
  3. In the Sign-ON URL field enter the following URL: https://<appname>.bettyblocks/oauth2/callback

  1. It will take some and create the application for you ( Note down the Application ID , you would need it when connecting to Dynamics).
  2. Click on the Settings from the application created and then on Required Permissions:

  1. Now Click on Add.
  2. Select Dynamics CRM Online from Drop Down and click on select:

  1. It will move to the next step “Select Permissions“, select the “Access Dynamics CRM as organization users” option and click on Select again.

  1. Click on Done. It will take some time.
  2. Next thing that we need is a API key. Open the Settings -> API ACCESS -> Keys. 
  3. Enter a Description and fill the Expires fields.

  1. Copy the generated key value. You won't be able to retrieve it later.
  2. This part is done! The setup is completed , now you can use this app’s Application ID as a Client ID in your Betty Blocks application.
  1. Now create a new webservice in your Betty Blocks application. The host field is <add your environment name, like ‘myorg.crm’>.dynamics.com.

  1. After saving the webservice, open the generated authentication settings. Give the authentication a friendly name, use these settings:
  2. Authorization uri: https://login.microsoftonline.com/common/oauth2/authorize?resource=https://<add your environment name, like ‘myorg.crm’>.dynamics.com
  3. Token credential uri: https://login.microsoftonline.com/common/oauth2/token
  4. Client: the application ID that we previously wrote down.
  5. Client secret: the generated password that we previously wrote down.

  1. After saving the authentication, press 'Connect'. You will be redirected.
  1. Press 'Accept'. If everything is OK you will be redirect back to your Betty Blocks application.

  1. With our authentication in place we can go back to our webservice definition and add a test endpoint. We will create a GET endpoint to fetch all the accounts in our Dynamics CRM. We use the path '/api/data/v9.0/accounts'. 

  1. After saving the endpoint we can use the 'Run test' button to make sure that everything works as expected.

  1. Luckily everything works fine! We successfully fetched all the accounts in our Dynamics CRM.
  2. To do something with the result of the webservice you can follow the general webservices tutorial.
Did this answer your question?