Although the Python SDK lacks some specific options like "Import resource into this branch," you can use the Azure Data Factory REST API to configure and manage Git integration more directly. The REST API might allow you to perform the "Import existing Data Factory resources" operation programmatically.
You can also set up an Azure DevOps pipeline (or any CI/CD pipeline) to automatically sync changes between branches. This pipeline can:
- Pull changes from the publish branch.
- Merge or sync these changes with the main (collaboration) branch.
- Push any updates back to the main branch.
After modifying the ADF with the Python SDK, you could automate the following steps in a script:
- Delete the Git configuration in ADF if necessary (as you mentioned you can do this in Python).
- Reconfigure the Git repository with the desired settings using the REST API.
- Trigger a pull request or direct sync between branches, ensuring the collaboration branch is updated with the latest resources.
Another approach is to manually set up the initial configuration in the GUI as per your screenshot (with "Import existing resources to repository" checked). Afterward, make only minor updates via the Python SDK, which should reflect in both the publish and collaboration branches without needing a full re-import.