Power Automate and Power BI Rest API
The Power BI rest api provides the ability to create a workspace. Power Automate includes an action to make a HTTP call, i.e. a rest api. So we should be able to get a flow to create a workspace. So that was my goal. Writing the first flow and getting it to work involved so many little steps I had to write blog posts so I would remember the steps.
Power BI Rest API Documentation
The documentation refers to workspaces as groups and can be found at https://learn.microsoft.com/en-us/rest/api/power-bi/groups/create-group. It states that the API can be called by a service principal profile and the required scope is Workspace.ReadWrite.All.
Other Settings
You also need to make some changes to Power BI tenant settings as well and I’d recommend creating a security group and using Azure Key Vault to store the credentials. That would make a very long blog post so I’m breaking it down into separate posts.
- Create a Power BI Service Principal Profile
- Create Key Vault to store Tenant ID, Client ID and Secret
- Write a flow to fetch the Key Vault Values
- Create a Security Group
- Update Power BI Settings
- Write a flow to create the workspace
- Extras for the workspace
Note This is a work in progress. I will be adding posts in the next few weeks – nag me if nothing is added!
Final Power Automate Flow
The final flow fetches the Service Principal credentials using a child flow, then uses HTTP action to create the workspace and finally another HTTP action to change the permissions.
Next Steps
Now we understand setting up a Service Principal and using it in a HTTP action we can look at other possibilities with the rest api and at other places we could use the rest api such at documenting what workspaces exist in a tenancy. These posts will follow.
…
1 Response