Using an Azure Service Principal for Power Platform connections
Create an App Registration, assign a secret password, assign permissions, and use it in a Power Automate workflow to connect to Dynamics.
When connecting to external sources, like Dynamics from Power Automate or Power Apps, by default it will use the account that created the connection. For example, if your creating a Flow with your own account, the flow will connect to these data sources using your account.
An alternative is to create a separate user account that has access to these data sources and when creating our connections, use that account instead of our own.
However, the reliable and secure way to handle this is to use an Azure App Registration. The App Registration is given the permissions it needs in the external data sources, without being a licensed user.
This post provides the steps to create an App Registration, assign a secret password, assign permissions, and use it in a Power Automate workflow. [1]
Unfortunately, this doesn't work with SharePoint (yet). We can configure the App Registration with access to SharePoint, but there is not an option to connect to SharePoint using a Service Principal, like we can with Dynamics.
Create the App Registration
- Log into Azure Portal.
- Open App Registrations.
- Create a new registration.Give it a name and leave the defaults.
Configure API Permissions for Dynamics CRM
- From the new App Registration, click API Permissions.
- Select
Add a permission
. - Select Dynamics CRM.
- Select
Delegated permissions
. - Check the
user_impersonation
permission. - Click the
Add Permissions
button. - While on the
API Permissions
page, clickGrant admin consent for Abel Solutions Demo
. Choose yes, to confirm.
Give the App Registration a secret password.
- From the new App Registration, click
Certificates & Secrets
. - Select
New client secret
. Give it a description and expiration. - Copy the Value and Secret ID (you will not be able to get to them later).
Add the new App Registration to Power Platform
- Go to the Power Platform Admin Center and open the environment that will be using this App Registration.
- From the environment screen, select
Settings
. - Expand
Users + Permissions
and selectApplication users
. - Click
New app user
thenAdd an app
. - Select the App Registration you created earlier.
- Click Add.
- Select the Business Unit.
- Add the System Administrator Security Role.
- Click Create.
Use the App Registration in Power Automate
- Open your Flow.
- Add a Dataverse Action.
- Click the
...
then+ New connection reference
. - Instead of signing in, click the link
Connect with service principal
. - Enter the Connection Name.
- Paste the Client ID (found on App Registration Overview screen).
- Paste the Client Secret (Copied earlier).
- Paste the Tenant ID (found on App Registration Overview screen).
Matthew's post "A Visual Guide to Power Platform Service Principal Setup" was a big help when setting this up. ↩︎