Skip to content

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

License

Notifications You must be signed in to change notification settings

muhssamy/fabricops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build

FabricOps

This package is built on top of this repository. I have enhanced it to be more suitable for Azure Pipelines and Added New Fuctions for DevOps Pipeline Activies.

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

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.

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 libirary.

Install

To install the package, use the following command:

pip install fabricops

Usage

1- Create Config File For Pipeline Contents

you can add the following tasks in your azure-pipeline.yml to create the files

- bash: 'python -m pip install fabricops --no-cache-dir --upgrade'
displayName: 'Install FabricOps'

- task: PythonScript@0
displayName: 'Create Config File'
inputs:
    scriptSource: 'filePath'
    scriptPath: '$(Build.SourcesDirectory)/create_configs.py' 
    arguments: '--WORKSPACE_ID $(WORKSPACE_ID) --WORKSPACE_WH_ID $(WORKSPACE_WH_ID) --CLIENT_ID $(CLIENTID) --TENANT_ID $(TENANTID) --USER_NAME $(email) --PASSWORD $(password) --CLIENT_SECRET $(CLIENTSECRET)'
    workingDirectory: '$(Build.SourcesDirectory)'

# Step 3: Publish the file as a pipeline artifact
- task: PublishPipelineArtifact@1
inputs:
    targetPath: 'linkedservice-config.json'
    artifact: 'config-file'
displayName: 'Publish created file as artifact'

- task: DownloadPipelineArtifact@2
inputs:
    artifact: 'config-file'
    path: '$(Pipeline.Workspace)'
displayName: 'Download created file'

and the content of create_configs.py exists in the Samples Folder.

2- To Update Fabric Pipelines

you can use the following task

- script: |
      python3 -c "from fabricops import update_linked_services; update_linked_services('$(Pipeline.Workspace)/linkedservice-config.json', '$(Build.SourcesDirectory)')"
    displayName: 'PY Modify JSON Files'

3- Update Workspace From Git Repo

Now you can update your Fabric Workspace From connected Repo. update.py in samples Folder

- task: PythonScript@0
displayName: 'Run a Python script'
inputs:
    scriptSource: 'filePath'
    scriptPath: '$(Build.SourcesDirectory)/update.py'
    arguments: '--WORKSPACE_ID $(WORKSPACE_ID) --CLIENT_ID $(CLIENTID) --TENANT_ID $(TENANTID) --USER_NAME $(email) --PASSWORD $(password) --CLIENT_SECRET $(CLIENTSECRET)'
    workingDirectory: '$(Build.SourcesDirectory)'

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages