Forum Discussion
Issue with Fabric Git API loop from Azure DevOps
- 10 months ago
Hi yazdanb,
Thank you for reaching out to the Microsoft Fabric Community.
Based on your description, the issue seems to occur because the initializeConnection API call is missing the required parameters and proper handling for long-running operations (LRO). In Fabric, this endpoint does not complete immediately; instead, it returns a 202 Accepted response with a Location header containing an operation URL. You need to poll this URL until the initialization is finished. If you send an empty JSON body ({}) or omit the initializationStrategy, the API may return an UnknownError or make the workspace look connected without being fully initialized, leading to the "WorkspaceGitConnectionNotInitialized" message.To resolve this, update your API call to include the initializationStrategy parameter in the request body. For most automated deployments, use the following payload:
{ "initializationStrategy": "PreferRemote" }
Alternatively, you can use "PreferWorkspace" if you want your Fabric workspace content to take precedence over the repository. Once you submit this request, make sure to capture the Location URL from the response headers and keep polling that endpoint until the operation state is Succeeded. Skipping this step will leave the connection in a partial state and can cause the same circular issue you're experiencing.
Also, check that your service principal's Git credentials are correctly set up. You can do this by calling GET /git/myGitCredentials to verify the source is "ConfiguredConnection" and that the connectionId matches the one in your connect request. If it's not set up, you can update it using the PATCH endpoint as shown:
{ "source": "ConfiguredConnection", "connectionId": "<FABRIC_CONNECTION_ID>" }
Without this configuration, /git/connect may show success, but initialization can fail if credentials aren't linked. After successful initialization, check GET /git/status. If "requiredAction" is "UpdateFromGit", use POST /git/updateFromGit and poll until done. Make sure your Fabric workspace has capacity assigned and your service principal has Admin access to both the workspace and Azure DevOps repository for the Git APIs to work.
Git - Initialize Connection - REST API (Core) | Microsoft Learn
Git - Connect - REST API (Core) | Microsoft LearnThank you and regards,
Sahasra.
Hi yazdanb,
Thank you for reaching out to the Microsoft Fabric Community.
Based on your description, the issue seems to occur because the initializeConnection API call is missing the required parameters and proper handling for long-running operations (LRO). In Fabric, this endpoint does not complete immediately; instead, it returns a 202 Accepted response with a Location header containing an operation URL. You need to poll this URL until the initialization is finished. If you send an empty JSON body ({}) or omit the initializationStrategy, the API may return an UnknownError or make the workspace look connected without being fully initialized, leading to the "WorkspaceGitConnectionNotInitialized" message.
To resolve this, update your API call to include the initializationStrategy parameter in the request body. For most automated deployments, use the following payload:
{ "initializationStrategy": "PreferRemote" }
Alternatively, you can use "PreferWorkspace" if you want your Fabric workspace content to take precedence over the repository. Once you submit this request, make sure to capture the Location URL from the response headers and keep polling that endpoint until the operation state is Succeeded. Skipping this step will leave the connection in a partial state and can cause the same circular issue you're experiencing.
Also, check that your service principal's Git credentials are correctly set up. You can do this by calling GET /git/myGitCredentials to verify the source is "ConfiguredConnection" and that the connectionId matches the one in your connect request. If it's not set up, you can update it using the PATCH endpoint as shown:
{ "source": "ConfiguredConnection", "connectionId": "<FABRIC_CONNECTION_ID>" }
Without this configuration, /git/connect may show success, but initialization can fail if credentials aren't linked. After successful initialization, check GET /git/status. If "requiredAction" is "UpdateFromGit", use POST /git/updateFromGit and poll until done. Make sure your Fabric workspace has capacity assigned and your service principal has Admin access to both the workspace and Azure DevOps repository for the Git APIs to work.
Git - Initialize Connection - REST API (Core) | Microsoft Learn
Git - Connect - REST API (Core) | Microsoft Learn
Thank you and regards,
Sahasra.
- v-sgandrathi10 months agoCommunity Support
HI yazdanb,
Just wanted to follow up and confirm that everything has been going well on this. Please let me know if there’s anything from our end.
Please feel free to reach out Microsoft fabric community forum.Thank you.
- v-sgandrathi9 months agoCommunity Support
Hi yazdanb,
We wanted to check if you had a chance to review our last reply. Let us know if it helped or if you need more guidance, we're always happy to help further.
Thank you and continue using Microsft Fabric Community Forum.
- v-sgandrathi9 months agoCommunity Support
Hi yazdanb,
As we did not get a response, may I know if the above reply could clarify your issue, or could you please help confirm if we may help you with anything else?
Thankyou.