How to grant Magento 2 the permissions to access the Dynamics 365 Web API?

The manual is based on the following official Microsoft documents:

Step 1

Go to the Microsoft Azure Active Directory interface.

Step 2

Open the «App registrations» section:

Step 3

Click the «New application registration» button:

Step 4

  1. Fill the «Name» field (with any value).
  • Specify the «Web app / API» value in the «Application typeI» field.
  • Fill the «Sign-on URL» field with the value from the «General» → «OAuth 2.0» → «Redirection Endpoint» field of the Magento 2 extension’s settings.
  • Press the «Create» button.

Step 5

Click the created application:

Step 6

  1. Click the «All settings» button.
  • Click the «API ACCESS» → «Required permissions» menu item on the right («Settings») pane.

Step 7

  1. Click the «Add» button on the «Required permissions» pane.
  • Click the «Select an API» button on the «Add API access» pane.

Step 8

  1. Choose the «Dynamics CRM Online» option on the «Select an API» pane.
  • Press the «Select» button.

Step 9

  1. Switch to the «Select permissions» tab.
  • Enable the «Access CRM Online as organization users» option on the «Enable Access*» pane.
  • Press the «Select» button.

Step 10

Press the «Done» button.

Step 11

  • Click the «API ACCESS» → «Keys» menu item on the «Settings» pane.
  • Add a key:
    • Set any value in the «DESCRIPTION» field.
    • Set the «Never expires» value in the «EXPIRES» field.
  • Press the «Save» button.

Step 12

  • Put the Application ID to the «General» → «OAuth 2.0» → «Client Identifier» field of the Magento 2 extension’s settings.
  • Put the API Key to the «General» → «OAuth 2.0» → «Client Password» field of the Magento 2 extension’s settings.

.