Service Principal in Power automate

Service principal decouples the flow from the user. So it removes the dependency between the flow and user. If user is inactive or deleted flow will not be affected.

Steps to use service principal in your flows.

First Register app in azure portal

Second click on new connection reference

Third , connect with service prinicipal and provide the details from your azure portal

Click Create

How to Register your App in Azure Active Directory and create Application user

Need to register the app and application user is required for server-to-server authentication

An enterprise can create a web application or service to connect to any Dataverse environments associated with a single Azure Active Directory (Azure AD) tenant.

Navigate to https://portal.azure.com . Open Manage Azure Active Directory

Under the manage tab locate App Registration

Click on App Registration

Click on New Registration

Provide the details such as APP name , who can use this application and redirect uri is optional you can leave it as blank

After you have Clicked Register. Your App would be created. Copy the application (client id) mention as below and save it somewhere will need it to create application user

Go API Permission

Click on Add Permission

Select Dynamics CRM

Click on Grant Admin Consent

Click Yes

Now got Certificate & Secrets

Click New client secret. Provide Description and Expires in

Client secrets will be generated. Copy those values and save it. Will need it in future.

Now you need to Register the Application user in Dynamics CRM

Navigate to Setting -> Security -> Users. Change the view to application user.

Create New Application user

Switch Form to Application user

Enter the application ID of your app created in Azure and click save.

If there goes well all others fields will be populated

Before exiting the user form, choose MANAGE ROLES and assign a security role to this application user so that the application user can access the desired organization data.

At this stage we are done with registering the app in azure AD and creating the application user for same.

Note : In an environment, only one application user for each Azure AD registered application is supported. You will not be able to change the primary email address or username once the application user is created.