Automate your CI/CD pipelines with Microsoft Fabric Git REST APIs
Git integration in Microsoft Fabric enables developers to integrate development process and tools directly into Fabric, empowering them to backup and version their work, revert to previous stages, collaborate on shared branches or work separately using feature branches, and apply familiar source control tools to manage Fabric items.
Until today, all these capabilities were exclusively accessible through the Fabric platform. This meant that the connection to Git and synchronization between Fabric and Git had to be executed directly through Fabric. However, as more organizations integrate Fabric into existing CI/CD pipeline and leverage various DevOps tools for their workflows, there has been a growing demand for Fabric Git integration via REST APIs.
Today, we’re excited to share that the Fabric Git APIs are now publicly available. These APIs enable numerous Git operations to be performed directly via REST APIs, eliminating the need for manual intervention through Fabric. Key operations provided by these APIs include:
- Connect & sync between a workspace and a Git repository and branch.
- Commit & update changes between the workspace and the connected branch.
- Get the status of items to learn where there are any incoming or uncommitted changes
These operations facilitate automatic synchronization between your Git provider and Fabric through pipelines or scripts. Whether you intend to automatically update your main Fabric workspace following a pull request in your Git provider or connect your workspaces to a new Git branch, these processes can now be seamlessly automated.
When combined with Fabric REST APIs, which enable actions on Fabric workspaces and items, the available APIs offer a robust set of tools to streamline and automate your development processes.
Documentation
A comprehensive list of all the available functions with the Git APIs, things to know before getting started and examples for some of the calls can be found here. In addition, for each of the available APIs, you can access a detailed description of the required parameters, request body, and response here.
Example – Commit all to Git
For example, the commit to Git API let’s you select between multiple commit modes (all items/selective list of items), specify the items to commit if needed, and add a message with the details of your commit
POST https://api.fabric.microsoft.com/v1/workspaces/1565e6a3-c020-4c0c-dda7-92bafe99eec5/git/commitToGit
{
"mode": "All",
"workspaceHead": "eaa737b48cda41b37ffefac772ea48f6fed3eac4",
"comment": "I'm committing all my changes"
}
Full details of the commit APIs and the expected responses are available here.
PowerShell samples
To expedite your adoption of Git REST APIs, we have also released a set of PowerShell samples. These samples cover common scenarios such as connecting and updating a workspace, committing all or selected items, and updating from Git to a workspace. Detailed instructions on how to run and perform these samples are included.
The full list of samples is available here.
We trust that these APIs will prove beneficial and valuable for your work. Your feedback is always appreciated, if you have any suggestions or ideas for Fabric Git integration, we encourage you to share them with us or vote on existing suggestions from others here.