Use a Service Principal to run Dataverse actions in Power Automate
What is a Service Principal?
In my previous article, Set up Service Principal in Azure to work with Power Platform, I discussed this topic. Please go and check it out! It not only discusses the Service Principal and (Azure App Registration) topic as a whole, but it also explains how you can set up a Service Principal yourself in your Microsoft 365 tenant.
Today, I will briefly explain the essence of a Service Principal in Power Platform mentioned in a previous article.
Service Principal - this is a series!
Hey! This is a series of three articles regarding a Service Principal.
- Set up Service Principal in Azure to work with Power Platform – this article shows you how to set up an App Registration in Azure to work with Power Platform
- Own and run Power Automate flows with Service Principal – this article, on the other hand, discusses how to register a Service Principal in Power Platform and how to own and run flows in Power Automate
- Use a Service Principal to run Dataverse actions in Power Automate – the last one of the series discusses how Dataverse actions can run with a Service Principal so users don’t need to use their personal accounts to authenticate.
Service Principal in Power Automate
In Power Automate, you can only work with a Service Principal with a Dataverse connector. Today, we can utilize this connector because Microsoft supports only this one.
I will show you how to work with an already registered Power Platform Service Principal and a Dataverse connector!
Let’s jump straight into it.
Create a Power Automate flow
Obviously, we need a Power Automate flow, so let’s create one!
We will create a simple “Instant cloud flow”. Now, let’s just add a Flow name and hit “Create”.
As you remember, we want to check how the Dataverse connector works with a Service Principal, so let’s add a simple Dataverse action! I chose the “List Rows” action.
Connect to the Dataverse with a Service Principal
At this moment, we must create a connection to a Dataverse using our Service Principal. To achieve this, press “. . .”, and then “+Add new connection”.
Click the “Connect with service principal” link shown in a popup.
Alright. Let’s stop here for a second. What do we need to authenticate with a Service Principal?
- Connection name (just think of a name for this connection)
- Client ID (from Azure App Registration)
- Client Secret – this is a Secret that is created for the App Registration and allows you to authenticate with a Service Principal in Power Automate
- Tenant – this is a tenant ID, which we get from the App Registration overview information.
Get the information about the Service Principal from Azure
In the previous articles, I showed you how to create an App Registration in Azure. When we have it completed, let’s create a Secret allowing us to authorize the access with a Service Principal.
To do this, click the “Certificates & secrets” button, like I did here:
Got it? Perfect! Click “+ New client secret”.
Provide a name for your secret and click “Create”.
A newly created secret will be shown at the bottom.
Remember to copy the secret’s Value! It’s super important, we will need it.
Alright. We have a first parameter for our connection – A Client Secret.
Now, we need the Application (Client) ID and Tenant ID. To get it, go to the “Overview” tab of the App Registration and copy the values.
Finalize the connection to the Dataverse
You have all the needed elements to connect to Dataverse with a Service Principal. Copy and paste them to the appropriate fields in Power Automate and press the “Create” button.
If everything is fine, you should see your connection in a popup:
Test the flow and happy working with a Service Principal
Finally, make a small test run and verify if everything works as planned. As you can see, my flow runs perfectly, and now, I can run all the Dataverse actions across my environment! It’s super easy.
Remember to provide appropriate permissions to a Service Principal, so it can work with tables in Dataverse.
This article concludes the three articles regarding Service Principal and how to work with it with Power Platform. I hope you learned something from that. I hope many more connectors will be supported for Service Principal so Users can run Power Automate flows without using their personal accounts. It’s a severe problem, and I am getting a lot of questions from Makers if there is a better solution to this problem. Unfortunately not.
So, we are at this point where I should thank you for your time and for reading this article. Feel free to rate this article and comment if you liked it. If you have any questions, feel free to contact me (via email@example.com), but first, you may be interested in joining a Newsletter. Hmm? (Sign up here) If you already did, wow, thanks, thanks a lot
Via Newsletter, I am sharing insights into my work, plans for upcoming weeks, and knowledge about Power Platform Universe and the IT world. If you are interested, feel free to join! I am going to send the latest Newsletter to everyone who enters!
I am a Senior Power Platform Consultant focused on Dataverse, Power Apps, and Power Automate. I was also a Team Leader responsible for the Power Platform Team and their development paths.
In my private life, I like video games, sports, learning & gaining knowledge, and a taste of good Scotch Whisky!
Ooo, I almost forgot, I love our Polish Tatra Mountains!
In this article I will tell you what is the difference between connection and connection reference in Power Platform. It is very good to know the advantages.
Do you want to learn how to use a Service Principal to work with Dataverse actions in Power Automate? This article is for you. Check it out.
What is Service Principal? How to own and run flows with Service Principal. All this questions are answered in today’s article. Check it out.
Do you know how to create Service Principal in Azure? In this article I am going to show you how you can set it up in Azure yourself.