Forum Discussion
Unknown Error when calling the initializeConnection Fabric Git API endpoint with a service principal
- 1 year ago
With some great help from Microsoft we finally figured out the solution. It was a combination of three items that we had to solve. The first item was in the Fabric Admin Portal. We had to enable the following setttings:
- Service principals can access read-only admin APIs
- Service principals can access admin APIs used for updates
In addition these settings the second item that is required is that you put your service principal into an Entra AD group:
The second thing we had to do was reconfigure our service principal setup in the app registration. In my own troubleshooting I had added several Fabric/PowerBI related API permissions. As mentioned in this document: Embed Power BI content with service principal and an application secret
These permissions are no longer needed once you enable the Fabric API setting and in fact can cause issues. See this callout:
The solution was to remove all of the permissions besides the default one you get when you create an app registration:
After doing these 3 steps we are now able to sync our workspaces with GIT via a service principal inside of GitHub Actions workflow. As a bonus it also supports using federated credentials instead of having to rely on a client secret!
Hi there,
1. Yes the service principal has admin permissions on the workspace. I know that permission is good since I am able to call the connect/disconnect endpoints which require admin permissions in the workspace.
2. It is an Azure Entra App Registration. Currently it has the the following delegated permissions:
- Workspace.GitCommit.All
- Workspace.GitUpdate.All
- Workspace.ReadWrite.All
Additionally in the GitHub action I have the following:
permissions:
id-token: write
contents: write
Are there additional permissions I need here?
3. Running with verbose/debug doesn't give any more info around the specific error.
4. initializeConnection works just fine as long as I use my personal user via az login instead of using the service principal.
Here is the response that I get:
Hi ckingdon_bee ,
Please try the below additional steps
- Add additional permissions as well in Azure Entra App Registration Workspace.GitAdmin.All, Workspace.ManageAll, and Workspace.GitRead.All, then make sure to grant admin consent.
- Update your GitHub Actions permissions to include below actions
actions: read
contents: write
id-token: write
pull-requests: write
- Please check Microsoft Fabric to see if the workspace is already connected, as that might be causing conflicts.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thanks,
Rekha!!
- ckingdon_bee1 year agoFrequent Visitor
I only see the following 4 permissions under PowerBI Service for the app registration:
I did add all 4 of these and granted admin consent. Additionally I updated my GitHub Actions permissions and made sure that the workspace was disconnected before running again. I am still getting the same error however.
- v-sathmakuri1 year agoCommunity Support
Hi ckingdon_bee ,
Thank you for your response!!
Can you please raise a Microsoft support ticket for further investigation. You can create a Microsoft support ticket using the link below.
How to create a Fabric and Power BI Support ticket - Power BI | Microsoft LearnIf this helps, then please Accept it as a solution and dropping a "Kudos" so other members can find it more easily.
Hope this works for you!
Thanks & Regards,
Rekha,Cummunity Support Team.