https://github.com/muhssamy/updatefromgit
This package is designed to be used within an Azure DevOps Pipeline to update a Fabric Workspace from a Git repository using a user with an email and password
https://github.com/muhssamy/updatefromgit
azure-devops devops-pipeline fabric git-integration microsoft-fabric
Last synced: about 1 month ago
JSON representation
This package is designed to be used within an Azure DevOps Pipeline to update a Fabric Workspace from a Git repository using a user with an email and password
- Host: GitHub
- URL: https://github.com/muhssamy/updatefromgit
- Owner: muhssamy
- License: mit
- Created: 2024-10-13T13:48:38.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-10-17T16:32:01.000Z (7 months ago)
- Last Synced: 2025-04-15T14:06:03.313Z (about 1 month ago)
- Topics: azure-devops, devops-pipeline, fabric, git-integration, microsoft-fabric
- Language: Python
- Homepage: https://pypi.org/project/updatefromgit/
- Size: 34.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/muhssamy/updatefromgit/actions/workflows/github-release.yml)
# Update From Git
This package is built on top of this [repository](https://github.com/PowerBiDevCamp/FabConWorkshopSweden).I have enhanced it to be more suitable for Azure Pipelines.
## Description
This package is designed to be used within an Azure DevOps Pipeline to update a Fabric Workspace from a Git repository using a user with an email and password. It supports both public client and confidential client applications. For more information about the differences, click [here](https://learn.microsoft.com/en-us/entra/msal/msal-client-applications)
**Note** This is currently the only available method because Microsoft does not support service principals for these operations. Once it becomes available, please use it. For more information, check Microsoft Entra supported identities [here](https://learn.microsoft.com/en-us/rest/api/fabric/core/git/update-from-git).
Another method is to schedule a notebook on Fabric running under the authority of a user who is a contributor or higher in an administration workspace using [this](https://semantic-link-labs.readthedocs.io/en/stable/sempy_labs.html#sempy_labs.update_from_git) libirary.
### Install
To install the package, use the following command:
```python
pip install updatefromgit
```### Usage
First, import the required functions. This example uses a `confidential App` but you can use a public one and omit the `client secret`
```python
import logging
import os
import sys
import time
from azlog import AzLoggerfrom updatefromgit import (
acquire_token_user_id_password_confidential,
commit_all_items_to_git,
get_git_status,
update_workspace_from_git,
)logger = AzLogger(__name__)
logger.setLevel(logging.INFO)```
Next, create your constants:
```python
FABRIC_API_URL = "https://api.fabric.microsoft.com/v1"
CLIENT_ID = ""
TENANT_ID = ""
USERNAME = ""
PASSWORD = ""
WORKSPACE_ID = ""```
Then, you can call the functions:
```python
access_token = acquire_token_user_id_password_confidential(
TENANT_ID, CLIENT_ID, USERNAME, PASSWORD, CLIENT_SECRET
)
update_workspace_from_git(WORKSPACE_ID, access_token)
time.sleep(600) #adjust it per your need
workspace_head = get_git_status(WORKSPACE_ID, access_token)
commit_all_items_to_git(WORKSPACE_ID, workspace_head, access_token)
logger.command("Program Completed")```