Skapar eller uppdaterar en söktjänst i den angivna resursgruppen. Om söktjänsten redan finns uppdateras alla egenskaper med angivna värden.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}?api-version=2023-11-01
URI-parametrar
Name |
I |
Obligatorisk |
Typ |
Description |
resourceGroupName
|
path |
True
|
string
|
Namnet på resursgruppen i den aktuella prenumerationen. Du kan hämta det här värdet från Azure Resource Manager-API:et eller portalen.
|
searchServiceName
|
path |
True
|
string
|
Namnet på söktjänsten som ska skapas eller uppdateras. tjänsten Search namn får bara innehålla gemener, siffror eller bindestreck, kan inte använda bindestreck eftersom de två första eller sista tecknen, inte får innehålla efterföljande bindestreck och måste vara mellan 2 och 60 tecken långa. tjänsten Search namn måste vara globalt unika eftersom de ingår i tjänstens URI (https://.search.windows.net). Du kan inte ändra tjänstnamnet när tjänsten har skapats.
|
subscriptionId
|
path |
True
|
string
|
Den unika identifieraren för en Microsoft Azure-prenumeration. Du kan hämta det här värdet från Azure Resource Manager API, kommandoradsverktyg eller portalen.
|
api-version
|
query |
True
|
string
|
DEN API-version som ska användas för varje begäran.
|
Name |
Obligatorisk |
Typ |
Description |
x-ms-client-request-id
|
|
string
uuid
|
Ett klientgenererat GUID-värde som identifierar den här begäran. Om detta anges inkluderas detta i svarsinformationen som ett sätt att spåra begäran.
|
Begärandetext
Name |
Obligatorisk |
Typ |
Description |
location
|
True
|
string
|
Den geo-plats där resursen finns
|
identity
|
|
Identity
|
Resursens identitet.
|
properties.authOptions
|
|
DataPlaneAuthOptions
|
Definierar alternativen för hur dataplanets API för en söktjänst autentiserar begäranden. Det går inte att ange om "disableLocalAuth" är inställt på true.
|
properties.disableLocalAuth
|
|
boolean
|
När värdet är true tillåts inte anrop till söktjänsten att använda API-nycklar för autentisering. Detta kan inte anges till sant om "dataPlaneAuthOptions" har definierats.
|
properties.encryptionWithCmk
|
|
EncryptionWithCmk
|
Anger alla principer för kryptering av resurser (till exempel index) med hjälp av kundhanterarnycklar i en söktjänst.
|
properties.hostingMode
|
|
HostingMode
|
Gäller endast för standard3 SKU. Du kan ange den här egenskapen för att aktivera upp till 3 partitioner med hög densitet som tillåter upp till 1 000 index, vilket är mycket högre än de högsta index som tillåts för andra SKU:er. För standard3 SKU är värdet antingen "default" eller "highDensity". För alla andra SKU:er måste det här värdet vara "standard".
|
properties.networkRuleSet
|
|
NetworkRuleSet
|
Nätverksspecifika regler som avgör hur söktjänsten kan nås.
|
properties.partitionCount
|
|
integer
|
Antalet partitioner i söktjänsten. om det anges kan det vara 1, 2, 3, 4, 6 eller 12. Värden som är större än 1 är endast giltiga för standard-SKU:er. För "standard3"-tjänster med hostingMode inställt på "highDensity" är de tillåtna värdena mellan 1 och 3.
|
properties.publicNetworkAccess
|
|
PublicNetworkAccess
|
Det här värdet kan anges till "aktiverat" för att undvika icke-bakåtkompatibla ändringar av befintliga kundresurser och mallar. Om inställningen är "inaktiverad" tillåts inte trafik via det offentliga gränssnittet och privata slutpunktsanslutningar är den exklusiva åtkomstmetoden.
|
properties.replicaCount
|
|
integer
|
Antalet repliker i söktjänsten. Om det anges måste det vara ett värde mellan 1 och 12 för standard-SKU:er eller mellan 1 och 3 för grundläggande SKU.
|
properties.semanticSearch
|
|
SearchSemanticSearch
|
Anger alternativ som styr tillgängligheten för semantisk sökning. Den här konfigurationen är endast möjlig för vissa sök-SKU:er på vissa platser.
|
sku
|
|
Sku
|
SKU:n för söktjänsten, som avgör faktureringshastighet och kapacitetsgränser. Den här egenskapen krävs när du skapar en ny söktjänst.
|
tags
|
|
object
|
Resurstaggar.
|
Svar
Name |
Typ |
Description |
200 OK
|
SearchService
|
Den befintliga tjänstdefinitionen har uppdaterats. Om du har ändrat antalet repliker eller partitioner sker skalningsåtgärden asynkront. Du kan regelbundet hämta din tjänstdefinition och övervaka förloppet via egenskapen provisioningState.
|
201 Created
|
SearchService
|
Om du begärde att en kostnadsfri söktjänst skulle skapas är tjänsten nu etablerad och redo att användas, med förbehåll för DNS-spridningsfördröjning. För andra SKU-typer sker etablering asynkront. Du kan regelbundet hämta din tjänstdefinition och övervaka förloppet via egenskapen provisioningState.
|
Other Status Codes
|
CloudError
|
HTTP 400 (felaktig begäran): Det angivna tjänstnamnet eller tjänstdefinitionen är ogiltig. Mer information finns i felkoden och meddelandet i svaret. HTTP 404 (hittades inte): Det gick inte att hitta prenumerationen eller resursgruppen. HTTP 409 (konflikt): Den angivna prenumerationen är inaktiverad.
|
Säkerhet
azure_auth
Microsoft Entra ID OAuth2-auktoriseringsflöde.
Typ:
oauth2
Flow:
implicit
Auktoriseringswebbadress:
https://login.microsoftonline.com/common/oauth2/authorize
Omfattningar
Name |
Description |
user_impersonation
|
personifiera ditt användarkonto
|
Exempel
SearchCreateOrUpdateService
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateService.
* json
*/
/**
* Sample code: SearchCreateOrUpdateService.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCreateOrUpdateService(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(3).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {"hostingMode": "default", "partitionCount": 1, "replicaCount": 3},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateService.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateService.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateService() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](3),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateService.json
*/
async function searchCreateOrUpdateService() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
hostingMode: "default",
location: "westus",
partitionCount: 1,
replicaCount: 3,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateService.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
}
}
SearchCreateOrUpdateServiceAuthOptions
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"authOptions": {
"aadOrApiKey": {
"aadAuthFailureMode": "http401WithBearerChallenge"
}
}
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.AadAuthFailureMode;
import com.azure.resourcemanager.search.models.DataPlaneAadOrApiKeyAuthOption;
import com.azure.resourcemanager.search.models.DataPlaneAuthOptions;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateServiceAuthOptions.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceAuthOptions.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCreateOrUpdateServiceAuthOptions(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(3).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT)
.withAuthOptions(new DataPlaneAuthOptions().withAadOrApiKey(new DataPlaneAadOrApiKeyAuthOption()
.withAadAuthFailureMode(AadAuthFailureMode.HTTP401WITH_BEARER_CHALLENGE))),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service_auth_options.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {
"authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "http401WithBearerChallenge"}},
"hostingMode": "default",
"partitionCount": 1,
"replicaCount": 3,
},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceAuthOptions.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceAuthOptions.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceAuthOptions() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
AuthOptions: &armsearch.DataPlaneAuthOptions{
AADOrAPIKey: &armsearch.DataPlaneAADOrAPIKeyAuthOption{
AADAuthFailureMode: to.Ptr(armsearch.AADAuthFailureModeHttp401WithBearerChallenge),
},
},
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](3),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// AuthOptions: &armsearch.DataPlaneAuthOptions{
// AADOrAPIKey: &armsearch.DataPlaneAADOrAPIKeyAuthOption{
// AADAuthFailureMode: to.Ptr(armsearch.AADAuthFailureModeHttp401WithBearerChallenge),
// },
// },
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceAuthOptions.json
*/
async function searchCreateOrUpdateServiceAuthOptions() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
authOptions: {
aadOrApiKey: { aadAuthFailureMode: "http401WithBearerChallenge" },
},
hostingMode: "default",
location: "westus",
partitionCount: 1,
replicaCount: 3,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceAuthOptions.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
AuthOptions = new SearchAadAuthDataPlaneAuthOptions()
{
AadAuthFailureMode = SearchAadAuthFailureMode.Http401WithBearerChallenge,
},
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"authOptions": {
"aadOrApiKey": {
"aadAuthFailureMode": "http401WithBearerChallenge"
}
}
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"authOptions": {
"aadOrApiKey": {
"aadAuthFailureMode": "http401WithBearerChallenge"
}
}
}
}
SearchCreateOrUpdateServiceDisableLocalAuth
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"disableLocalAuth": true
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateServiceDisableLocalAuth.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceDisableLocalAuth.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
searchCreateOrUpdateServiceDisableLocalAuth(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(3).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT).withDisableLocalAuth(true),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service_disable_local_auth.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {"disableLocalAuth": True, "hostingMode": "default", "partitionCount": 1, "replicaCount": 3},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceDisableLocalAuth() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
DisableLocalAuth: to.Ptr(true),
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](3),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// DisableLocalAuth: to.Ptr(true),
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json
*/
async function searchCreateOrUpdateServiceDisableLocalAuth() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
disableLocalAuth: true,
hostingMode: "default",
location: "westus",
partitionCount: 1,
replicaCount: 3,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
IsLocalAuthDisabled = true,
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"disableLocalAuth": true,
"authOptions": null
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"disableLocalAuth": true,
"authOptions": null
}
}
SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"publicNetworkAccess": "disabled",
"hostingMode": "default"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.PublicNetworkAccess;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(3).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT).withPublicNetworkAccess(PublicNetworkAccess.DISABLED),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service_to_allow_access_from_private_endpoints.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {
"hostingMode": "default",
"partitionCount": 1,
"publicNetworkAccess": "disabled",
"replicaCount": 3,
},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled),
ReplicaCount: to.Ptr[int32](3),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled),
// ReplicaCount: to.Ptr[int32](3),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json
*/
async function searchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
hostingMode: "default",
location: "westus",
partitionCount: 1,
publicNetworkAccess: "disabled",
replicaCount: 3,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
PublicNetworkAccess = SearchServicePublicNetworkAccess.Disabled,
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "disabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "disabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
}
}
SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 1,
"partitionCount": 1,
"networkRuleSet": {
"ipRules": [
{
"value": "123.4.5.6"
},
{
"value": "123.4.6.0/18"
}
]
},
"hostingMode": "default"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.IpRule;
import com.azure.resourcemanager.search.models.NetworkRuleSet;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(1).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT)
.withNetworkRuleSet(new NetworkRuleSet().withIpRules(
Arrays.asList(new IpRule().withValue("123.4.5.6"), new IpRule().withValue("123.4.6.0/18")))),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service_to_allow_access_from_public_custom_ips.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {
"hostingMode": "default",
"networkRuleSet": {"ipRules": [{"value": "123.4.5.6"}, {"value": "123.4.6.0/18"}]},
"partitionCount": 1,
"replicaCount": 1,
},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
HostingMode: to.Ptr(armsearch.HostingModeDefault),
NetworkRuleSet: &armsearch.NetworkRuleSet{
IPRules: []*armsearch.IPRule{
{
Value: to.Ptr("123.4.5.6"),
},
{
Value: to.Ptr("123.4.6.0/18"),
}},
},
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](1),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// {
// Value: to.Ptr("123.4.5.6"),
// },
// {
// Value: to.Ptr("123.4.6.0/18"),
// }},
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](1),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json
*/
async function searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
hostingMode: "default",
location: "westus",
networkRuleSet: {
ipRules: [{ value: "123.4.5.6" }, { value: "123.4.6.0/18" }],
},
partitionCount: 1,
replicaCount: 1,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 1,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
IPRules =
{
new SearchServiceIPRule()
{
Value = "123.4.5.6",
},new SearchServiceIPRule()
{
Value = "123.4.6.0/18",
}
},
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 1,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [
{
"value": "123.4.5.6"
},
{
"value": "123.4.6.0/18"
}
]
},
"privateEndpointConnections": []
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 1,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [
{
"value": "123.4.5.6"
},
{
"value": "123.4.6.0/18"
}
]
},
"privateEndpointConnections": []
}
}
SearchCreateOrUpdateServiceWithCmkEnforcement
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"encryptionWithCmk": {
"enforcement": "Enabled"
}
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.EncryptionWithCmk;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.SearchEncryptionWithCmk;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateServiceWithCmkEnforcement.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceWithCmkEnforcement.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
searchCreateOrUpdateServiceWithCmkEnforcement(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(3).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT)
.withEncryptionWithCmk(new EncryptionWithCmk().withEnforcement(SearchEncryptionWithCmk.ENABLED)),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service_with_cmk_enforcement.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {
"encryptionWithCmk": {"enforcement": "Enabled"},
"hostingMode": "default",
"partitionCount": 1,
"replicaCount": 3,
},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceWithCmkEnforcement() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
EncryptionWithCmk: &armsearch.EncryptionWithCmk{
Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkEnabled),
},
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](3),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// AuthOptions: &armsearch.DataPlaneAuthOptions{
// APIKeyOnly: map[string]any{
// },
// },
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkEnabled),
// },
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// SharedPrivateLinkResources: []*armsearch.SharedPrivateLinkResource{
// },
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json
*/
async function searchCreateOrUpdateServiceWithCmkEnforcement() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
encryptionWithCmk: { enforcement: "Enabled" },
hostingMode: "default",
location: "westus",
partitionCount: 1,
replicaCount: 3,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
EncryptionWithCmk = new SearchEncryptionWithCmk()
{
Enforcement = SearchEncryptionWithCmkEnforcement.Enabled,
},
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Enabled",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
}
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Enabled",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
}
}
}
SearchCreateOrUpdateServiceWithIdentity
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default"
},
"identity": {
"type": "SystemAssigned"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.Identity;
import com.azure.resourcemanager.search.models.IdentityType;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateServiceWithIdentity.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceWithIdentity.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCreateOrUpdateServiceWithIdentity(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD))
.withIdentity(new Identity().withType(IdentityType.SYSTEM_ASSIGNED)).withReplicaCount(3)
.withPartitionCount(1).withHostingMode(HostingMode.DEFAULT),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service_with_identity.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"identity": {"type": "SystemAssigned"},
"location": "westus",
"properties": {"hostingMode": "default", "partitionCount": 1, "replicaCount": 3},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithIdentity.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithIdentity.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceWithIdentity() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Identity: &armsearch.Identity{
Type: to.Ptr(armsearch.IdentityTypeSystemAssigned),
},
Properties: &armsearch.ServiceProperties{
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](3),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Identity: &armsearch.Identity{
// Type: to.Ptr(armsearch.IdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("9d1e1f18-2122-4988-a11c-878782e40a5c"),
// TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"),
// },
// Properties: &armsearch.ServiceProperties{
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithIdentity.json
*/
async function searchCreateOrUpdateServiceWithIdentity() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
hostingMode: "default",
identity: { type: "SystemAssigned" },
location: "westus",
partitionCount: 1,
replicaCount: 3,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithIdentity.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
Identity = new ManagedServiceIdentity("SystemAssigned"),
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
},
"identity": {
"type": "SystemAssigned",
"principalId": "9d1e1f18-2122-4988-a11c-878782e40a5c",
"tenantId": "f686d426-8d16-42db-81b7-ab578e110ccd"
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
},
"identity": {
"type": "SystemAssigned",
"principalId": "9d1e1f18-2122-4988-a11c-878782e40a5c",
"tenantId": "f686d426-8d16-42db-81b7-ab578e110ccd"
}
}
SearchCreateOrUpdateWithSemanticSearch
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"semanticSearch": "free"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.SearchSemanticSearch;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateWithSemanticSearch.json
*/
/**
* Sample code: SearchCreateOrUpdateWithSemanticSearch.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCreateOrUpdateWithSemanticSearch(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(3).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT).withSemanticSearch(SearchSemanticSearch.FREE),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_with_semantic_search.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {"hostingMode": "default", "partitionCount": 1, "replicaCount": 3, "semanticSearch": "free"},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateWithSemanticSearch.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateWithSemanticSearch.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateWithSemanticSearch() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](3),
SemanticSearch: to.Ptr(armsearch.SearchSemanticSearchFree),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// AuthOptions: &armsearch.DataPlaneAuthOptions{
// APIKeyOnly: map[string]any{
// },
// },
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkUnspecified),
// },
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// SemanticSearch: to.Ptr(armsearch.SearchSemanticSearchFree),
// SharedPrivateLinkResources: []*armsearch.SharedPrivateLinkResource{
// },
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateWithSemanticSearch.json
*/
async function searchCreateOrUpdateWithSemanticSearch() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
hostingMode: "default",
location: "westus",
partitionCount: 1,
replicaCount: 3,
semanticSearch: "free",
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateWithSemanticSearch.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
SemanticSearch = SearchSemanticSearch.Free,
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Exempelsvar
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"semanticSearch": "free"
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"semanticSearch": "free"
}
}
Definitioner
Name |
Description |
AadAuthFailureMode
|
Beskriver vilket svar dataplans-API:et för en söktjänst skulle skicka för begäranden som misslyckades med autentiseringen.
|
ApiKeyOnly
|
Anger att endast API-nyckeln kan användas för autentisering.
|
CloudError
|
Innehåller information om ett API-fel.
|
CloudErrorBody
|
Beskriver ett visst API-fel med en felkod och ett meddelande.
|
DataPlaneAadOrApiKeyAuthOption
|
Anger att antingen API-nyckeln eller en åtkomsttoken från en Microsoft Entra ID klientorganisation kan användas för autentisering.
|
DataPlaneAuthOptions
|
Definierar alternativen för hur söktjänsten autentiserar en dataplansbegäran. Det går inte att ange om "disableLocalAuth" är inställt på true.
|
EncryptionWithCmk
|
Beskriver en princip som avgör hur resurser i söktjänsten ska krypteras med customer=managed keys.
|
HostingMode
|
Gäller endast för standard3-SKU:n. Du kan ange den här egenskapen för att aktivera upp till 3 högdensitetspartitioner som tillåter upp till 1 000 index, vilket är mycket högre än det högsta antalet index som tillåts för andra SKU:er. För standard3-SKU:n är värdet antingen "default" eller "highDensity". För alla andra SKU:er måste det här värdet vara "default".
|
Identity
|
Identitet för resursen.
|
IdentityType
|
Identitetstypen.
|
IpRule
|
Ip-begränsningsregeln för söktjänsten.
|
NetworkRuleSet
|
Nätverksspecifika regler som avgör hur söktjänsten kan nås.
|
PrivateEndpoint
|
Den privata slutpunktsresursen från Microsoft.Network-providern.
|
PrivateEndpointConnection
|
Beskriver en befintlig privat slutpunktsanslutning till söktjänsten.
|
PrivateEndpointConnectionProperties
|
Beskriver egenskaperna för en befintlig privat slutpunktsanslutning till söktjänsten.
|
PrivateLinkServiceConnectionProvisioningState
|
Etableringstillståndet för den privata länktjänstanslutningen. Giltiga värden är Uppdatera, Ta bort, Misslyckades, Lyckades eller Ofullständig
|
PrivateLinkServiceConnectionState
|
Beskriver det aktuella tillståndet för en befintlig Private Link Service-anslutning till den privata Azure-slutpunkten.
|
PrivateLinkServiceConnectionStatus
|
Status för den privata länktjänstens anslutning. Giltiga värden är Väntande, Godkänd, Avvisad eller Frånkopplad.
|
ProvisioningState
|
Tillståndet för den senaste etableringsåtgärden som utfördes på söktjänsten. Etablering är ett mellanliggande tillstånd som inträffar medan tjänstkapaciteten upprättas. När kapaciteten har konfigurerats ändras provisioningState till antingen "succeeded" eller "failed". Klientprogram kan avsöka etableringsstatus (det rekommenderade avsökningsintervallet är från 30 sekunder till en minut) med hjälp av åtgärden Hämta söktjänst för att se när en åtgärd har slutförts. Om du använder den kostnadsfria tjänsten tenderar det här värdet att komma tillbaka som "lyckades" direkt i anropet till Skapa söktjänst. Det beror på att den kostnadsfria tjänsten använder kapacitet som redan har konfigurerats.
|
PublicNetworkAccess
|
Det här värdet kan anges till "aktiverat" för att undvika icke-bakåtkompatibla ändringar av befintliga kundresurser och mallar. Om värdet är "inaktiverat" tillåts inte trafik via offentligt gränssnitt, och privata slutpunktsanslutningar skulle vara metoden för exklusiv åtkomst.
|
SearchEncryptionComplianceStatus
|
Beskriver om söktjänsten är kompatibel eller inte när det gäller icke-kundkrypterade resurser. Om en tjänst har mer än en icke-kundkrypterad resurs och "Tvingande" är "aktiverad" markeras tjänsten som "nonCompliant".
|
SearchEncryptionWithCmk
|
Beskriver hur en söktjänst ska framtvinga att ha en eller flera icke-kundkrypterade resurser.
|
SearchSemanticSearch
|
Anger alternativ som styr tillgängligheten för semantisk sökning. Den här konfigurationen är endast möjlig för vissa sök-SKU:er på vissa platser.
|
SearchService
|
Beskriver en söktjänst och dess aktuella tillstånd.
|
SearchServiceStatus
|
Status för söktjänsten. Möjliga värden är: "körs": Söktjänsten körs och inga etableringsåtgärder pågår. Etablering: Söktjänsten etableras eller skalas upp eller ned. "ta bort": Söktjänsten tas bort. "degraderad": Söktjänsten är degraderad. Detta kan inträffa när de underliggande sökenheterna inte är felfria. Söktjänsten är troligen i drift, men prestandan kan vara långsam och vissa begäranden kan tas bort. "disabled": Söktjänsten är inaktiverad. I det här tillståndet avvisar tjänsten alla API-begäranden. "error": Söktjänsten är i ett feltillstånd. Om tjänsten är i degraderat, inaktiverat eller feltillstånd undersöker Microsoft aktivt det underliggande problemet. Dedikerade tjänster i dessa tillstånd kan fortfarande debiteras baserat på antalet etablerade sökenheter.
|
SharedPrivateLinkResource
|
Beskriver en delad Private Link resurs som hanteras av söktjänsten.
|
SharedPrivateLinkResourceProperties
|
Beskriver egenskaperna för en befintlig delad Private Link resurs som hanteras av söktjänsten.
|
SharedPrivateLinkResourceProvisioningState
|
Etableringstillståndet för resursen för den delade privata länken. Giltiga värden är Uppdatera, Ta bort, Misslyckades, Lyckades eller Ofullständig.
|
SharedPrivateLinkResourceStatus
|
Status för resursen för den delade privata länken. Giltiga värden är Väntande, Godkänd, Avvisad eller Frånkopplad.
|
Sku
|
Definierar SKU:n för en söktjänst, som avgör faktureringshastighet och kapacitetsgränser.
|
SkuName
|
SKU:n för söktjänsten. Giltiga värden är: "kostnadsfri": Delad tjänst. "basic": Dedikerad tjänst med upp till 3 repliker. Standard: Dedikerad tjänst med upp till 12 partitioner och 12 repliker. "standard2": Liknar standard, men med mer kapacitet per sökenhet. "standard3": Det största standarderbjudandet med upp till 12 partitioner och 12 repliker (eller upp till 3 partitioner med fler index om du också ställer in egenskapen hostingMode till "highDensity"). "storage_optimized_l1": Stöder 1 TB per partition, upp till 12 partitioner. "storage_optimized_l2": Stöder 2 TB per partition, upp till 12 partitioner."
|
AadAuthFailureMode
Beskriver vilket svar dataplans-API:et för en söktjänst skulle skicka för begäranden som misslyckades med autentiseringen.
Name |
Typ |
Description |
http401WithBearerChallenge
|
string
|
Anger att begäranden om misslyckad autentisering ska visas med http-statuskoden 401 (obehörig) och presentera en ägarutmaning.
|
http403
|
string
|
Anger att begäranden om misslyckad autentisering ska visas med HTTP-statuskoden 403 (Förbjuden).
|
ApiKeyOnly
Anger att endast API-nyckeln kan användas för autentisering.
CloudError
Innehåller information om ett API-fel.
Name |
Typ |
Description |
error
|
CloudErrorBody
|
Beskriver ett visst API-fel med en felkod och ett meddelande.
|
CloudErrorBody
Beskriver ett visst API-fel med en felkod och ett meddelande.
Name |
Typ |
Description |
code
|
string
|
En felkod som beskriver feltillståndet mer exakt än en HTTP-statuskod. Kan användas för att programmatiskt hantera specifika felfall.
|
details
|
CloudErrorBody[]
|
Innehåller kapslade fel som är relaterade till det här felet.
|
message
|
string
|
Ett meddelande som beskriver felet i detalj och innehåller felsökningsinformation.
|
target
|
string
|
Målet för det specifika felet (till exempel namnet på egenskapen i fel).
|
DataPlaneAadOrApiKeyAuthOption
Anger att antingen API-nyckeln eller en åtkomsttoken från en Microsoft Entra ID klientorganisation kan användas för autentisering.
Name |
Typ |
Description |
aadAuthFailureMode
|
AadAuthFailureMode
|
Beskriver vilket svar dataplans-API:et för en söktjänst skulle skicka för begäranden som misslyckades med autentiseringen.
|
DataPlaneAuthOptions
Definierar alternativen för hur söktjänsten autentiserar en dataplansbegäran. Det går inte att ange om "disableLocalAuth" är inställt på true.
Name |
Typ |
Description |
aadOrApiKey
|
DataPlaneAadOrApiKeyAuthOption
|
Anger att antingen API-nyckeln eller en åtkomsttoken från en Microsoft Entra ID klientorganisation kan användas för autentisering.
|
apiKeyOnly
|
ApiKeyOnly
|
Anger att endast API-nyckeln kan användas för autentisering.
|
EncryptionWithCmk
Beskriver en princip som avgör hur resurser i söktjänsten ska krypteras med customer=managed keys.
Name |
Typ |
Description |
encryptionComplianceStatus
|
SearchEncryptionComplianceStatus
|
Beskriver om söktjänsten är kompatibel eller inte när det gäller att ha icke-kundkrypterade resurser. Om en tjänst har mer än en icke-kundkrypterad resurs och "Enforcement" är "aktiverad" markeras tjänsten som "icke-kompatibel".
|
enforcement
|
SearchEncryptionWithCmk
|
Beskriver hur en söktjänst ska framtvinga att ha en eller flera icke-kundkrypterade resurser.
|
HostingMode
Gäller endast för standard3-SKU:n. Du kan ange den här egenskapen för att aktivera upp till 3 högdensitetspartitioner som tillåter upp till 1 000 index, vilket är mycket högre än det högsta antalet index som tillåts för andra SKU:er. För standard3-SKU:n är värdet antingen "default" eller "highDensity". För alla andra SKU:er måste det här värdet vara "default".
Name |
Typ |
Description |
default
|
string
|
Gränsen för antalet index bestäms av standardgränserna för SKU:n.
|
highDensity
|
string
|
Endast program för Standard3 SKU, där söktjänsten kan ha upp till 1 000 index.
|
Identity
Identitet för resursen.
Name |
Typ |
Description |
principalId
|
string
|
Huvud-ID för söktjänstens systemtilldelade identitet.
|
tenantId
|
string
|
Klientorganisations-ID för söktjänstens systemtilldelade identitet.
|
type
|
IdentityType
|
Identitetstypen.
|
IdentityType
Identitetstypen.
Name |
Typ |
Description |
None
|
string
|
|
SystemAssigned
|
string
|
|
IpRule
Ip-begränsningsregeln för söktjänsten.
Name |
Typ |
Description |
value
|
string
|
Värde som motsvarar en enda IPv4-adress (till exempel 123.1.2.3) eller ett IP-intervall i CIDR-format (till exempel 123.1.2.3/24) som tillåts.
|
NetworkRuleSet
Nätverksspecifika regler som avgör hur söktjänsten kan nås.
Name |
Typ |
Description |
ipRules
|
IpRule[]
|
En lista över IP-begränsningsregler som används för en IP-brandvägg. Ip-adresser som inte matchar reglerna blockeras av brandväggen. Dessa regler tillämpas endast när "publicNetworkAccess" för söktjänsten är "aktiverad".
|
PrivateEndpoint
Den privata slutpunktsresursen från Microsoft.Network-providern.
Name |
Typ |
Description |
id
|
string
|
Resurs-ID för den privata slutpunktsresursen från Microsoft.Network-providern.
|
PrivateEndpointConnection
Beskriver en befintlig privat slutpunktsanslutning till söktjänsten.
Name |
Typ |
Description |
id
|
string
|
Fullständigt kvalificerat resurs-ID för resursen. Ex – /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
Namnet på resursen
|
properties
|
PrivateEndpointConnectionProperties
|
Beskriver egenskaperna för en befintlig privat slutpunktsanslutning till söktjänsten.
|
type
|
string
|
Resurstypen. Till exempel "Microsoft.Compute/virtualMachines" eller "Microsoft.Storage/storageAccounts"
|
PrivateEndpointConnectionProperties
Beskriver egenskaperna för en befintlig privat slutpunktsanslutning till söktjänsten.
Name |
Typ |
Description |
groupId
|
string
|
Grupp-ID:t från resursprovidern som private link-tjänstanslutningen är till för.
|
privateEndpoint
|
PrivateEndpoint
|
Den privata slutpunktsresursen från Microsoft.Network-providern.
|
privateLinkServiceConnectionState
|
PrivateLinkServiceConnectionState
|
Beskriver det aktuella tillståndet för en befintlig Private Link Service-anslutning till den privata Azure-slutpunkten.
|
provisioningState
|
PrivateLinkServiceConnectionProvisioningState
|
Etableringstillståndet för den privata länktjänstanslutningen. Giltiga värden är Uppdatera, Ta bort, Misslyckades, Lyckades eller Ofullständig
|
PrivateLinkServiceConnectionProvisioningState
Etableringstillståndet för den privata länktjänstanslutningen. Giltiga värden är Uppdatera, Ta bort, Misslyckades, Lyckades eller Ofullständig
Name |
Typ |
Description |
Canceled
|
string
|
Etableringsbegäran för den privata länktjänstens anslutningsresurs har avbrutits
|
Deleting
|
string
|
Den privata länktjänstanslutningen håller på att tas bort.
|
Failed
|
string
|
Det gick inte att etablera eller ta bort den privata länktjänstens anslutning.
|
Incomplete
|
string
|
Etableringsbegäran för den privata länktjänstens anslutningsresurs har accepterats, men processen för att skapa har inte påbörjats ännu.
|
Succeeded
|
string
|
Den privata länktjänstanslutningen har slutfört etableringen och är klar för godkännande.
|
Updating
|
string
|
Den privata länktjänstanslutningen håller på att skapas tillsammans med andra resurser för att den ska fungera fullt ut.
|
PrivateLinkServiceConnectionState
Beskriver det aktuella tillståndet för en befintlig Private Link Service-anslutning till den privata Azure-slutpunkten.
Name |
Typ |
Standardvärde |
Description |
actionsRequired
|
string
|
None
|
En beskrivning av eventuella extra åtgärder som kan krävas.
|
description
|
string
|
|
Beskrivning av anslutningstillståndet för tjänsten Private Link.
|
status
|
PrivateLinkServiceConnectionStatus
|
|
Status för private link-tjänstanslutningen. Giltiga värden är Väntar, Godkänd, Avvisad eller Frånkopplad.
|
PrivateLinkServiceConnectionStatus
Status för den privata länktjänstens anslutning. Giltiga värden är Väntande, Godkänd, Avvisad eller Frånkopplad.
Name |
Typ |
Description |
Approved
|
string
|
Den privata slutpunktsanslutningen är godkänd och är redo att användas.
|
Disconnected
|
string
|
Den privata slutpunktsanslutningen har tagits bort från tjänsten.
|
Pending
|
string
|
Den privata slutpunktsanslutningen har skapats och väntar på godkännande.
|
Rejected
|
string
|
Den privata slutpunktsanslutningen har avvisats och kan inte användas.
|
ProvisioningState
Tillståndet för den senaste etableringsåtgärden som utfördes på söktjänsten. Etablering är ett mellanliggande tillstånd som inträffar medan tjänstkapaciteten upprättas. När kapaciteten har konfigurerats ändras provisioningState till antingen "succeeded" eller "failed". Klientprogram kan avsöka etableringsstatus (det rekommenderade avsökningsintervallet är från 30 sekunder till en minut) med hjälp av åtgärden Hämta söktjänst för att se när en åtgärd har slutförts. Om du använder den kostnadsfria tjänsten tenderar det här värdet att komma tillbaka som "lyckades" direkt i anropet till Skapa söktjänst. Det beror på att den kostnadsfria tjänsten använder kapacitet som redan har konfigurerats.
Name |
Typ |
Description |
failed
|
string
|
Den senaste etableringsåtgärden misslyckades.
|
provisioning
|
string
|
Söktjänsten etableras eller skalas upp eller ned.
|
succeeded
|
string
|
Den senaste etableringsåtgärden har slutförts.
|
PublicNetworkAccess
Det här värdet kan anges till "aktiverat" för att undvika icke-bakåtkompatibla ändringar av befintliga kundresurser och mallar. Om värdet är "inaktiverat" tillåts inte trafik via offentligt gränssnitt, och privata slutpunktsanslutningar skulle vara metoden för exklusiv åtkomst.
Name |
Typ |
Description |
disabled
|
string
|
|
enabled
|
string
|
|
SearchEncryptionComplianceStatus
Beskriver om söktjänsten är kompatibel eller inte när det gäller icke-kundkrypterade resurser. Om en tjänst har mer än en icke-kundkrypterad resurs och "Tvingande" är "aktiverad" markeras tjänsten som "nonCompliant".
Name |
Typ |
Description |
Compliant
|
string
|
Anger att söktjänsten är kompatibel, antingen på grund av att antalet icke-kundkrypterade resurser är noll eller att tvingande är inaktiverat.
|
NonCompliant
|
string
|
Anger att söktjänsten har fler än en icke-kundkrypterad resurs.
|
SearchEncryptionWithCmk
Beskriver hur en söktjänst ska framtvinga att ha en eller flera icke-kundkrypterade resurser.
Name |
Typ |
Description |
Disabled
|
string
|
Ingen tillämpning görs och söktjänsten kan ha icke-kundkrypterade resurser.
|
Enabled
|
string
|
tjänsten Search markeras som icke-kompatibla om det finns en eller flera icke-kundkrypterade resurser.
|
Unspecified
|
string
|
Tvingande princip har inte uttryckligen angetts, och beteendet är detsamma som om det hade angetts till "Inaktiverad".
|
SearchSemanticSearch
Anger alternativ som styr tillgängligheten för semantisk sökning. Den här konfigurationen är endast möjlig för vissa sök-SKU:er på vissa platser.
Name |
Typ |
Description |
disabled
|
string
|
Anger att semantisk rangordning är inaktiverat för söktjänsten.
|
free
|
string
|
Aktiverar semantisk rangordning för en söktjänst och anger att den ska användas inom gränserna för den kostnadsfria nivån. Detta skulle begränsa volymen av semantiska rankningsförfrågningar och erbjuds utan extra kostnad. Detta är standard för nyligen etablerade söktjänster.
|
standard
|
string
|
Aktiverar semantisk rangordning för en söktjänst som en fakturerbar funktion, med högre dataflöde och volym av semantiska rangordningsbegäranden.
|
SearchService
Beskriver en söktjänst och dess aktuella tillstånd.
Name |
Typ |
Standardvärde |
Description |
id
|
string
|
|
Fullständigt kvalificerat resurs-ID för resursen. Ex – /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
identity
|
Identity
|
|
Resursens identitet.
|
location
|
string
|
|
Den geo-plats där resursen finns
|
name
|
string
|
|
Namnet på resursen
|
properties.authOptions
|
DataPlaneAuthOptions
|
|
Definierar alternativen för hur dataplanets API för en söktjänst autentiserar begäranden. Det går inte att ange om "disableLocalAuth" är inställt på true.
|
properties.disableLocalAuth
|
boolean
|
|
När värdet är true tillåts inte anrop till söktjänsten att använda API-nycklar för autentisering. Detta kan inte anges till sant om "dataPlaneAuthOptions" har definierats.
|
properties.encryptionWithCmk
|
EncryptionWithCmk
|
|
Anger alla principer för kryptering av resurser (till exempel index) med hjälp av kundhanterarnycklar i en söktjänst.
|
properties.hostingMode
|
HostingMode
|
default
|
Gäller endast för standard3 SKU. Du kan ange den här egenskapen för att aktivera upp till 3 partitioner med hög densitet som tillåter upp till 1 000 index, vilket är mycket högre än de högsta index som tillåts för andra SKU:er. För standard3 SKU är värdet antingen "default" eller "highDensity". För alla andra SKU:er måste det här värdet vara "standard".
|
properties.networkRuleSet
|
NetworkRuleSet
|
|
Nätverksspecifika regler som avgör hur söktjänsten kan nås.
|
properties.partitionCount
|
integer
|
1
|
Antalet partitioner i söktjänsten. om det anges kan det vara 1, 2, 3, 4, 6 eller 12. Värden som är större än 1 är endast giltiga för standard-SKU:er. För "standard3"-tjänster med hostingMode inställt på "highDensity" är de tillåtna värdena mellan 1 och 3.
|
properties.privateEndpointConnections
|
PrivateEndpointConnection[]
|
|
Listan över privata slutpunktsanslutningar till söktjänsten.
|
properties.provisioningState
|
ProvisioningState
|
|
Tillståndet för den senaste etableringsåtgärden som utfördes på söktjänsten. Etablering är ett mellanliggande tillstånd som inträffar när tjänstkapaciteten upprättas. När kapaciteten har konfigurerats ändras provisioningState till antingen "succeeded" eller "failed". Klientprogram kan avsöka etableringsstatus (det rekommenderade avsökningsintervallet är från 30 sekunder till en minut) med hjälp av åtgärden Hämta söktjänst för att se när en åtgärd har slutförts. Om du använder den kostnadsfria tjänsten tenderar det här värdet att komma tillbaka som "lyckades" direkt i anropet till Skapa söktjänst. Det beror på att den kostnadsfria tjänsten använder kapacitet som redan har konfigurerats.
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
enabled
|
Det här värdet kan anges till "aktiverat" för att undvika icke-bakåtkompatibla ändringar av befintliga kundresurser och mallar. Om inställningen är "inaktiverad" tillåts inte trafik via det offentliga gränssnittet och privata slutpunktsanslutningar är den exklusiva åtkomstmetoden.
|
properties.replicaCount
|
integer
|
1
|
Antalet repliker i söktjänsten. Om det anges måste det vara ett värde mellan 1 och 12 för standard-SKU:er eller mellan 1 och 3 för grundläggande SKU.
|
properties.semanticSearch
|
SearchSemanticSearch
|
|
Anger alternativ som styr tillgängligheten för semantisk sökning. Den här konfigurationen är endast möjlig för vissa sök-SKU:er på vissa platser.
|
properties.sharedPrivateLinkResources
|
SharedPrivateLinkResource[]
|
|
Listan över delade privata länkresurser som hanteras av söktjänsten.
|
properties.status
|
SearchServiceStatus
|
|
Söktjänstens status. Möjliga värden är: "körs": Söktjänsten körs och inga etableringsåtgärder pågår. "etablering": Söktjänsten etableras eller skalas upp eller ned. "ta bort": Söktjänsten tas bort. "degraderad": Söktjänsten är degraderad. Detta kan inträffa när de underliggande sökenheterna inte är felfria. Söktjänsten är troligen i drift, men prestandan kan vara långsam och vissa begäranden kan tas bort. "disabled": Söktjänsten är inaktiverad. I det här tillståndet avvisar tjänsten alla API-begäranden. "error": Söktjänsten är i ett feltillstånd. Om tjänsten är i degraderat, inaktiverat eller feltillstånd undersöker Microsoft aktivt det underliggande problemet. Dedikerade tjänster i dessa tillstånd kan fortfarande debiteras baserat på antalet etablerade sökenheter.
|
properties.statusDetails
|
string
|
|
Information om söktjänstens status.
|
sku
|
Sku
|
|
SKU:n för söktjänsten, som avgör faktureringshastighet och kapacitetsgränser. Den här egenskapen krävs när du skapar en ny söktjänst.
|
tags
|
object
|
|
Resurstaggar.
|
type
|
string
|
|
Resurstypen. Till exempel "Microsoft.Compute/virtualMachines" eller "Microsoft.Storage/storageAccounts"
|
SearchServiceStatus
Status för söktjänsten. Möjliga värden är: "körs": Söktjänsten körs och inga etableringsåtgärder pågår. Etablering: Söktjänsten etableras eller skalas upp eller ned. "ta bort": Söktjänsten tas bort. "degraderad": Söktjänsten är degraderad. Detta kan inträffa när de underliggande sökenheterna inte är felfria. Söktjänsten är troligen i drift, men prestandan kan vara långsam och vissa begäranden kan tas bort. "disabled": Söktjänsten är inaktiverad. I det här tillståndet avvisar tjänsten alla API-begäranden. "error": Söktjänsten är i ett feltillstånd. Om tjänsten är i degraderat, inaktiverat eller feltillstånd undersöker Microsoft aktivt det underliggande problemet. Dedikerade tjänster i dessa tillstånd kan fortfarande debiteras baserat på antalet etablerade sökenheter.
Name |
Typ |
Description |
degraded
|
string
|
Söktjänsten har nedgraderats eftersom underliggande sökenheter inte är felfria.
|
deleting
|
string
|
Söktjänsten tas bort.
|
disabled
|
string
|
Söktjänsten är inaktiverad och alla API-begäranden avvisas.
|
error
|
string
|
Söktjänsten är i feltillstånd, vilket indikerar antingen att det inte gick att etablera eller att den skulle tas bort.
|
provisioning
|
string
|
Söktjänsten etableras eller skalas upp eller ned.
|
running
|
string
|
Söktjänsten körs och inga etableringsåtgärder pågår.
|
SharedPrivateLinkResource
Beskriver en delad Private Link resurs som hanteras av söktjänsten.
Name |
Typ |
Description |
id
|
string
|
Fullständigt kvalificerat resurs-ID för resursen. Ex – /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
Namnet på resursen
|
properties
|
SharedPrivateLinkResourceProperties
|
Beskriver egenskaperna för en delad Private Link resurs som hanteras av söktjänsten.
|
type
|
string
|
Resurstypen. Till exempel "Microsoft.Compute/virtualMachines" eller "Microsoft.Storage/storageAccounts"
|
SharedPrivateLinkResourceProperties
Beskriver egenskaperna för en befintlig delad Private Link resurs som hanteras av söktjänsten.
Name |
Typ |
Description |
groupId
|
string
|
Grupp-ID:t från resursprovidern som den delade privata länkresursen är till för.
|
privateLinkResourceId
|
string
|
Resurs-ID:t för resursen som den delade privata länkresursen är för.
|
provisioningState
|
SharedPrivateLinkResourceProvisioningState
|
Etableringstillståndet för resursen för delad privat länk. Giltiga värden är Uppdatera, Ta bort, Misslyckades, Lyckades eller Ofullständig.
|
requestMessage
|
string
|
Begärandemeddelandet för att begära godkännande av resursen för delad privat länk.
|
resourceRegion
|
string
|
Valfritt. Kan användas för att ange azure-Resource Manager plats för resursen som en delad privat länk ska skapas till. Detta krävs endast för de resurser vars DNS-konfiguration är regional (till exempel Azure Kubernetes Service).
|
status
|
SharedPrivateLinkResourceStatus
|
Status för resursen för delad privat länk. Giltiga värden är Väntar, Godkänd, Avvisad eller Frånkopplad.
|
SharedPrivateLinkResourceProvisioningState
Etableringstillståndet för resursen för den delade privata länken. Giltiga värden är Uppdatera, Ta bort, Misslyckades, Lyckades eller Ofullständig.
Name |
Typ |
Description |
Deleting
|
string
|
|
Failed
|
string
|
|
Incomplete
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|
SharedPrivateLinkResourceStatus
Status för resursen för den delade privata länken. Giltiga värden är Väntande, Godkänd, Avvisad eller Frånkopplad.
Name |
Typ |
Description |
Approved
|
string
|
|
Disconnected
|
string
|
|
Pending
|
string
|
|
Rejected
|
string
|
|
Sku
Definierar SKU:n för en söktjänst, som avgör faktureringshastighet och kapacitetsgränser.
Name |
Typ |
Description |
name
|
SkuName
|
SKU:n för söktjänsten. Giltiga värden är: "kostnadsfri": Delad tjänst. "basic": Dedikerad tjänst med upp till 3 repliker. Standard: Dedikerad tjänst med upp till 12 partitioner och 12 repliker. "standard2": Liknar standard, men med mer kapacitet per sökenhet. "standard3": Det största standarderbjudandet med upp till 12 partitioner och 12 repliker (eller upp till 3 partitioner med fler index om du också ställer in egenskapen hostingMode till "highDensity"). "storage_optimized_l1": Stöder 1 TB per partition, upp till 12 partitioner. "storage_optimized_l2": Stöder 2 TB per partition, upp till 12 partitioner.
|
SkuName
SKU:n för söktjänsten. Giltiga värden är: "kostnadsfri": Delad tjänst. "basic": Dedikerad tjänst med upp till 3 repliker. Standard: Dedikerad tjänst med upp till 12 partitioner och 12 repliker. "standard2": Liknar standard, men med mer kapacitet per sökenhet. "standard3": Det största standarderbjudandet med upp till 12 partitioner och 12 repliker (eller upp till 3 partitioner med fler index om du också ställer in egenskapen hostingMode till "highDensity"). "storage_optimized_l1": Stöder 1 TB per partition, upp till 12 partitioner. "storage_optimized_l2": Stöder 2 TB per partition, upp till 12 partitioner."
Name |
Typ |
Description |
basic
|
string
|
Fakturerbar nivå för en dedikerad tjänst som har upp till 3 repliker.
|
free
|
string
|
Kostnadsfri nivå, utan SLA-garantier och en delmängd av de funktioner som erbjuds på fakturerbara nivåer.
|
standard
|
string
|
Fakturerbar nivå för en dedikerad tjänst som har upp till 12 partitioner och 12 repliker.
|
standard2
|
string
|
Liknar "standard", men med mer kapacitet per sökenhet.
|
standard3
|
string
|
Det största standarderbjudandet med upp till 12 partitioner och 12 repliker (eller upp till 3 partitioner med fler index om du också anger egenskapen hostingMode till "highDensity").
|
storage_optimized_l1
|
string
|
Fakturerbar nivå för en dedikerad tjänst som stöder 1 TB per partition, upp till 12 partitioner.
|
storage_optimized_l2
|
string
|
Fakturerbar nivå för en dedikerad tjänst som stöder 2 TB per partition, upp till 12 partitioner.
|