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.
If successful, this method returns a 201 Created response code and an 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.
POST https://graph.microsoft.com/v1.0/external/connections
Content-Type: application/json
{
"id": "contosohr",
"name": "Contoso HR",
"description": "Connection to index Contoso HR system"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models.ExternalConnectors;
var requestBody = new ExternalConnection
{
Id = "contosohr",
Name = "Contoso HR",
Description = "Connection to index Contoso HR system",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.External.Connections.PostAsync(requestBody);
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc external connections create --body '{\
"id": "contosohr",\
"name": "Contoso HR",\
"description": "Connection to index Contoso HR system"\
}\
'
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.models.externalconnectors.ExternalConnection externalConnection = new com.microsoft.graph.models.externalconnectors.ExternalConnection();
externalConnection.setId("contosohr");
externalConnection.setName("Contoso HR");
externalConnection.setDescription("Connection to index Contoso HR system");
com.microsoft.graph.models.externalconnectors.ExternalConnection result = graphClient.external().connections().post(externalConnection);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\ExternalConnection;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ExternalConnection();
$requestBody->setId('contosohr');
$requestBody->setName('Contoso HR');
$requestBody->setDescription('Connection to index Contoso HR system');
$result = $graphServiceClient->external()->connections()->post($requestBody)->wait();
from msgraph import GraphServiceClient
from msgraph.generated.models.external_connection import ExternalConnection
graph_client = GraphServiceClient(credentials, scopes)
request_body = ExternalConnection(
id = "contosohr",
name = "Contoso HR",
description = "Connection to index Contoso HR system",
)
result = await graph_client.external.connections.post(request_body)
The following example shows the response. Note that the id, name, and description properties in the response payload are generated by the system and are different from the ones that are in the connection that was created.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.