Create connection

Namespace: microsoft.graph.externalConnectors

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Create a new externalConnection.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) ExternalConnection.ReadWrite.OwnedBy ExternalConnection.ReadWrite.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application ExternalConnection.ReadWrite.OwnedBy ExternalConnection.ReadWrite.All

HTTP request

POST /external/connections

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, supply a JSON representation of an externalConnection object.

Response

If successful, this method returns 201 Created response code and a new externalConnection object in the response body.

Note: When you create an external connection with a broken adaptive card for the result layout, the first call will fail with a 503 Service Unavailable. When you try the call again, the second call will fail with a 409 Conflict response that states that a connection with the same name already exists. This happens because the connection was created even though the first call failed with 503 Service Unavailable. For more details, see Known issues.

Examples

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/external/connections
Content-type: application/json

{
  "id": "contosohr",
  "name": "Contoso HR",
  "description": "Connection to index Contoso HR system"
}

Response

The following example shows the response.

HTTP/1.1 201 Created
Content-type: application/json

{
  "id": "contosohr",
  "name": "Contoso HR",
  "description": "Connection to index Contoso HR system",
  "state": "draft",
  "configuration": {
    "authorizedAppIds": [
      "d310d35d-72ec-47dd-92f2-fb9c40936555"
    ]
  }
}