Dynamics365 App Registration
App registration in Azure active directory and definition of an application user in Microsoft powerapps are required in order to access the Dynamics365 applications in appRules, this section describes all the steps to do so.
Create an App registration in Azure, under Azure Active Directory.
Enter an app name and set the radio button for "Any Azure AD Directory - Multi Tenant". Then set the redirect url (Callback url) to something such as http://localhost:33333, the provider's default.
Once created, copy the Application (client) ID of the new App registration. This will be used later as the Client ID.
Navigate to Certificates & secrets and click New client secret, under Client secrets.
Enter a description for the client secret (optional).
Select the expiry date for the client secret. The maximum you can select is 24 months. After the expiry, a new secret will need to be generated, and any applications using the secret will need to be updated.
Once the secret is created, copy the Value. This will be used as the Client Secret later. This is the only chance you’ll have to copy the secret, so be sure to save it somewhere safe. If you lose the value, you can always generate another later.
Navigate to API permissions and select Add a permission.
From the Request API permissions screen, under Microsoft APIs, select the Dynamics365 application (Dynamics CRM in the below example)
Under Delegated permissions, select user_impersonation, and then Add permissions.
Navigate to Application users, under Users + permissions.
Step 7: Click New app user from the list of Application users
From the Create a new app user screen, click Add an app and select the App you created earlier.
Select the Business unit to add the app user to.
Select the Security role(s) to assign to the user once created : System Administrator rôle is required to generate the metadata model (appRules Data Sources).
Click Create, and you’ll see the user has been added to your environment. You’ll also notice that the App ID is the same Application (client) ID copied in step 2
You should now have the Application ID and the Client Secret copied from step 4.
Combine these with your Environment URL, and you’ll have everything you need to grant your application access to your Dynamics 365 environment.