Crée ou met à jour un service de recherche dans le groupe de ressources donné. Si le service de recherche existe déjà, toutes les propriétés sont mises à jour avec les valeurs données.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}?api-version=2025-05-01
Paramètres URI
| Nom |
Dans |
Obligatoire |
Type |
Description |
|
resourceGroupName
|
path |
True
|
string
|
Nom du groupe de ressources dans l’abonnement actuel. Vous pouvez obtenir cette valeur à partir de l’API Azure Resource Manager ou du portail.
|
|
searchServiceName
|
path |
True
|
string
|
Nom du service Recherche d’IA Azure à créer ou à mettre à jour. Les noms de service de recherche ne doivent contenir que des lettres minuscules, des chiffres ou des tirets, ne peuvent pas utiliser de tirets comme premiers ou derniers caractères, ne peuvent pas contenir de tirets consécutifs et doivent être compris entre 2 et 60 caractères. Les noms de service de recherche doivent être uniques, car ils font partie de l’URI du service (https://< nom.search.windows.net>). Vous ne pouvez pas modifier le nom du service une fois le service créé.
|
|
subscriptionId
|
path |
True
|
string
|
Identificateur unique d’un abonnement Microsoft Azure. Vous pouvez obtenir cette valeur à partir de l’API Azure Resource Manager ou du portail.
|
|
api-version
|
query |
True
|
string
|
Version de l’API à utiliser pour chaque requête.
|
| Nom |
Obligatoire |
Type |
Description |
|
x-ms-client-request-id
|
|
string
(uuid)
|
Valeur GUID générée par le client qui identifie cette requête. S’il est spécifié, cela sera inclus dans les informations de réponse comme moyen de suivre la demande.
|
Corps de la demande
| Nom |
Obligatoire |
Type |
Description |
|
location
|
True
|
string
|
Emplacement géographique où réside la ressource
|
|
identity
|
|
Identity
|
Identité de la ressource.
|
|
properties.authOptions
|
|
DataPlaneAuthOptions
|
Définit les options pour la façon dont l’API de plan de données d’un service de recherche authentifie les demandes. Cela ne peut pas être défini si « disableLocalAuth » a la valeur true.
|
|
properties.computeType
|
|
ComputeType
|
Configurez cette propriété pour prendre en charge le service de recherche à l’aide du calcul par défaut ou du calcul confidentiel Azure.
|
|
properties.dataExfiltrationProtections
|
|
SearchDataExfiltrationProtection[]
|
Liste des scénarios d’exfiltration de données qui sont explicitement interdits pour le service de recherche. Actuellement, la seule valeur prise en charge est « All » pour désactiver tous les scénarios d’exportation de données possibles avec des contrôles plus précis prévus pour l’avenir.
|
|
properties.disableLocalAuth
|
|
boolean
|
Lorsque la valeur est true, les appels au service de recherche ne sont pas autorisés à utiliser les clés API pour l’authentification. Cela ne peut pas être défini sur true si « dataPlaneAuthOptions » sont définis.
|
|
properties.encryptionWithCmk
|
|
EncryptionWithCmk
|
Spécifie toute stratégie concernant le chiffrement des ressources (telles que les index) à l’aide de clés de gestionnaire de clients au sein d’un service de recherche.
|
|
properties.endpoint
|
|
string
(uri)
|
Point de terminaison du service Recherche d’IA Azure.
|
|
properties.hostingMode
|
|
HostingMode
|
Applicable uniquement pour la référence SKU standard3. Vous pouvez définir cette propriété pour activer jusqu’à 3 partitions à haute densité qui autorisent jusqu’à 1 000 index, ce qui est beaucoup plus élevé que les index maximum autorisés pour toute autre référence SKU. Pour la référence SKU standard3, la valeur est « default » ou « highDensity ». Pour toutes les autres références SKU, cette valeur doit être « par défaut ».
|
|
properties.networkRuleSet
|
|
NetworkRuleSet
|
Règles spécifiques au réseau qui déterminent la façon dont le service Recherche d’IA Azure peut être atteint.
|
|
properties.partitionCount
|
|
integer
(int32)
minimum: 1 maximum: 12
|
Nombre de partitions dans le service de recherche ; si spécifié, il peut s’agir de 1, 2, 3, 4, 6 ou 12. Les valeurs supérieures à 1 sont valides uniquement pour les références SKU standard. Pour les services « standard3 » avec hostingMode défini sur « highDensity », les valeurs autorisées sont comprises entre 1 et 3.
|
|
properties.publicNetworkAccess
|
|
PublicNetworkAccess
|
Cette valeur peut être définie sur « activé » pour éviter les modifications cassants sur les ressources et les modèles clients existants. Si la valeur est « désactivée », le trafic sur l’interface publique n’est pas autorisé et les connexions de point de terminaison privé sont la méthode d’accès exclusive.
|
|
properties.replicaCount
|
|
integer
(int32)
minimum: 1 maximum: 12
|
Nombre de réplicas dans le service de recherche. S’il est spécifié, il doit s’agir d’une valeur comprise entre 1 et 12 inclus pour les références SKU standard ou comprises entre 1 et 3 pour la référence SKU de base.
|
|
properties.semanticSearch
|
|
SearchSemanticSearch
|
Définit les options qui contrôlent la disponibilité de la recherche sémantique. Cette configuration n’est possible que pour certaines références SKU Azure AI Search dans certains emplacements.
|
|
properties.upgradeAvailable
|
|
UpgradeAvailable
|
Indique si le service de recherche dispose d’une mise à niveau disponible.
|
|
sku
|
|
Sku
|
Référence SKU du service de recherche, qui détermine le niveau tarifaire et les limites de capacité. Cette propriété est requise lors de la création d’un service de recherche.
|
|
tags
|
|
object
|
Balises de ressource.
|
Réponses
| Nom |
Type |
Description |
|
200 OK
|
SearchService
|
La définition de service existante a été correctement mise à jour. Si vous avez modifié le nombre de réplicas ou de partitions, l’opération de mise à l’échelle se produit de manière asynchrone. Vous pouvez vérifier l’état d’une opération de mise à l’échelle via la propriété provisioningState retournée dans la réponse à une demande Get Service.
|
|
201 Created
|
SearchService
|
Si vous avez demandé la création d’un service de recherche gratuit, le service est désormais approvisionné et prêt à être utilisé, sous réserve du délai de propagation DNS. Pour les autres types de référence SKU, l’approvisionnement se produit de manière asynchrone. Vous pouvez vérifier l’état d’une opération de mise à l’échelle via la propriété provisioningState retournée dans la réponse à une demande Get Service.
|
|
Other Status Codes
|
CloudError
|
HTTP 400 (requête incorrecte) : le nom de service ou la définition de service donné n’est pas valide. Pour plus d’informations, consultez le code d’erreur et le message dans la réponse. HTTP 404 (introuvable) : l’abonnement ou le groupe de ressources est introuvable. HTTP 409 (Conflit) : l’abonnement spécifié est désactivé.
|
Sécurité
azure_auth
Spécifie un flux d’octroi implicite, tel qu’il est pris en charge sur la plateforme Microsoft Identity.
Type:
oauth2
Flux:
implicit
URL d’autorisation:
https://login.microsoftonline.com/common/oauth2/authorize
Étendues
| Nom |
Description |
|
user_impersonation
|
emprunter l’identité de votre compte d’utilisateur
|
Exemples
SearchCreateOrUpdateService
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2025-05-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"computeType": "default"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.ComputeType;
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/2025-05-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).withComputeType(ComputeType.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": {"computeType": "default", "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/2025-05-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/fb3217991ff57b5760525aeba1a0670bfe0880fa/specification/search/resource-manager/Microsoft.Search/stable/2025-05-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{
ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
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"),
// SystemData: &armsearch.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
// CreatedBy: to.Ptr("My e-commerce app"),
// CreatedByType: to.Ptr(armsearch.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T00:00:00.000Z"); return t}()),
// LastModifiedBy: to.Ptr("fakeuser@contoso.com"),
// LastModifiedByType: to.Ptr(armsearch.CreatedByTypeUser),
// },
// 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{
// },
// },
// ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
// DataExfiltrationProtections: []*armsearch.SearchDataExfiltrationProtection{
// },
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkUnspecified),
// },
// Endpoint: to.Ptr("https://mysearchservice.search.windows.net/"),
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// Bypass: to.Ptr(armsearch.SearchBypassNone),
// 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(""),
// UpgradeAvailable: to.Ptr(armsearch.UpgradeAvailableNotAvailable),
// },
// 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");
require("dotenv/config");
/**
* 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/2025-05-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 = {
computeType: "default",
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search.Models;
using Azure.ResourceManager.Search;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2025-05-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"))
{
SearchSkuName = SearchServiceSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
ComputeType = SearchServiceComputeType.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
Exemple de réponse
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
SearchCreateOrUpdateServiceAuthOptions
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2025-05-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"computeType": "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.ComputeType;
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/2025-05-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).withComputeType(ComputeType.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"}},
"computeType": "default",
"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/2025-05-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/fb3217991ff57b5760525aeba1a0670bfe0880fa/specification/search/resource-manager/Microsoft.Search/stable/2025-05-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),
},
},
ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
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"),
// SystemData: &armsearch.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
// CreatedBy: to.Ptr("My e-commerce app"),
// CreatedByType: to.Ptr(armsearch.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T00:00:00.000Z"); return t}()),
// LastModifiedBy: to.Ptr("fakeuser@contoso.com"),
// LastModifiedByType: to.Ptr(armsearch.CreatedByTypeUser),
// },
// 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),
// },
// },
// ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
// DataExfiltrationProtections: []*armsearch.SearchDataExfiltrationProtection{
// },
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkUnspecified),
// },
// Endpoint: to.Ptr("https://mysearchservice.search.windows.net/"),
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// Bypass: to.Ptr(armsearch.SearchBypassNone),
// 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(""),
// UpgradeAvailable: to.Ptr(armsearch.UpgradeAvailableNotAvailable),
// },
// 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");
require("dotenv/config");
/**
* 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/2025-05-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" },
},
computeType: "default",
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search.Models;
using Azure.ResourceManager.Search;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2025-05-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"))
{
SearchSkuName = SearchServiceSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
ComputeType = SearchServiceComputeType.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
Exemple de réponse
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"authOptions": {
"aadOrApiKey": {
"aadAuthFailureMode": "http401WithBearerChallenge"
}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"authOptions": {
"aadOrApiKey": {
"aadAuthFailureMode": "http401WithBearerChallenge"
}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
SearchCreateOrUpdateServiceDisableLocalAuth
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2025-05-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"computeType": "default",
"disableLocalAuth": true
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.ComputeType;
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/2025-05-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).withComputeType(ComputeType.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": {
"computeType": "default",
"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/2025-05-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/fb3217991ff57b5760525aeba1a0670bfe0880fa/specification/search/resource-manager/Microsoft.Search/stable/2025-05-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{
ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
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"),
// SystemData: &armsearch.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
// CreatedBy: to.Ptr("My e-commerce app"),
// CreatedByType: to.Ptr(armsearch.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T00:00:00.000Z"); return t}()),
// LastModifiedBy: to.Ptr("fakeuser@contoso.com"),
// LastModifiedByType: to.Ptr(armsearch.CreatedByTypeUser),
// },
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
// DataExfiltrationProtections: []*armsearch.SearchDataExfiltrationProtection{
// },
// DisableLocalAuth: to.Ptr(true),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkUnspecified),
// },
// Endpoint: to.Ptr("https://mysearchservice.search.windows.net/"),
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// Bypass: to.Ptr(armsearch.SearchBypassNone),
// 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(""),
// UpgradeAvailable: to.Ptr(armsearch.UpgradeAvailableNotAvailable),
// },
// 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");
require("dotenv/config");
/**
* 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/2025-05-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 = {
computeType: "default",
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search.Models;
using Azure.ResourceManager.Search;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2025-05-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"))
{
SearchSkuName = SearchServiceSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
ComputeType = SearchServiceComputeType.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
Exemple de réponse
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": true,
"authOptions": null,
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": true,
"authOptions": null,
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2025-05-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"publicNetworkAccess": "disabled",
"hostingMode": "default",
"computeType": "default"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.ComputeType;
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/2025-05-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).withComputeType(ComputeType.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": {
"computeType": "default",
"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/2025-05-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/fb3217991ff57b5760525aeba1a0670bfe0880fa/specification/search/resource-manager/Microsoft.Search/stable/2025-05-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{
ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
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"),
// SystemData: &armsearch.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
// CreatedBy: to.Ptr("My e-commerce app"),
// CreatedByType: to.Ptr(armsearch.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T00:00:00.000Z"); return t}()),
// LastModifiedBy: to.Ptr("fakeuser@contoso.com"),
// LastModifiedByType: to.Ptr(armsearch.CreatedByTypeUser),
// },
// 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{
// },
// },
// ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
// DataExfiltrationProtections: []*armsearch.SearchDataExfiltrationProtection{
// },
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkUnspecified),
// },
// Endpoint: to.Ptr("https://mysearchservice.search.windows.net/"),
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// Bypass: to.Ptr(armsearch.SearchBypassNone),
// 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),
// SharedPrivateLinkResources: []*armsearch.SharedPrivateLinkResource{
// },
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// UpgradeAvailable: to.Ptr(armsearch.UpgradeAvailableNotAvailable),
// },
// 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");
require("dotenv/config");
/**
* 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/2025-05-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 = {
computeType: "default",
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search.Models;
using Azure.ResourceManager.Search;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2025-05-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"))
{
SearchSkuName = SearchServiceSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
ComputeType = SearchServiceComputeType.Default,
PublicInternetAccess = SearchServicePublicInternetAccess.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
Exemple de réponse
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "disabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "disabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2025-05-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",
"computeType": "default"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.ComputeType;
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/2025-05-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).withComputeType(ComputeType.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": {
"computeType": "default",
"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/2025-05-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/fb3217991ff57b5760525aeba1a0670bfe0880fa/specification/search/resource-manager/Microsoft.Search/stable/2025-05-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{
ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
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"),
// SystemData: &armsearch.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
// CreatedBy: to.Ptr("My e-commerce app"),
// CreatedByType: to.Ptr(armsearch.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T00:00:00.000Z"); return t}()),
// LastModifiedBy: to.Ptr("fakeuser@contoso.com"),
// LastModifiedByType: to.Ptr(armsearch.CreatedByTypeUser),
// },
// 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{
// },
// },
// ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
// DataExfiltrationProtections: []*armsearch.SearchDataExfiltrationProtection{
// },
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkUnspecified),
// },
// Endpoint: to.Ptr("https://mysearchservice.search.windows.net/"),
// 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),
// SharedPrivateLinkResources: []*armsearch.SharedPrivateLinkResource{
// },
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// UpgradeAvailable: to.Ptr(armsearch.UpgradeAvailableNotAvailable),
// },
// 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");
require("dotenv/config");
/**
* 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/2025-05-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 = {
computeType: "default",
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search.Models;
using Azure.ResourceManager.Search;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2025-05-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"))
{
SearchSkuName = SearchServiceSkuName.Standard,
ReplicaCount = 1,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
ComputeType = SearchServiceComputeType.Default,
NetworkRuleSet = new SearchServiceNetworkRuleSet
{
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
Exemple de réponse
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [
{
"value": "123.4.5.6"
},
{
"value": "123.4.6.0/18"
}
]
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [
{
"value": "123.4.5.6"
},
{
"value": "123.4.6.0/18"
}
]
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2025-05-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"
}
],
"bypass": "AzureServices"
},
"hostingMode": "default",
"computeType": "default"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.ComputeType;
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.SearchBypass;
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/2025-05-01/examples/
* SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass(
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).withComputeType(ComputeType.DEFAULT)
.withNetworkRuleSet(new NetworkRuleSet()
.withIpRules(
Arrays.asList(new IpRule().withValue("123.4.5.6"), new IpRule().withValue("123.4.6.0/18")))
.withBypass(SearchBypass.AZURE_SERVICES)),
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_and_bypass.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": {
"computeType": "default",
"hostingMode": "default",
"networkRuleSet": {
"bypass": "AzureServices",
"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/2025-05-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.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/fb3217991ff57b5760525aeba1a0670bfe0880fa/specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass() {
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{
ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
HostingMode: to.Ptr(armsearch.HostingModeDefault),
NetworkRuleSet: &armsearch.NetworkRuleSet{
Bypass: to.Ptr(armsearch.SearchBypassAzureServices),
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"),
// SystemData: &armsearch.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
// CreatedBy: to.Ptr("My e-commerce app"),
// CreatedByType: to.Ptr(armsearch.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T00:00:00.000Z"); return t}()),
// LastModifiedBy: to.Ptr("fakeuser@contoso.com"),
// LastModifiedByType: to.Ptr(armsearch.CreatedByTypeUser),
// },
// 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{
// },
// },
// ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
// DataExfiltrationProtections: []*armsearch.SearchDataExfiltrationProtection{
// },
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkUnspecified),
// },
// Endpoint: to.Ptr("https://mysearchservice.search.windows.net/"),
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// Bypass: to.Ptr(armsearch.SearchBypassAzureServices),
// 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),
// SharedPrivateLinkResources: []*armsearch.SharedPrivateLinkResource{
// },
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// UpgradeAvailable: to.Ptr(armsearch.UpgradeAvailableNotAvailable),
// },
// 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");
require("dotenv/config");
/**
* 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/2025-05-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.json
*/
async function searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
computeType: "default",
hostingMode: "default",
location: "westus",
networkRuleSet: {
bypass: "AzureServices",
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search.Models;
using Azure.ResourceManager.Search;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.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"))
{
SearchSkuName = SearchServiceSkuName.Standard,
ReplicaCount = 1,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
ComputeType = SearchServiceComputeType.Default,
NetworkRuleSet = new SearchServiceNetworkRuleSet
{
IPRules = {new SearchServiceIPRule
{
Value = "123.4.5.6",
}, new SearchServiceIPRule
{
Value = "123.4.6.0/18",
}},
Bypass = SearchBypass.AzureServices,
},
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
Exemple de réponse
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [
{
"value": "123.4.5.6"
},
{
"value": "123.4.6.0/18"
}
],
"bypass": "AzureServices"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [
{
"value": "123.4.5.6"
},
{
"value": "123.4.6.0/18"
}
],
"bypass": "AzureServices"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
SearchCreateOrUpdateServiceWithCmkEnforcement
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2025-05-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"computeType": "default",
"encryptionWithCmk": {
"enforcement": "Enabled"
}
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.ComputeType;
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/2025-05-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).withComputeType(ComputeType.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": {
"computeType": "default",
"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/2025-05-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/fb3217991ff57b5760525aeba1a0670bfe0880fa/specification/search/resource-manager/Microsoft.Search/stable/2025-05-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{
ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
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"),
// SystemData: &armsearch.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
// CreatedBy: to.Ptr("My e-commerce app"),
// CreatedByType: to.Ptr(armsearch.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T00:00:00.000Z"); return t}()),
// LastModifiedBy: to.Ptr("fakeuser@contoso.com"),
// LastModifiedByType: to.Ptr(armsearch.CreatedByTypeUser),
// },
// 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{
// },
// },
// ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
// DataExfiltrationProtections: []*armsearch.SearchDataExfiltrationProtection{
// },
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkEnabled),
// },
// Endpoint: to.Ptr("https://mysearchservice.search.windows.net/"),
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// Bypass: to.Ptr(armsearch.SearchBypassNone),
// 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(""),
// UpgradeAvailable: to.Ptr(armsearch.UpgradeAvailableNotAvailable),
// },
// 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");
require("dotenv/config");
/**
* 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/2025-05-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 = {
computeType: "default",
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search.Models;
using Azure.ResourceManager.Search;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2025-05-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"))
{
SearchSkuName = SearchServiceSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
ComputeType = SearchServiceComputeType.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
Exemple de réponse
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Enabled",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Enabled",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
SearchCreateOrUpdateServiceWithDataExfiltration
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2025-05-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"computeType": "default",
"dataExfiltrationProtections": [
"BlockAll"
]
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.ComputeType;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.SearchDataExfiltrationProtection;
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/2025-05-01/examples/
* SearchCreateOrUpdateServiceWithDataExfiltration.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceWithDataExfiltration.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
searchCreateOrUpdateServiceWithDataExfiltration(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).withComputeType(ComputeType.DEFAULT)
.withDataExfiltrationProtections(Arrays.asList(SearchDataExfiltrationProtection.BLOCK_ALL)),
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_data_exfiltration.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": {
"computeType": "default",
"dataExfiltrationProtections": ["BlockAll"],
"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/2025-05-01/examples/SearchCreateOrUpdateServiceWithDataExfiltration.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/fb3217991ff57b5760525aeba1a0670bfe0880fa/specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateServiceWithDataExfiltration.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceWithDataExfiltration() {
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{
ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
DataExfiltrationProtections: []*armsearch.SearchDataExfiltrationProtection{
to.Ptr(armsearch.SearchDataExfiltrationProtectionBlockAll)},
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"),
// SystemData: &armsearch.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
// CreatedBy: to.Ptr("My e-commerce app"),
// CreatedByType: to.Ptr(armsearch.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T00:00:00.000Z"); return t}()),
// LastModifiedBy: to.Ptr("fakeuser@contoso.com"),
// LastModifiedByType: to.Ptr(armsearch.CreatedByTypeUser),
// },
// 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{
// },
// },
// ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
// DataExfiltrationProtections: []*armsearch.SearchDataExfiltrationProtection{
// to.Ptr(armsearch.SearchDataExfiltrationProtectionBlockAll)},
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkUnspecified),
// },
// Endpoint: to.Ptr("https://mysearchservice.search.windows.net/"),
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// Bypass: to.Ptr(armsearch.SearchBypassNone),
// 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(""),
// UpgradeAvailable: to.Ptr(armsearch.UpgradeAvailableNotAvailable),
// },
// 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");
require("dotenv/config");
/**
* 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/2025-05-01/examples/SearchCreateOrUpdateServiceWithDataExfiltration.json
*/
async function searchCreateOrUpdateServiceWithDataExfiltration() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
computeType: "default",
dataExfiltrationProtections: ["BlockAll"],
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search.Models;
using Azure.ResourceManager.Search;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateServiceWithDataExfiltration.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"))
{
SearchSkuName = SearchServiceSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
ComputeType = SearchServiceComputeType.Default,
DataExfiltrationProtections = { SearchDataExfiltrationProtection.BlockAll },
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
Exemple de réponse
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [
"BlockAll"
],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [
"BlockAll"
],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
SearchCreateOrUpdateServiceWithIdentity
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2025-05-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"computeType": "default"
},
"identity": {
"type": "SystemAssigned, UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-mi": {}
}
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.ComputeType;
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 com.azure.resourcemanager.search.models.UserAssignedIdentity;
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/2025-05-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_USER_ASSIGNED)
.withUserAssignedIdentities(mapOf(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-mi",
new UserAssignedIdentity())))
.withReplicaCount(3).withPartitionCount(1).withHostingMode(HostingMode.DEFAULT)
.withComputeType(ComputeType.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, UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-mi": {}
},
},
"location": "westus",
"properties": {"computeType": "default", "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/2025-05-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/fb3217991ff57b5760525aeba1a0670bfe0880fa/specification/search/resource-manager/Microsoft.Search/stable/2025-05-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.IdentityTypeSystemAssignedUserAssigned),
UserAssignedIdentities: map[string]*armsearch.UserAssignedIdentity{
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-mi": {},
},
},
Properties: &armsearch.ServiceProperties{
ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
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"),
// SystemData: &armsearch.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
// CreatedBy: to.Ptr("My e-commerce app"),
// CreatedByType: to.Ptr(armsearch.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T00:00:00.000Z"); return t}()),
// LastModifiedBy: to.Ptr("fakeuser@contoso.com"),
// LastModifiedByType: to.Ptr(armsearch.CreatedByTypeUser),
// },
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Identity: &armsearch.Identity{
// Type: to.Ptr(armsearch.IdentityTypeSystemAssignedUserAssigned),
// PrincipalID: to.Ptr("9d1e1f18-2122-4988-a11c-878782e40a5c"),
// TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"),
// UserAssignedIdentities: map[string]*armsearch.UserAssignedIdentity{
// "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-mi": &armsearch.UserAssignedIdentity{
// ClientID: to.Ptr("cd1dcac8-82dd-45b5-9aed-76795d529f6b"),
// PrincipalID: to.Ptr("24e07a75-1286-41e5-a15d-ded85ec3acd7"),
// },
// },
// },
// Properties: &armsearch.ServiceProperties{
// AuthOptions: &armsearch.DataPlaneAuthOptions{
// APIKeyOnly: map[string]any{
// },
// },
// ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
// DataExfiltrationProtections: []*armsearch.SearchDataExfiltrationProtection{
// },
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkUnspecified),
// },
// Endpoint: to.Ptr("https://mysearchservice.search.windows.net/"),
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// Bypass: to.Ptr(armsearch.SearchBypassNone),
// 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(""),
// UpgradeAvailable: to.Ptr(armsearch.UpgradeAvailableNotAvailable),
// },
// 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");
require("dotenv/config");
/**
* 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/2025-05-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 = {
computeType: "default",
hostingMode: "default",
identity: {
type: "SystemAssigned, UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000000000000000000000000000/resourcegroups/rg1/providers/MicrosoftManagedIdentity/userAssignedIdentities/userMi":
{},
},
},
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search.Models;
using Azure.ResourceManager.Search;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2025-05-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"))
{
SearchSkuName = SearchServiceSkuName.Standard,
Identity = new ManagedServiceIdentity("SystemAssigned, UserAssigned")
{
UserAssignedIdentities =
{
[new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-mi")] = new UserAssignedIdentity()
},
},
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
ComputeType = SearchServiceComputeType.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
Exemple de réponse
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"identity": {
"type": "SystemAssigned, UserAssigned",
"principalId": "9d1e1f18-2122-4988-a11c-878782e40a5c",
"tenantId": "f686d426-8d16-42db-81b7-ab578e110ccd",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-mi": {
"clientId": "cd1dcac8-82dd-45b5-9aed-76795d529f6b",
"principalId": "24e07a75-1286-41e5-a15d-ded85ec3acd7"
}
}
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"identity": {
"type": "SystemAssigned, UserAssigned",
"principalId": "9d1e1f18-2122-4988-a11c-878782e40a5c",
"tenantId": "f686d426-8d16-42db-81b7-ab578e110ccd",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-mi": {
"clientId": "cd1dcac8-82dd-45b5-9aed-76795d529f6b",
"principalId": "24e07a75-1286-41e5-a15d-ded85ec3acd7"
}
}
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
SearchCreateOrUpdateWithSemanticSearch
Exemple de requête
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2025-05-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"computeType": "default",
"semanticSearch": "free"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.ComputeType;
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/2025-05-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).withComputeType(ComputeType.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": {
"computeType": "default",
"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/2025-05-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/fb3217991ff57b5760525aeba1a0670bfe0880fa/specification/search/resource-manager/Microsoft.Search/stable/2025-05-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{
ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
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"),
// SystemData: &armsearch.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-01T00:00:00.000Z"); return t}()),
// CreatedBy: to.Ptr("My e-commerce app"),
// CreatedByType: to.Ptr(armsearch.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T00:00:00.000Z"); return t}()),
// LastModifiedBy: to.Ptr("fakeuser@contoso.com"),
// LastModifiedByType: to.Ptr(armsearch.CreatedByTypeUser),
// },
// 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{
// },
// },
// ComputeType: to.Ptr(armsearch.ComputeTypeDefault),
// DataExfiltrationProtections: []*armsearch.SearchDataExfiltrationProtection{
// },
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkUnspecified),
// },
// Endpoint: to.Ptr("https://mysearchservice.search.windows.net/"),
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// Bypass: to.Ptr(armsearch.SearchBypassNone),
// 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(""),
// UpgradeAvailable: to.Ptr(armsearch.UpgradeAvailableNotAvailable),
// },
// 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");
require("dotenv/config");
/**
* 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/2025-05-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 = {
computeType: "default",
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search.Models;
using Azure.ResourceManager.Search;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2025-05-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"))
{
SearchSkuName = SearchServiceSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
ComputeType = SearchServiceComputeType.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
Exemple de réponse
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"semanticSearch": "free",
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
{
"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,
"endpoint": "https://mysearchservice.search.windows.net/",
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"computeType": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [],
"bypass": "None"
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"dataExfiltrationProtections": [],
"semanticSearch": "free",
"upgradeAvailable": "notAvailable",
"serviceUpgradedAt": null
},
"systemData": {
"createdBy": "My e-commerce app",
"createdByType": "Application",
"createdAt": "2024-01-01T00:00:00Z",
"lastModifiedBy": "fakeuser@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-11-01T00:00:00Z"
}
}
Définitions
| Nom |
Description |
|
AadAuthFailureMode
|
Décrit la réponse que l’API du plan de données d’un service de recherche envoie pour les demandes qui ont échoué.
|
|
ApiKeyOnly
|
Indique que seule la clé API peut être utilisée pour l’authentification.
|
|
CloudError
|
Contient des informations sur une erreur d’API.
|
|
CloudErrorBody
|
Décrit une erreur d’API particulière avec un code d’erreur et un message.
|
|
ComputeType
|
Configurez cette propriété pour prendre en charge le service de recherche à l’aide du calcul par défaut ou du calcul confidentiel Azure.
|
|
createdByType
|
Type d’identité qui a créé la ressource.
|
|
DataPlaneAadOrApiKeyAuthOption
|
Indique que la clé API ou un jeton d’accès à partir d’un locataire Microsoft Entra ID peut être utilisé pour l’authentification.
|
|
DataPlaneAuthOptions
|
Définit les options de la façon dont le service de recherche authentifie une demande de plan de données. Cela ne peut pas être défini si « disableLocalAuth » a la valeur true.
|
|
EncryptionWithCmk
|
Décrit une stratégie qui détermine la façon dont les ressources au sein du service de recherche doivent être chiffrées avec des clés gérées par le client.
|
|
HostingMode
|
Applicable uniquement pour la référence SKU standard3. Vous pouvez définir cette propriété pour activer jusqu’à 3 partitions à haute densité qui autorisent jusqu’à 1 000 index, ce qui est beaucoup plus élevé que les index maximum autorisés pour toute autre référence SKU. Pour la référence SKU standard3, la valeur est « default » ou « highDensity ». Pour toutes les autres références SKU, cette valeur doit être « par défaut ».
|
|
Identity
|
Détails sur l’identité du service de recherche. Une valeur Null indique que le service de recherche n’a pas d’identité affectée.
|
|
IdentityType
|
Type d’identité utilisé pour la ressource. Le type « SystemAssigned, UserAssigned » inclut à la fois une identité créée par le système et un ensemble d’identités affectées par l’utilisateur. Le type « None » supprime toutes les identités du service.
|
|
IpRule
|
Règle de restriction IP du service Recherche d’IA Azure.
|
|
NetworkRuleSet
|
Règles spécifiques au réseau qui déterminent la façon dont le service Recherche d’IA Azure peut être atteint.
|
|
PrivateEndpoint
|
Ressource de point de terminaison privé du fournisseur Microsoft.Network.
|
|
PrivateEndpointConnection
|
Décrit une connexion de point de terminaison privé existante au service Recherche d’IA Azure.
|
|
PrivateEndpointConnectionProperties
|
Décrit les propriétés d’une connexion de point de terminaison privé existante au service de recherche.
|
|
PrivateLinkServiceConnectionProvisioningState
|
État d’approvisionnement de la connexion de service de liaison privée. Les valeurs valides sont La mise à jour, la suppression, l’échec, la réussite, l’annulation ou l’annulation.
|
|
PrivateLinkServiceConnectionState
|
Décrit l’état actuel d’une connexion de service Azure Private Link existante au point de terminaison privé.
|
|
PrivateLinkServiceConnectionStatus
|
État de la connexion du service de liaison privée. Les valeurs valides sont en attente, approuvées, rejetées ou déconnectées.
|
|
ProvisioningState
|
État de la dernière opération d’approvisionnement effectuée sur le service de recherche. L’approvisionnement est un état intermédiaire qui se produit pendant l’établissement de la capacité de service. Une fois la capacité configurée, provisioningState passe à « Réussi » ou « Échec ». Les applications clientes peuvent interroger l’état d’approvisionnement (l’intervalle d’interrogation recommandé est de 30 secondes à une minute) à l’aide de l’opération Get Search Service pour voir quand une opération est terminée. Si vous utilisez le service gratuit, cette valeur a tendance à revenir en tant que « Réussi » directement dans l’appel pour créer un service de recherche. Cela est dû au fait que le service gratuit utilise la capacité déjà configurée.
|
|
PublicNetworkAccess
|
Cette valeur peut être définie sur « activé » pour éviter les modifications cassants sur les ressources et les modèles clients existants. Si la valeur est « désactivée », le trafic sur l’interface publique n’est pas autorisé et les connexions de point de terminaison privé sont la méthode d’accès exclusive.
|
|
SearchBypass
|
Origines possibles du trafic entrant qui peut contourner les règles définies dans la section « ipRules ».
|
|
SearchDataExfiltrationProtection
|
Liste des scénarios d’exfiltration de données qui sont explicitement interdits pour le service de recherche. Actuellement, la seule valeur prise en charge est « All » pour désactiver tous les scénarios d’exportation de données possibles avec des contrôles plus précis prévus pour l’avenir.
|
|
SearchEncryptionComplianceStatus
|
Retourne l’état de conformité du service de recherche par rapport aux objets non chiffrés CMK. Si un service a plusieurs objets non chiffrés et que l’application est activée, le service est marqué comme non conforme.
|
|
SearchEncryptionWithCmk
|
Décrit comment un service de recherche doit appliquer la conformité s’il trouve des objets qui ne sont pas chiffrés avec la clé gérée par le client.
|
|
SearchSemanticSearch
|
Définit les options qui contrôlent la disponibilité de la recherche sémantique. Cette configuration n’est possible que pour certaines références SKU Azure AI Search dans certains emplacements.
|
|
SearchService
|
Décrit un service Recherche d’IA Azure et son état actuel.
|
|
SearchServiceStatus
|
État du service de recherche. Les valeurs possibles sont les suivantes : « en cours d’exécution » : le service de recherche est en cours d’exécution et aucune opération d’approvisionnement n’est en cours. « approvisionnement » : le service de recherche est approvisionné ou mis à l’échelle vers le haut ou vers le bas. « suppression » : le service de recherche est en cours de suppression. « détérioré » : le service de recherche est détérioré. Cela peut se produire lorsque les unités de recherche sous-jacentes ne sont pas saines. Le service de recherche est probablement opérationnel, mais les performances peuvent être lentes et certaines requêtes peuvent être supprimées. ' désactivé' : le service de recherche est désactivé. Dans cet état, le service rejette toutes les demandes d’API. ' erreur' : le service de recherche est dans un état d’erreur. 'arrêté' : le service de recherche se trouve dans un abonnement désactivé. Si votre service se trouve dans les états détériorés, désactivés ou d’erreur, cela signifie que l’équipe Recherche d’IA Azure examine activement le problème sous-jacent. Les services dédiés dans ces états sont toujours facturés en fonction du nombre d’unités de recherche approvisionnées.
|
|
SharedPrivateLinkResource
|
Décrit une ressource de liaison privée partagée gérée par le service Recherche d’IA Azure.
|
|
SharedPrivateLinkResourceProperties
|
Décrit les propriétés d’une ressource de liaison privée partagée existante gérée par le service Recherche d’IA Azure.
|
|
SharedPrivateLinkResourceProvisioningState
|
État d’approvisionnement de la ressource de liaison privée partagée. Les valeurs valides sont Mise à jour, Suppression, Échec, Réussite ou Incomplet.
|
|
SharedPrivateLinkResourceStatus
|
État de la ressource de liaison privée partagée. Les valeurs valides sont en attente, approuvées, rejetées ou déconnectées.
|
|
Sku
|
Définit la référence SKU d’un service de recherche, qui détermine le taux de facturation et les limites de capacité.
|
|
SkuName
|
Référence SKU du service de recherche. Les valeurs valides sont les suivantes : « gratuit » : service partagé. « de base » : service dédié avec jusqu’à 3 réplicas. « standard » : service dédié avec jusqu’à 12 partitions et 12 réplicas. « standard2 » : similaire à la norme, mais avec plus de capacité par unité de recherche. « standard3 » : la plus grande offre Standard avec jusqu’à 12 partitions et 12 réplicas (ou jusqu’à 3 partitions avec plus d’index si vous définissez également la propriété hostingMode sur « highDensity »). 'storage_optimized_l1' : prend en charge 1 To par partition, jusqu’à 12 partitions. 'storage_optimized_l2' : prend en charge 2 To par partition, jusqu’à 12 partitions.
|
|
systemData
|
Métadonnées relatives à la création et à la dernière modification de la ressource.
|
|
UpgradeAvailable
|
Indique si le service de recherche dispose d’une mise à niveau disponible.
|
|
UserAssignedIdentity
|
Propriétés d’identité attribuées par l’utilisateur
|
AadAuthFailureMode
Énumération
Décrit la réponse que l’API du plan de données d’un service de recherche envoie pour les demandes qui ont échoué.
| Valeur |
Description |
|
http403
|
Indique que les demandes qui ont échoué l’authentification doivent être présentées avec un code d’état HTTP de 403 (Interdit).
|
|
http401WithBearerChallenge
|
Indique que les demandes qui ont échoué l’authentification doivent être présentées avec un code d’état HTTP de 401 (non autorisé) et présenter un défi du porteur.
|
ApiKeyOnly
Object
Indique que seule la clé API peut être utilisée pour l’authentification.
CloudError
Object
Contient des informations sur une erreur d’API.
| Nom |
Type |
Description |
|
error
|
CloudErrorBody
|
Décrit une erreur d’API particulière avec un code d’erreur et un message.
|
|
message
|
string
|
Brève description de l’erreur qui indique ce qui s’est passé (pour plus d’informations/débogage, reportez-vous à la propriété « error.message »).
|
CloudErrorBody
Object
Décrit une erreur d’API particulière avec un code d’erreur et un message.
| Nom |
Type |
Description |
|
code
|
string
|
Code d’erreur qui décrit la condition d’erreur plus précisément qu’un code d’état HTTP. Peut être utilisé pour gérer par programmation des cas d’erreur spécifiques.
|
|
details
|
CloudErrorBody[]
|
Contient des erreurs imbriquées liées à cette erreur.
|
|
message
|
string
|
Message qui décrit en détail l’erreur et fournit des informations de débogage.
|
|
target
|
string
|
Cible de l’erreur particulière (par exemple, le nom de la propriété en erreur).
|
ComputeType
Énumération
Configurez cette propriété pour prendre en charge le service de recherche à l’aide du calcul par défaut ou du calcul confidentiel Azure.
| Valeur |
Description |
|
default
|
Créez le service avec le calcul par défaut.
|
|
confidential
|
Créez le service avec Le calcul confidentiel Azure.
|
createdByType
Énumération
Type d’identité qui a créé la ressource.
| Valeur |
Description |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
DataPlaneAadOrApiKeyAuthOption
Object
Indique que la clé API ou un jeton d’accès à partir d’un locataire Microsoft Entra ID peut être utilisé pour l’authentification.
| Nom |
Type |
Description |
|
aadAuthFailureMode
|
AadAuthFailureMode
|
Décrit la réponse que l’API du plan de données d’un service de recherche envoie pour les demandes qui ont échoué.
|
DataPlaneAuthOptions
Object
Définit les options de la façon dont le service de recherche authentifie une demande de plan de données. Cela ne peut pas être défini si « disableLocalAuth » a la valeur true.
| Nom |
Type |
Description |
|
aadOrApiKey
|
DataPlaneAadOrApiKeyAuthOption
|
Indique que la clé API ou un jeton d’accès à partir d’un locataire Microsoft Entra ID peut être utilisé pour l’authentification.
|
|
apiKeyOnly
|
ApiKeyOnly
|
Indique que seule la clé API peut être utilisée pour l’authentification.
|
EncryptionWithCmk
Object
Décrit une stratégie qui détermine la façon dont les ressources au sein du service de recherche doivent être chiffrées avec des clés gérées par le client.
| Nom |
Type |
Description |
|
encryptionComplianceStatus
|
SearchEncryptionComplianceStatus
|
Retourne l’état de conformité du service de recherche par rapport aux objets non chiffrés CMK. Si un service a plusieurs objets non chiffrés et que l’application est activée, le service est marqué comme non conforme.
|
|
enforcement
|
SearchEncryptionWithCmk
|
Décrit comment un service de recherche doit appliquer la conformité s’il trouve des objets qui ne sont pas chiffrés avec la clé gérée par le client.
|
HostingMode
Énumération
Applicable uniquement pour la référence SKU standard3. Vous pouvez définir cette propriété pour activer jusqu’à 3 partitions à haute densité qui autorisent jusqu’à 1 000 index, ce qui est beaucoup plus élevé que les index maximum autorisés pour toute autre référence SKU. Pour la référence SKU standard3, la valeur est « default » ou « highDensity ». Pour toutes les autres références SKU, cette valeur doit être « par défaut ».
| Valeur |
Description |
|
default
|
La limite du nombre d’index est déterminée par les limites par défaut de la référence SKU.
|
|
highDensity
|
Application uniquement pour la référence SKU standard3, où le service de recherche peut avoir jusqu’à 1 000 index.
|
Identity
Object
Détails sur l’identité du service de recherche. Une valeur Null indique que le service de recherche n’a pas d’identité affectée.
| Nom |
Type |
Description |
|
principalId
|
string
|
ID principal de l’identité affectée par le système du service de recherche.
|
|
tenantId
|
string
|
ID de locataire de l’identité affectée par le système du service de recherche.
|
|
type
|
IdentityType
|
Type d’identité utilisé pour la ressource. Le type « SystemAssigned, UserAssigned » inclut à la fois une identité créée par le système et un ensemble d’identités affectées par l’utilisateur. Le type « None » supprime toutes les identités du service.
|
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
Liste des identités utilisateur associées à la ressource. Les références de clé de dictionnaire d’identité utilisateur seront des ID de ressource ARM sous la forme : « /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} ».
|
IdentityType
Énumération
Type d’identité utilisé pour la ressource. Le type « SystemAssigned, UserAssigned » inclut à la fois une identité créée par le système et un ensemble d’identités affectées par l’utilisateur. Le type « None » supprime toutes les identités du service.
| Valeur |
Description |
|
None
|
Indique que toute identité associée au service de recherche doit être supprimée.
|
|
SystemAssigned
|
Indique que l’identité affectée par le système pour le service de recherche est activée.
|
|
UserAssigned
|
Indique qu’une ou plusieurs identités affectées par l’utilisateur seront affectées au service de recherche.
|
|
SystemAssigned, UserAssigned
|
Indique que l’identité affectée par le système pour le service de recherche est activée, ainsi que l’attribution d’une ou plusieurs identités affectées par l’utilisateur.
|
IpRule
Object
Règle de restriction IP du service Recherche d’IA Azure.
| Nom |
Type |
Description |
|
value
|
string
|
Valeur correspondant à une seule adresse IPv4 (par exemple, 123.1.2.3) ou à une plage IP au format CIDR (par exemple, 123.1.2.3/24) à autoriser.
|
NetworkRuleSet
Object
Règles spécifiques au réseau qui déterminent la façon dont le service Recherche d’IA Azure peut être atteint.
| Nom |
Type |
Description |
|
bypass
|
SearchBypass
|
Origines possibles du trafic entrant qui peut contourner les règles définies dans la section « ipRules ».
|
|
ipRules
|
IpRule[]
|
Liste des règles de restriction IP qui définissent le ou les réseaux entrants avec l’autorisation d’accès au point de terminaison du service de recherche. En attendant, tous les autres réseaux IP publics sont bloqués par le pare-feu. Ces règles de restriction sont appliquées uniquement lorsque le « publicNetworkAccess » du service de recherche est « activé » ; sinon, le trafic via l’interface publique n’est pas autorisé même avec des règles d’adresse IP publiques, et les connexions de point de terminaison privé seraient la méthode d’accès exclusive.
|
PrivateEndpoint
Object
Ressource de point de terminaison privé du fournisseur Microsoft.Network.
| Nom |
Type |
Description |
|
id
|
string
|
ID de ressource de la ressource de point de terminaison privé du fournisseur Microsoft.Network.
|
PrivateEndpointConnection
Object
Décrit une connexion de point de terminaison privé existante au service Recherche d’IA Azure.
| Nom |
Type |
Description |
|
id
|
string
(arm-id)
|
ID de ressource complet pour la ressource. Par exemple, « /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} »
|
|
name
|
string
|
Nom de la ressource
|
|
properties
|
PrivateEndpointConnectionProperties
|
Décrit les propriétés d’une connexion de point de terminaison privé existante au service Recherche d’IA Azure.
|
|
systemData
|
systemData
|
Métadonnées Azure Resource Manager contenant les informations createdBy et modifiedBy.
|
|
type
|
string
|
Type de la ressource. Par exemple, « Microsoft.Compute/virtualMachines » ou « Microsoft.Storage/storageAccounts »
|
PrivateEndpointConnectionProperties
Object
Décrit les propriétés d’une connexion de point de terminaison privé existante au service de recherche.
| Nom |
Type |
Description |
|
groupId
|
string
|
ID de groupe de la ressource Azure pour laquelle le service de liaison privée est destiné.
|
|
privateEndpoint
|
PrivateEndpoint
|
Ressource de point de terminaison privé du fournisseur Microsoft.Network.
|
|
privateLinkServiceConnectionState
|
PrivateLinkServiceConnectionState
|
Décrit l’état actuel d’une connexion de service Azure Private Link existante au point de terminaison privé.
|
|
provisioningState
|
PrivateLinkServiceConnectionProvisioningState
|
État d’approvisionnement de la connexion de service de liaison privée. Les valeurs valides sont La mise à jour, la suppression, l’échec, la réussite, l’annulation ou l’annulation.
|
PrivateLinkServiceConnectionProvisioningState
Énumération
État d’approvisionnement de la connexion de service de liaison privée. Les valeurs valides sont La mise à jour, la suppression, l’échec, la réussite, l’annulation ou l’annulation.
| Valeur |
Description |
|
Updating
|
La connexion de service de liaison privée est en cours de création ainsi que d’autres ressources pour qu’elle soit entièrement fonctionnelle.
|
|
Deleting
|
La connexion de service de liaison privée est en cours de suppression.
|
|
Failed
|
La connexion de service de liaison privée n’a pas pu être provisionnée ou supprimée.
|
|
Succeeded
|
La connexion de service de liaison privée a terminé l’approvisionnement et est prête à être approuvée.
|
|
Incomplete
|
La demande d’approvisionnement de la ressource de connexion de service de liaison privée a été acceptée, mais le processus de création n’a pas encore commencé.
|
|
Canceled
|
La demande d’approvisionnement de la ressource de connexion de service de liaison privée a été annulée.
|
PrivateLinkServiceConnectionState
Object
Décrit l’état actuel d’une connexion de service Azure Private Link existante au point de terminaison privé.
| Nom |
Type |
Valeur par défaut |
Description |
|
actionsRequired
|
string
|
None
|
Description de toutes les actions supplémentaires qui peuvent être requises.
|
|
description
|
string
|
|
Description de l’état de connexion du service de liaison privée.
|
|
status
|
PrivateLinkServiceConnectionStatus
|
|
État de la connexion du service de liaison privée. Les valeurs valides sont en attente, approuvées, rejetées ou déconnectées.
|
PrivateLinkServiceConnectionStatus
Énumération
État de la connexion du service de liaison privée. Les valeurs valides sont en attente, approuvées, rejetées ou déconnectées.
| Valeur |
Description |
|
Pending
|
La connexion de point de terminaison privé a été créée et est en attente d’approbation.
|
|
Approved
|
La connexion de point de terminaison privé est approuvée et prête à être utilisée.
|
|
Rejected
|
La connexion de point de terminaison privé a été rejetée et ne peut pas être utilisée.
|
|
Disconnected
|
La connexion de point de terminaison privé a été supprimée du service.
|
ProvisioningState
Énumération
État de la dernière opération d’approvisionnement effectuée sur le service de recherche. L’approvisionnement est un état intermédiaire qui se produit pendant l’établissement de la capacité de service. Une fois la capacité configurée, provisioningState passe à « Réussi » ou « Échec ». Les applications clientes peuvent interroger l’état d’approvisionnement (l’intervalle d’interrogation recommandé est de 30 secondes à une minute) à l’aide de l’opération Get Search Service pour voir quand une opération est terminée. Si vous utilisez le service gratuit, cette valeur a tendance à revenir en tant que « Réussi » directement dans l’appel pour créer un service de recherche. Cela est dû au fait que le service gratuit utilise la capacité déjà configurée.
| Valeur |
Description |
|
succeeded
|
La dernière opération d’approvisionnement s’est terminée avec succès.
|
|
provisioning
|
Le service de recherche est approvisionné ou mis à l’échelle vers le haut ou vers le bas.
|
|
failed
|
La dernière opération d’approvisionnement a échoué.
|
PublicNetworkAccess
Énumération
Cette valeur peut être définie sur « activé » pour éviter les modifications cassants sur les ressources et les modèles clients existants. Si la valeur est « désactivée », le trafic sur l’interface publique n’est pas autorisé et les connexions de point de terminaison privé sont la méthode d’accès exclusive.
| Valeur |
Description |
|
enabled
|
Le service de recherche est accessible à partir du trafic provenant de l’Internet public.
|
|
disabled
|
Le service de recherche n’est pas accessible à partir du trafic provenant de l’Internet public. L’accès n’est autorisé que sur les connexions de point de terminaison privé approuvées.
|
SearchBypass
Énumération
Origines possibles du trafic entrant qui peut contourner les règles définies dans la section « ipRules ».
| Valeur |
Description |
|
None
|
Indique qu’aucune origine ne peut contourner les règles définies dans la section « ipRules ». Il s’agit de la valeur par défaut.
|
|
AzureServices
|
Indique que les requêtes provenant des services approuvés Azure peuvent contourner les règles définies dans la section « ipRules ».
|
SearchDataExfiltrationProtection
Énumération
Liste des scénarios d’exfiltration de données qui sont explicitement interdits pour le service de recherche. Actuellement, la seule valeur prise en charge est « All » pour désactiver tous les scénarios d’exportation de données possibles avec des contrôles plus précis prévus pour l’avenir.
| Valeur |
Description |
|
BlockAll
|
Indique que tous les scénarios d’exfiltration de données sont désactivés.
|
SearchEncryptionComplianceStatus
Énumération
Retourne l’état de conformité du service de recherche par rapport aux objets non chiffrés CMK. Si un service a plusieurs objets non chiffrés et que l’application est activée, le service est marqué comme non conforme.
| Valeur |
Description |
|
Compliant
|
Indique que le service de recherche est conforme, soit parce que le nombre d’objets non chiffrés par CMK est égal à zéro ou que l’application est désactivée.
|
|
NonCompliant
|
Indique que le service de recherche possède plusieurs objets non chiffrés par CMK.
|
SearchEncryptionWithCmk
Énumération
Décrit comment un service de recherche doit appliquer la conformité s’il trouve des objets qui ne sont pas chiffrés avec la clé gérée par le client.
| Valeur |
Description |
|
Disabled
|
Aucune application du chiffrement de clé gérée par le client n’est effectuée. Seul le chiffrement intégré géré par le service est utilisé.
|
|
Enabled
|
Le service de recherche est marqué comme non conforme si un ou plusieurs objets ne sont pas chiffrés avec une clé gérée par le client.
|
|
Unspecified
|
La stratégie d’application n’est pas spécifiée explicitement, le comportement étant le même que s’il était défini sur « Désactivé ».
|
SearchSemanticSearch
Énumération
Définit les options qui contrôlent la disponibilité de la recherche sémantique. Cette configuration n’est possible que pour certaines références SKU Azure AI Search dans certains emplacements.
| Valeur |
Description |
|
disabled
|
Indique que le réécriture sémantique est désactivé pour le service de recherche. Il s’agit de la valeur par défaut.
|
|
free
|
Active le reclassement sémantique sur un service de recherche et indique qu’il doit être utilisé dans les limites du plan gratuit. Le plan gratuit limite le volume des demandes de classement sémantique et est proposé sans frais supplémentaires. Il s’agit de la valeur par défaut pour les services de recherche nouvellement provisionnés.
|
|
standard
|
Active le reclassement sémantique sur un service de recherche en tant que fonctionnalité facturable, avec un débit et un volume plus élevés de requêtes reclassées sémantiquement.
|
SearchService
Object
Décrit un service Recherche d’IA Azure et son état actuel.
| Nom |
Type |
Valeur par défaut |
Description |
|
id
|
string
(arm-id)
|
|
ID de ressource complet pour la ressource. Par exemple, « /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} »
|
|
identity
|
Identity
|
|
Identité de la ressource.
|
|
location
|
string
|
|
Emplacement géographique où réside la ressource
|
|
name
|
string
|
|
Nom de la ressource
|
|
properties.authOptions
|
DataPlaneAuthOptions
|
|
Définit les options pour la façon dont l’API de plan de données d’un service de recherche authentifie les demandes. Cela ne peut pas être défini si « disableLocalAuth » a la valeur true.
|
|
properties.computeType
|
ComputeType
|
|
Configurez cette propriété pour prendre en charge le service de recherche à l’aide du calcul par défaut ou du calcul confidentiel Azure.
|
|
properties.dataExfiltrationProtections
|
SearchDataExfiltrationProtection[]
|
|
Liste des scénarios d’exfiltration de données qui sont explicitement interdits pour le service de recherche. Actuellement, la seule valeur prise en charge est « All » pour désactiver tous les scénarios d’exportation de données possibles avec des contrôles plus précis prévus pour l’avenir.
|
|
properties.disableLocalAuth
|
boolean
|
|
Lorsque la valeur est true, les appels au service de recherche ne sont pas autorisés à utiliser les clés API pour l’authentification. Cela ne peut pas être défini sur true si « dataPlaneAuthOptions » sont définis.
|
|
properties.eTag
|
string
|
|
Propriété générée par le système représentant l’etag du service qui peut être destinée au contrôle d’accès concurrentiel optimiste pendant les mises à jour.
|
|
properties.encryptionWithCmk
|
EncryptionWithCmk
|
|
Spécifie toute stratégie concernant le chiffrement des ressources (telles que les index) à l’aide de clés de gestionnaire de clients au sein d’un service de recherche.
|
|
properties.endpoint
|
string
(uri)
|
|
Point de terminaison du service Recherche d’IA Azure.
|
|
properties.hostingMode
|
HostingMode
|
default
|
Applicable uniquement pour la référence SKU standard3. Vous pouvez définir cette propriété pour activer jusqu’à 3 partitions à haute densité qui autorisent jusqu’à 1 000 index, ce qui est beaucoup plus élevé que les index maximum autorisés pour toute autre référence SKU. Pour la référence SKU standard3, la valeur est « default » ou « highDensity ». Pour toutes les autres références SKU, cette valeur doit être « par défaut ».
|
|
properties.networkRuleSet
|
NetworkRuleSet
|
|
Règles spécifiques au réseau qui déterminent la façon dont le service Recherche d’IA Azure peut être atteint.
|
|
properties.partitionCount
|
integer
(int32)
minimum: 1 maximum: 12
|
1
|
Nombre de partitions dans le service de recherche ; si spécifié, il peut s’agir de 1, 2, 3, 4, 6 ou 12. Les valeurs supérieures à 1 sont valides uniquement pour les références SKU standard. Pour les services « standard3 » avec hostingMode défini sur « highDensity », les valeurs autorisées sont comprises entre 1 et 3.
|
|
properties.privateEndpointConnections
|
PrivateEndpointConnection[]
|
|
Liste des connexions de point de terminaison privé au service Recherche d’IA Azure.
|
|
properties.provisioningState
|
ProvisioningState
|
|
État de la dernière opération d’approvisionnement effectuée sur le service de recherche. L’approvisionnement est un état intermédiaire qui se produit pendant l’établissement de la capacité de service. Une fois la capacité configurée, provisioningState passe à « Réussi » ou « Échec ». Les applications clientes peuvent interroger l’état d’approvisionnement (l’intervalle d’interrogation recommandé est de 30 secondes à une minute) à l’aide de l’opération Get Search Service pour voir quand une opération est terminée. Si vous utilisez le service gratuit, cette valeur a tendance à revenir en tant que « Réussi » directement dans l’appel pour créer un service de recherche. Cela est dû au fait que le service gratuit utilise la capacité déjà configurée.
|
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
enabled
|
Cette valeur peut être définie sur « activé » pour éviter les modifications cassants sur les ressources et les modèles clients existants. Si la valeur est « désactivée », le trafic sur l’interface publique n’est pas autorisé et les connexions de point de terminaison privé sont la méthode d’accès exclusive.
|
|
properties.replicaCount
|
integer
(int32)
minimum: 1 maximum: 12
|
1
|
Nombre de réplicas dans le service de recherche. S’il est spécifié, il doit s’agir d’une valeur comprise entre 1 et 12 inclus pour les références SKU standard ou comprises entre 1 et 3 pour la référence SKU de base.
|
|
properties.semanticSearch
|
SearchSemanticSearch
|
|
Définit les options qui contrôlent la disponibilité de la recherche sémantique. Cette configuration n’est possible que pour certaines références SKU Azure AI Search dans certains emplacements.
|
|
properties.serviceUpgradedAt
|
string
(date-time)
|
|
Date et heure de la dernière mise à niveau du service de recherche. Ce champ est null jusqu’à ce que le service soit mis à niveau pour la première fois.
|
|
properties.sharedPrivateLinkResources
|
SharedPrivateLinkResource[]
|
|
Liste des ressources de liaison privée partagées gérées par le service Recherche d’IA Azure.
|
|
properties.status
|
SearchServiceStatus
|
|
État du service de recherche. Les valeurs possibles sont les suivantes : « en cours d’exécution » : le service de recherche est en cours d’exécution et aucune opération d’approvisionnement n’est en cours. « approvisionnement » : le service de recherche est approvisionné ou mis à l’échelle vers le haut ou vers le bas. « suppression » : le service de recherche est en cours de suppression. « détérioré » : le service de recherche est détérioré. Cela peut se produire lorsque les unités de recherche sous-jacentes ne sont pas saines. Le service de recherche est probablement opérationnel, mais les performances peuvent être lentes et certaines requêtes peuvent être supprimées. ' désactivé' : le service de recherche est désactivé. Dans cet état, le service rejette toutes les demandes d’API. ' erreur' : le service de recherche est dans un état d’erreur. 'arrêté' : le service de recherche se trouve dans un abonnement désactivé. Si votre service se trouve dans les états détériorés, désactivés ou d’erreur, cela signifie que l’équipe Recherche d’IA Azure examine activement le problème sous-jacent. Les services dédiés dans ces états sont toujours facturés en fonction du nombre d’unités de recherche approvisionnées.
|
|
properties.statusDetails
|
string
|
|
Détails de l’état du service de recherche.
|
|
properties.upgradeAvailable
|
UpgradeAvailable
|
|
Indique si le service de recherche dispose d’une mise à niveau disponible.
|
|
sku
|
Sku
|
|
Référence SKU du service de recherche, qui détermine le niveau tarifaire et les limites de capacité. Cette propriété est requise lors de la création d’un service de recherche.
|
|
systemData
|
systemData
|
|
Métadonnées Azure Resource Manager du service de recherche contenant les informations createdBy et modifiedBy.
|
|
tags
|
object
|
|
Balises de ressource.
|
|
type
|
string
|
|
Type de la ressource. Par exemple, « Microsoft.Compute/virtualMachines » ou « Microsoft.Storage/storageAccounts »
|
SearchServiceStatus
Énumération
État du service de recherche. Les valeurs possibles sont les suivantes : « en cours d’exécution » : le service de recherche est en cours d’exécution et aucune opération d’approvisionnement n’est en cours. « approvisionnement » : le service de recherche est approvisionné ou mis à l’échelle vers le haut ou vers le bas. « suppression » : le service de recherche est en cours de suppression. « détérioré » : le service de recherche est détérioré. Cela peut se produire lorsque les unités de recherche sous-jacentes ne sont pas saines. Le service de recherche est probablement opérationnel, mais les performances peuvent être lentes et certaines requêtes peuvent être supprimées. ' désactivé' : le service de recherche est désactivé. Dans cet état, le service rejette toutes les demandes d’API. ' erreur' : le service de recherche est dans un état d’erreur. 'arrêté' : le service de recherche se trouve dans un abonnement désactivé. Si votre service se trouve dans les états détériorés, désactivés ou d’erreur, cela signifie que l’équipe Recherche d’IA Azure examine activement le problème sous-jacent. Les services dédiés dans ces états sont toujours facturés en fonction du nombre d’unités de recherche approvisionnées.
| Valeur |
Description |
|
running
|
Le service de recherche est en cours d’exécution et aucune opération d’approvisionnement n’est en cours.
|
|
provisioning
|
Le service de recherche est approvisionné ou mis à l’échelle vers le haut ou vers le bas.
|
|
deleting
|
Le service de recherche est en cours de suppression.
|
|
degraded
|
Le service de recherche est détérioré, car les unités de recherche sous-jacentes ne sont pas saines.
|
|
disabled
|
Le service de recherche est désactivé et toutes les demandes d’API sont rejetées.
|
|
error
|
Le service de recherche est dans un état d’erreur, indiquant un échec de provisionnement ou de suppression.
|
|
stopped
|
Le service de recherche se trouve dans un abonnement désactivé.
|
SharedPrivateLinkResource
Object
Décrit une ressource de liaison privée partagée gérée par le service Recherche d’IA Azure.
| Nom |
Type |
Description |
|
id
|
string
(arm-id)
|
ID de ressource complet pour la ressource. Par exemple, « /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} »
|
|
name
|
string
|
Nom de la ressource
|
|
properties
|
SharedPrivateLinkResourceProperties
|
Décrit les propriétés d’une ressource de liaison privée partagée gérée par le service Recherche d’IA Azure.
|
|
systemData
|
systemData
|
Métadonnées Azure Resource Manager contenant les informations createdBy et modifiedBy.
|
|
type
|
string
|
Type de la ressource. Par exemple, « Microsoft.Compute/virtualMachines » ou « Microsoft.Storage/storageAccounts »
|
SharedPrivateLinkResourceProperties
Object
Décrit les propriétés d’une ressource de liaison privée partagée existante gérée par le service Recherche d’IA Azure.
| Nom |
Type |
Description |
|
groupId
|
string
|
L’ID de groupe du fournisseur de ressources pour laquelle la ressource de liaison privée partagée est destinée.
|
|
privateLinkResourceId
|
string
|
L’ID de ressource de la ressource pour laquelle la ressource de liaison privée partagée est destinée.
|
|
provisioningState
|
SharedPrivateLinkResourceProvisioningState
|
État d’approvisionnement de la ressource de liaison privée partagée. Les valeurs valides sont Mise à jour, Suppression, Échec, Réussite ou Incomplet.
|
|
requestMessage
|
string
|
Message de demande d’approbation de la ressource de liaison privée partagée.
|
|
resourceRegion
|
string
|
Optionnel. Peut être utilisé pour spécifier l’emplacement Azure Resource Manager de la ressource pour laquelle une liaison privée partagée est en cours de création. Cela n’est nécessaire que pour les ressources dont la configuration DNS est régionale (par exemple, Azure Kubernetes Service).
|
|
status
|
SharedPrivateLinkResourceStatus
|
État de la ressource de liaison privée partagée. Les valeurs valides sont en attente, approuvées, rejetées ou déconnectées.
|
SharedPrivateLinkResourceProvisioningState
Énumération
État d’approvisionnement de la ressource de liaison privée partagée. Les valeurs valides sont Mise à jour, Suppression, Échec, Réussite ou Incomplet.
| Valeur |
Description |
|
Updating
|
La ressource de liaison privée partagée est en cours de création avec d’autres ressources pour qu’elle soit entièrement fonctionnelle.
|
|
Deleting
|
La ressource de liaison privée partagée est en cours de suppression.
|
|
Failed
|
La ressource de liaison privée partagée n’a pas pu être provisionnée ou supprimée.
|
|
Succeeded
|
La ressource de liaison privée partagée a terminé l’approvisionnement et est prête à être approuvée.
|
|
Incomplete
|
La demande d’approvisionnement de la ressource de liaison privée partagée a été acceptée, mais le processus de création n’a pas encore commencé.
|
SharedPrivateLinkResourceStatus
Énumération
État de la ressource de liaison privée partagée. Les valeurs valides sont en attente, approuvées, rejetées ou déconnectées.
| Valeur |
Description |
|
Pending
|
La ressource de liaison privée partagée a été créée et est en attente d’approbation.
|
|
Approved
|
La ressource de liaison privée partagée est approuvée et prête à être utilisée.
|
|
Rejected
|
La ressource de liaison privée partagée a été rejetée et ne peut pas être utilisée.
|
|
Disconnected
|
La ressource de liaison privée partagée a été supprimée du service.
|
Sku
Object
Définit la référence SKU d’un service de recherche, qui détermine le taux de facturation et les limites de capacité.
| Nom |
Type |
Description |
|
name
|
SkuName
|
Référence SKU du service de recherche. Les valeurs valides sont les suivantes : « gratuit » : service partagé. « de base » : service dédié avec jusqu’à 3 réplicas. « standard » : service dédié avec jusqu’à 12 partitions et 12 réplicas. « standard2 » : similaire à la norme, mais avec plus de capacité par unité de recherche. « standard3 » : la plus grande offre Standard avec jusqu’à 12 partitions et 12 réplicas (ou jusqu’à 3 partitions avec plus d’index si vous définissez également la propriété hostingMode sur « highDensity »). 'storage_optimized_l1' : prend en charge 1 To par partition, jusqu’à 12 partitions. 'storage_optimized_l2' : prend en charge 2 To par partition, jusqu’à 12 partitions.
|
SkuName
Énumération
Référence SKU du service de recherche. Les valeurs valides sont les suivantes : « gratuit » : service partagé. « de base » : service dédié avec jusqu’à 3 réplicas. « standard » : service dédié avec jusqu’à 12 partitions et 12 réplicas. « standard2 » : similaire à la norme, mais avec plus de capacité par unité de recherche. « standard3 » : la plus grande offre Standard avec jusqu’à 12 partitions et 12 réplicas (ou jusqu’à 3 partitions avec plus d’index si vous définissez également la propriété hostingMode sur « highDensity »). 'storage_optimized_l1' : prend en charge 1 To par partition, jusqu’à 12 partitions. 'storage_optimized_l2' : prend en charge 2 To par partition, jusqu’à 12 partitions.
| Valeur |
Description |
|
free
|
Niveau gratuit, sans garantie sla et sous-ensemble des fonctionnalités proposées sur les niveaux facturables.
|
|
basic
|
Niveau facturable pour un service dédié ayant jusqu’à 3 réplicas.
|
|
standard
|
Niveau facturable pour un service dédié ayant jusqu’à 12 partitions et 12 réplicas.
|
|
standard2
|
Similaire à « standard », mais avec plus de capacité par unité de recherche.
|
|
standard3
|
La plus grande offre Standard avec jusqu’à 12 partitions et 12 réplicas (ou jusqu’à 3 partitions avec plus d’index si vous définissez également la propriété hostingMode sur « highDensity »).
|
|
storage_optimized_l1
|
Niveau facturable pour un service dédié qui prend en charge 1 To par partition, jusqu’à 12 partitions.
|
|
storage_optimized_l2
|
Niveau facturable pour un service dédié qui prend en charge 2 To par partition, jusqu’à 12 partitions.
|
systemData
Object
Métadonnées relatives à la création et à la dernière modification de la ressource.
| Nom |
Type |
Description |
|
createdAt
|
string
(date-time)
|
Horodatage de la création de ressources (UTC).
|
|
createdBy
|
string
|
Identité qui a créé la ressource.
|
|
createdByType
|
createdByType
|
Type d’identité qui a créé la ressource.
|
|
lastModifiedAt
|
string
(date-time)
|
Horodatage de la dernière modification de ressource (UTC)
|
|
lastModifiedBy
|
string
|
Identité qui a modifié la ressource pour la dernière fois.
|
|
lastModifiedByType
|
createdByType
|
Type d’identité qui a modifié la ressource pour la dernière fois.
|
UpgradeAvailable
Énumération
Indique si le service de recherche dispose d’une mise à niveau disponible.
| Valeur |
Description |
|
notAvailable
|
Une mise à niveau n’est actuellement pas disponible pour le service.
|
|
available
|
Une mise à niveau est disponible pour le service.
|
UserAssignedIdentity
Object
Propriétés d’identité attribuées par l’utilisateur
| Nom |
Type |
Description |
|
clientId
|
string
(uuid)
|
ID client de l’identité affectée.
|
|
principalId
|
string
(uuid)
|
ID principal de l’identité affectée.
|