Created
July 20, 2023 10:41
-
-
Save AlexanderHolmeset/d109f3532c0a60e9f97cc1c1266197c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$AzureCognitiveSearchURL = "https://sharepointsearchinstance.search.windows.net" | |
$AzureCognitiveSearchAdminKey = "Wt1mZ0sjkKoXW913d2eJ8xXYJk4JHThk1UK8H0wZoIAzSeDjYTmC" | |
$SharePointSiteURL = "https://alexholmeset.sharepoint.com/sites/TestDemoTeam/" | |
$AzureAppregistrationID = "861eade5-bb96-41cc-af4b-55dce97b020e" | |
$AzureAppregistrationSecret = "8re8Q~pR6icm6oT5Fx8UwiDO~xgoeYp~8KGiXaF3" | |
$TenantID = "29594fb0-53f2-490c-a1be-8b2cca824805" | |
$Header = @{"api-key" = "$AzureCognitiveSearchAdminKey" | |
"content-type" = "application/json" | |
} | |
$Body = @" | |
{ | |
"name" : "sharepoint-datasource", | |
"type" : "sharepoint", | |
"credentials" : { "connectionString" : "SharePointOnlineEndpoint=$SharePointSiteURL;ApplicationId=$AzureAppregistrationID;ApplicationSecret=$AzureAppregistrationSecret;TenantId=$TenantID" }, | |
"container" : { "name" : "defaultSiteLibrary", "query" : null } | |
} | |
"@ | |
$uri = "$AzureCognitiveSearchURL/datasources?api-version=2020-06-30-Preview" | |
invoke-restmethod -Method POST -Uri $uri -Body $body -Headers $Header |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment