Microsoft Dynamics 365 Modules
Modules Covered
- Microsoft Dynamics Create Record
- Microsoft Dynamics Get Record
How to register an App for Dynamics/Dataverse
Introduction
This guide will guide you through the process of registering an App for Dynamics/Dataverse and get the credentials you will need to complete the Oauth setup to get the token.
Register your application
Note: To be able to complete the registration you must be an Azure Active Directory Admin
The first part is to register your app in Azure Portal under Azure Active Directory following the below steps.
First login to Azure Portal and then navigate to Azure Active Directory
Now click on the App registrations and then click on New registration
Next step is to give your App a name, set access and Redirect.
When the App has been created you can find the Application (Client) Id from the overview page. Copy the Client Id, you will need it later when setting up your OAuth credentials
Now go to the Manifest tab and in the manifest editor, set the allowPublicClient property to true and click on Save.
Next step is to add permissions to the newly created App.
This is done from API permissions and then click on Add a permission
Select APIs my organization uses tab and then choose or search for Dataverse
Click on Delegated permissions and check the options and click on Add permissions.
Create Client Secret
Now when the App is created the next step is to generate a Client Secret. Follow below steps to create your Client secret and finalize your OAuth credentials
Click on Certificates & secrets and then New client secret
Enter a description for the Client secret and select expiration date, click Add to add your Client secret
When you have created your client secret make sure you copy it so you can use it later when adding your credentials in Crosser.
Next step is to set up a Dataverse Application User that is connected to the app you created above. This app user is a fictional user account that will be performing the API operations on your real account's behalf without the need for interaction from a real user.
See this link to see how it is done: https://docs.microsoft.com/en-us/power-platform/admin/manage-application-users#create-an-application-user
Note: Make sure you assign the correct security roles to the application user, otherwise you will run into errors along the lines of "Principal user [...] is missing prvCreateAccount privilege [...] for entity ..." when using this module.
Authentication
You need an OAuth Client Credential that corresponds to the above mentioned app.
In the New Credential dialog box, fill in this info:
- Type: OAuth Client Credential grant
- Authentication URL: https://login.microsoftonline.com/<Your Tenant ID>/oauth2/v2.0/token
Where Tenant ID looks something like dad3d13-d1d1-d1d1...
It is found by navigating to portal.azure.com. Your Tenant ID is listed under "Basic Information." - Client ID: <client id> (sometimes called "App ID") - Use the client ID value you copied in the steps above when creating the App
- Client secret: <client secret> - Use the client secret value you copied in the steps above when creating the App
- Scope: <Environment URL>/.default
Where <Environment URL> looks like https://xxxxxxxxxxx.crm4.dynamics.com
It is found by navigating to admin.powerplatform.microsoft.com and clicking the environment that you wish to interact with using this module (e.g. "Sales").
The Environment URL is displayed in the "Details" box. Enter it as is, without changing it. - Token renewal URL: <leave blank>