Modifier

Partager via


Git - Connect

Connect a specific workspace to a git repository and branch.

This operation does not sync between the workspace and the connected branch. To complete the sync, use the Initialize Connection operation and follow with either the Commit To Git or the Update From Git operation.

To get started with GitHub, see: Get started with Git integration.

Permissions

The caller must have an admin role for the workspace.

For configured connection Git credentials, the caller must have permission for the connection.

Required Delegated Scopes

Workspace.ReadWrite.All

Microsoft Entra supported identities

This API supports the Microsoft identities listed in this section.

Identity Support
User Yes
Service principal No
Managed identities No

Interface

POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/git/connect

URI Parameters

Name In Required Type Description
workspaceId
path True

string

uuid

The workspace ID.

Request Body

Name Required Type Description
gitProviderDetails True GitProviderDetails:

The Git provider details.

myGitCredentials GitCredentials:

User-specific Git credentials for authentication to the GitProvider. These credentials are not shared with other workspace contributors. For AzureDevOps, the default value is AutomaticGitCredentials. For GitHub, this property is required.

Responses

Name Type Description
200 OK

Request completed successfully.

Other Status Codes

ErrorResponse

Common error codes:

  • UnknownError - An error occurred.

  • WorkspaceAlreadyConnectedToGit - Workspace is already connected to git.

  • WorkspaceHasNoCapacityAssigned - No capacity assigned to workspace.

  • InsufficientPrivileges - Caller has insufficient workspace permissions.

Examples

Connect a workspace to Azure DevOps example
Connect a workspace to GitHub example

Connect a workspace to Azure DevOps example

Sample request

POST https://api.fabric.microsoft.com/v1/workspaces/1565e6a3-c020-4c0c-dda7-92bafe99eec5/git/connect

{
  "gitProviderDetails": {
    "organizationName": "Test Organization",
    "projectName": "Test Project",
    "gitProviderType": "AzureDevOps",
    "repositoryName": "Test Repo",
    "branchName": "Test Branch",
    "directoryName": "Test Directory"
  }
}

Sample response

Connect a workspace to GitHub example

Sample request

POST https://api.fabric.microsoft.com/v1/workspaces/1565e6a3-c020-4c0c-dda7-92bafe99eec5/git/connect

{
  "gitProviderDetails": {
    "ownerName": "Test Owner",
    "gitProviderType": "GitHub",
    "repositoryName": "Test Repo",
    "branchName": "Test Branch",
    "directoryName": "Test Directory/Test Subdirectory"
  },
  "myGitCredentials": {
    "source": "ConfiguredConnection",
    "connectionId": "3f2504e0-4f89-11d3-9a0c-0305e82c3301"
  }
}

Sample response

Definitions

Name Description
AutomaticGitCredentials

Automatic Git credentials.

AzureDevOpsDetails

Azure DevOps provider details.

ConfiguredConnectionGitCredentials

Configured connection Git credentials.

ErrorRelatedResource

The error related resource details object.

ErrorResponse

The error response.

ErrorResponseDetails

The error response details.

GitConnectRequest

Contains the Git connect request data.

GitCredentialsSource

The Git credentials source. Additional Git credentials sources may be added over time.

GitHubDetails

GitHub provider details.

GitProviderType

A Git provider type. Additional provider types may be added over time.

AutomaticGitCredentials

Automatic Git credentials.

Name Type Description
source string:

Automatic

The Git credentials source.

AzureDevOpsDetails

Azure DevOps provider details.

Name Type Description
branchName

string

The branch name. Maximum length is 250 characters.

directoryName

string

The relative path to the directory. Maximum length is 256 characters.

gitProviderType string:

AzureDevOps

A Git provider type. Additional provider types may be added over time.

organizationName

string

The organization name. Maximum length is 100 characters.

projectName

string

The project name. Maximum length is 100 characters.

repositoryName

string

The repository name. Maximum length is 128 characters.

ConfiguredConnectionGitCredentials

Configured connection Git credentials.

Name Type Description
connectionId

string

The object ID of the connection.

source string:

ConfiguredConnection

The Git credentials source.

ErrorRelatedResource

The error related resource details object.

Name Type Description
resourceId

string

The resource ID that's involved in the error.

resourceType

string

The type of the resource that's involved in the error.

ErrorResponse

The error response.

Name Type Description
errorCode

string

A specific identifier that provides information about an error condition, allowing for standardized communication between our service and its users.

message

string

A human readable representation of the error.

moreDetails

ErrorResponseDetails[]

List of additional error details.

relatedResource

ErrorRelatedResource

The error related resource details.

requestId

string

ID of the request associated with the error.

ErrorResponseDetails

The error response details.

Name Type Description
errorCode

string

A specific identifier that provides information about an error condition, allowing for standardized communication between our service and its users.

message

string

A human readable representation of the error.

relatedResource

ErrorRelatedResource

The error related resource details.

GitConnectRequest

Contains the Git connect request data.

Name Type Description
gitProviderDetails GitProviderDetails:

The Git provider details.

myGitCredentials GitCredentials:

User-specific Git credentials for authentication to the GitProvider. These credentials are not shared with other workspace contributors. For AzureDevOps, the default value is AutomaticGitCredentials. For GitHub, this property is required.

GitCredentialsSource

The Git credentials source. Additional Git credentials sources may be added over time.

Name Type Description
Automatic

string

The Git credentials are automatically obtained by the system, using default credentials if available.

ConfiguredConnection

string

The Git credentials are obtained through a configured connection.

None

string

The Git credentials are not configured.

GitHubDetails

GitHub provider details.

Name Type Description
branchName

string

The branch name. Maximum length is 250 characters.

directoryName

string

The relative path to the directory. Maximum length is 256 characters.

gitProviderType string:

GitHub

A Git provider type. Additional provider types may be added over time.

ownerName

string

The owner name. Maximum length is 100 characters.

repositoryName

string

The repository name. Maximum length is 128 characters.

GitProviderType

A Git provider type. Additional provider types may be added over time.

Name Type Description
AzureDevOps

string

Azure DevOps provider

GitHub

string

GitHub provider