更新给定资源组中的现有搜索服务。
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}?api-version=2023-11-01
URI 参数
名称 |
在 |
必需 |
类型 |
说明 |
resourceGroupName
|
path |
True
|
string
|
当前订阅中的资源组的名称。 可以从 Azure 资源管理器 API 或门户获取此值。
|
searchServiceName
|
path |
True
|
string
|
要更新的搜索服务的名称。
|
subscriptionId
|
path |
True
|
string
|
Microsoft Azure 订阅的唯一标识符。 可以从 Azure 资源管理器 API、命令行工具或门户获取此值。
|
api-version
|
query |
True
|
string
|
要用于每个请求的 API 版本。
|
名称 |
必需 |
类型 |
说明 |
x-ms-client-request-id
|
|
string
(uuid)
|
一个客户端生成的 GUID 值,用于标识此请求。 如果指定,响应信息中将包含此内容作为跟踪请求的一种方式。
|
请求正文
名称 |
类型 |
说明 |
identity
|
Identity
|
资源的标识。
|
location
|
string
|
资源的地理位置。 这必须是受支持和注册的 Azure 地理区域之一(例如美国西部、美国东部、东南亚等)。 创建新资源时,此属性是必需的。
|
properties.authOptions
|
DataPlaneAuthOptions
|
定义搜索服务的数据平面 API 如何对请求进行身份验证的选项。 如果“disableLocalAuth”设置为 true,则无法设置此项。
|
properties.disableLocalAuth
|
boolean
|
如果设置为 true,则不允许调用搜索服务以使用 API 密钥进行身份验证。 如果定义了“dataPlaneAuthOptions”,则无法将其设置为 true。
|
properties.encryptionWithCmk
|
EncryptionWithCmk
|
指定有关使用搜索服务中的客户经理密钥加密资源(如索引)的任何策略。
|
properties.hostingMode
|
HostingMode
|
仅适用于 standard3 SKU。 可以将此属性设置为最多允许 3 个高密度分区,允许最多 1000 个索引,这远远高于任何其他 SKU 允许的最大索引。 对于 standard3 SKU,该值为“default”或“highDensity”。 对于所有其他 SKU,此值必须为“default”。
|
properties.networkRuleSet
|
NetworkRuleSet
|
确定如何访问搜索服务的网络特定规则。
|
properties.partitionCount
|
integer
(int32)
minimum: 1 maximum: 12
|
搜索服务中的分区数;如果指定,则它可以是 1、2、3、4、6 或 12。 大于 1 的值仅适用于标准 SKU。 对于 hostingMode 设置为“highDensity”的“standard3”服务,允许的值介于 1 到 3 之间。
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
此值可以设置为“已启用”,以避免对现有客户资源和模板进行重大更改。 如果设置为“disabled”,则不允许通过公共接口的流量,专用终结点连接将是独占访问方法。
|
properties.replicaCount
|
integer
(int32)
minimum: 1 maximum: 12
|
搜索服务中的副本数。 如果指定,它必须是标准 SKU 的 1 到 12(含 1 到 3)之间的值,对于基本 SKU,该值必须介于 1 和 3 之间。
|
properties.semanticSearch
|
SearchSemanticSearch
|
设置控制语义搜索可用性的选项。 此配置仅适用于特定位置的某些搜索 SKU。
|
sku
|
Sku
|
搜索服务的 SKU,用于确定计费费率和容量限制。 创建新搜索服务时,此属性是必需的。
|
tags
|
object
|
用于帮助在 Azure 门户中对资源进行分类的标记。
|
响应
名称 |
类型 |
说明 |
200 OK
|
SearchService
|
已成功更新现有服务定义。 如果更改了副本或分区数,缩放操作将异步进行。 可以通过 provisioningState 属性定期获取服务定义并监视进度。
|
Other Status Codes
|
CloudError
|
HTTP 400 (错误请求):给定的服务定义无效,或者您尝试更改不可变的属性;有关详细信息,请参阅响应中的错误代码和消息。 HTTP 404(找不到):找不到订阅或资源组。 HTTP 409 (冲突):已禁用指定的订阅。
|
安全性
azure_auth
Microsoft Entra ID OAuth2 授权流。
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
名称 |
说明 |
user_impersonation
|
模拟用户帐户
|
示例
SearchUpdateService
示例请求
PATCH https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"tags": {
"app-name": "My e-commerce app",
"new-tag": "Adding a new tag"
},
"properties": {
"replicaCount": 2
}
}
import com.azure.resourcemanager.search.models.SearchServiceUpdate;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateService.json
*/
/**
* Sample code: SearchUpdateService.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchUpdateService(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices()
.updateWithResponse("rg1", "mysearchservice", new SearchServiceUpdate()
.withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag")).withReplicaCount(2),
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_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.update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"properties": {"replicaCount": 2},
"tags": {"app-name": "My e-commerce app", "new-tag": "Adding a new tag"},
},
)
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateService.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateService.json
func ExampleServicesClient_Update_searchUpdateService() {
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)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{
Properties: &armsearch.ServiceProperties{
ReplicaCount: to.Ptr[int32](2),
},
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
"new-tag": to.Ptr("Adding a new tag"),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// "new-tag": to.Ptr("Adding a new tag"),
// },
// Properties: &armsearch.ServiceProperties{
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](2),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Updates an existing search service in the given resource group.
*
* @summary Updates an existing search service in the given resource group.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateService.json
*/
async function searchUpdateService() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
replicaCount: 2,
tags: { appName: "My e-commerce app", newTag: "Adding a new tag" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.update(resourceGroupName, searchServiceName, service);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateService.json
// this example is just showing the usage of "Services_Update" 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 SearchServiceResource created on azure
// for more information of creating SearchServiceResource, please refer to the document of SearchServiceResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string searchServiceName = "mysearchservice";
ResourceIdentifier searchServiceResourceId = SearchServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, searchServiceName);
SearchServiceResource searchService = client.GetSearchServiceResource(searchServiceResourceId);
// invoke the operation
SearchServicePatch patch = new SearchServicePatch(new AzureLocation("placeholder"))
{
ReplicaCount = 2,
Tags =
{
["app-name"] = "My e-commerce app",
["new-tag"] = "Adding a new tag",
},
};
SearchServiceResource result = await searchService.UpdateAsync(patch);
// 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
示例响应
{
"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",
"new-tag": "Adding a new tag"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 2,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
}
}
SearchUpdateServiceAuthOptions
示例请求
PATCH https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"tags": {
"app-name": "My e-commerce app",
"new-tag": "Adding a new tag"
},
"properties": {
"replicaCount": 2,
"authOptions": {
"aadOrApiKey": {
"aadAuthFailureMode": "http401WithBearerChallenge"
}
}
}
}
import com.azure.resourcemanager.search.models.AadAuthFailureMode;
import com.azure.resourcemanager.search.models.DataPlaneAadOrApiKeyAuthOption;
import com.azure.resourcemanager.search.models.DataPlaneAuthOptions;
import com.azure.resourcemanager.search.models.SearchServiceUpdate;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services Update.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceAuthOptions.
* json
*/
/**
* Sample code: SearchUpdateServiceAuthOptions.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchUpdateServiceAuthOptions(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().updateWithResponse("rg1", "mysearchservice",
new SearchServiceUpdate().withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag"))
.withReplicaCount(2)
.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_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.update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"properties": {
"authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "http401WithBearerChallenge"}},
"replicaCount": 2,
},
"tags": {"app-name": "My e-commerce app", "new-tag": "Adding a new tag"},
},
)
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceAuthOptions.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceAuthOptions.json
func ExampleServicesClient_Update_searchUpdateServiceAuthOptions() {
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)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{
Properties: &armsearch.ServiceProperties{
AuthOptions: &armsearch.DataPlaneAuthOptions{
AADOrAPIKey: &armsearch.DataPlaneAADOrAPIKeyAuthOption{
AADAuthFailureMode: to.Ptr(armsearch.AADAuthFailureModeHttp401WithBearerChallenge),
},
},
ReplicaCount: to.Ptr[int32](2),
},
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
"new-tag": to.Ptr("Adding a new tag"),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// "new-tag": to.Ptr("Adding a new tag"),
// },
// Properties: &armsearch.ServiceProperties{
// AuthOptions: &armsearch.DataPlaneAuthOptions{
// AADOrAPIKey: &armsearch.DataPlaneAADOrAPIKeyAuthOption{
// AADAuthFailureMode: to.Ptr(armsearch.AADAuthFailureModeHttp401WithBearerChallenge),
// },
// },
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](2),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Updates an existing search service in the given resource group.
*
* @summary Updates an existing search service in the given resource group.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceAuthOptions.json
*/
async function searchUpdateServiceAuthOptions() {
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" },
},
replicaCount: 2,
tags: { appName: "My e-commerce app", newTag: "Adding a new tag" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.update(resourceGroupName, searchServiceName, service);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceAuthOptions.json
// this example is just showing the usage of "Services_Update" 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 SearchServiceResource created on azure
// for more information of creating SearchServiceResource, please refer to the document of SearchServiceResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string searchServiceName = "mysearchservice";
ResourceIdentifier searchServiceResourceId = SearchServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, searchServiceName);
SearchServiceResource searchService = client.GetSearchServiceResource(searchServiceResourceId);
// invoke the operation
SearchServicePatch patch = new SearchServicePatch(new AzureLocation("placeholder"))
{
ReplicaCount = 2,
AuthOptions = new SearchAadAuthDataPlaneAuthOptions()
{
AadAuthFailureMode = SearchAadAuthFailureMode.Http401WithBearerChallenge,
},
Tags =
{
["app-name"] = "My e-commerce app",
["new-tag"] = "Adding a new tag",
},
};
SearchServiceResource result = await searchService.UpdateAsync(patch);
// 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
示例响应
{
"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",
"new-tag": "Adding a new tag"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 2,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"authOptions": {
"aadOrApiKey": {
"aadAuthFailureMode": "http401WithBearerChallenge"
}
}
}
}
SearchUpdateServiceDisableLocalAuth
示例请求
PATCH https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"tags": {
"app-name": "My e-commerce app",
"new-tag": "Adding a new tag"
},
"properties": {
"replicaCount": 2,
"disableLocalAuth": true
}
}
import com.azure.resourcemanager.search.models.SearchServiceUpdate;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services Update.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchUpdateServiceDisableLocalAuth.json
*/
/**
* Sample code: SearchUpdateServiceDisableLocalAuth.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchUpdateServiceDisableLocalAuth(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().updateWithResponse("rg1", "mysearchservice",
new SearchServiceUpdate().withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag"))
.withReplicaCount(2).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_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.update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"properties": {"disableLocalAuth": True, "replicaCount": 2},
"tags": {"app-name": "My e-commerce app", "new-tag": "Adding a new tag"},
},
)
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceDisableLocalAuth.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceDisableLocalAuth.json
func ExampleServicesClient_Update_searchUpdateServiceDisableLocalAuth() {
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)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{
Properties: &armsearch.ServiceProperties{
DisableLocalAuth: to.Ptr(true),
ReplicaCount: to.Ptr[int32](2),
},
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
"new-tag": to.Ptr("Adding a new tag"),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// "new-tag": to.Ptr("Adding a new tag"),
// },
// Properties: &armsearch.ServiceProperties{
// DisableLocalAuth: to.Ptr(true),
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](2),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Updates an existing search service in the given resource group.
*
* @summary Updates an existing search service in the given resource group.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceDisableLocalAuth.json
*/
async function searchUpdateServiceDisableLocalAuth() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
disableLocalAuth: true,
replicaCount: 2,
tags: { appName: "My e-commerce app", newTag: "Adding a new tag" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.update(resourceGroupName, searchServiceName, service);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceDisableLocalAuth.json
// this example is just showing the usage of "Services_Update" 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 SearchServiceResource created on azure
// for more information of creating SearchServiceResource, please refer to the document of SearchServiceResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string searchServiceName = "mysearchservice";
ResourceIdentifier searchServiceResourceId = SearchServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, searchServiceName);
SearchServiceResource searchService = client.GetSearchServiceResource(searchServiceResourceId);
// invoke the operation
SearchServicePatch patch = new SearchServicePatch(new AzureLocation("placeholder"))
{
ReplicaCount = 2,
IsLocalAuthDisabled = true,
Tags =
{
["app-name"] = "My e-commerce app",
["new-tag"] = "Adding a new tag",
},
};
SearchServiceResource result = await searchService.UpdateAsync(patch);
// 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
示例响应
{
"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",
"new-tag": "Adding a new tag"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 2,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"disableLocalAuth": true,
"authOptions": null
}
}
SearchUpdateServiceToAllowAccessFromPrivateEndpoints
示例请求
PATCH https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"properties": {
"replicaCount": 1,
"partitionCount": 1,
"publicNetworkAccess": "disabled"
}
}
import com.azure.resourcemanager.search.models.PublicNetworkAccess;
import com.azure.resourcemanager.search.models.SearchServiceUpdate;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services Update.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json
*/
/**
* Sample code: SearchUpdateServiceToAllowAccessFromPrivateEndpoints.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
searchUpdateServiceToAllowAccessFromPrivateEndpoints(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices()
.updateWithResponse("rg1", "mysearchservice", new SearchServiceUpdate().withReplicaCount(1)
.withPartitionCount(1).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_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.update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={"properties": {"partitionCount": 1, "publicNetworkAccess": "disabled", "replicaCount": 1}},
)
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json
func ExampleServicesClient_Update_searchUpdateServiceToAllowAccessFromPrivateEndpoints() {
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)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{
Properties: &armsearch.ServiceProperties{
PartitionCount: to.Ptr[int32](1),
PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled),
ReplicaCount: to.Ptr[int32](1),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// "new-tag": to.Ptr("Adding a new tag"),
// },
// Properties: &armsearch.ServiceProperties{
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled),
// ReplicaCount: to.Ptr[int32](1),
// Status: to.Ptr(armsearch.SearchServiceStatusRunning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameBasic),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Updates an existing search service in the given resource group.
*
* @summary Updates an existing search service in the given resource group.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json
*/
async function searchUpdateServiceToAllowAccessFromPrivateEndpoints() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
partitionCount: 1,
publicNetworkAccess: "disabled",
replicaCount: 1,
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.update(resourceGroupName, searchServiceName, service);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json
// this example is just showing the usage of "Services_Update" 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 SearchServiceResource created on azure
// for more information of creating SearchServiceResource, please refer to the document of SearchServiceResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string searchServiceName = "mysearchservice";
ResourceIdentifier searchServiceResourceId = SearchServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, searchServiceName);
SearchServiceResource searchService = client.GetSearchServiceResource(searchServiceResourceId);
// invoke the operation
SearchServicePatch patch = new SearchServicePatch(new AzureLocation("placeholder"))
{
ReplicaCount = 1,
PartitionCount = 1,
PublicNetworkAccess = SearchServicePublicNetworkAccess.Disabled,
};
SearchServiceResource result = await searchService.UpdateAsync(patch);
// 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
示例响应
{
"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",
"new-tag": "Adding a new tag"
},
"sku": {
"name": "basic"
},
"properties": {
"replicaCount": 1,
"partitionCount": 1,
"status": "running",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "succeeded",
"publicNetworkAccess": "disabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
}
}
SearchUpdateServiceToAllowAccessFromPublicCustomIPs
示例请求
PATCH https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [
{
"value": "123.4.5.6"
},
{
"value": "123.4.6.0/18"
}
]
}
}
}
import com.azure.resourcemanager.search.models.IpRule;
import com.azure.resourcemanager.search.models.NetworkRuleSet;
import com.azure.resourcemanager.search.models.PublicNetworkAccess;
import com.azure.resourcemanager.search.models.SearchServiceUpdate;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services Update.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json
*/
/**
* Sample code: SearchUpdateServiceToAllowAccessFromPublicCustomIPs.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
searchUpdateServiceToAllowAccessFromPublicCustomIPs(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().updateWithResponse("rg1", "mysearchservice",
new SearchServiceUpdate().withReplicaCount(3).withPartitionCount(1)
.withPublicNetworkAccess(PublicNetworkAccess.ENABLED)
.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_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.update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"properties": {
"networkRuleSet": {"ipRules": [{"value": "123.4.5.6"}, {"value": "123.4.6.0/18"}]},
"partitionCount": 1,
"publicNetworkAccess": "enabled",
"replicaCount": 3,
}
},
)
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json
func ExampleServicesClient_Update_searchUpdateServiceToAllowAccessFromPublicCustomIPs() {
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)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{
Properties: &armsearch.ServiceProperties{
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),
PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
ReplicaCount: to.Ptr[int32](3),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// "new-tag": to.Ptr("Adding a new tag"),
// },
// Properties: &armsearch.ServiceProperties{
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// {
// Value: to.Ptr("10.2.3.4"),
// }},
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// Status: to.Ptr(armsearch.SearchServiceStatusRunning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Updates an existing search service in the given resource group.
*
* @summary Updates an existing search service in the given resource group.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json
*/
async function searchUpdateServiceToAllowAccessFromPublicCustomIPs() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
networkRuleSet: {
ipRules: [{ value: "123.4.5.6" }, { value: "123.4.6.0/18" }],
},
partitionCount: 1,
publicNetworkAccess: "enabled",
replicaCount: 3,
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.update(resourceGroupName, searchServiceName, service);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json
// this example is just showing the usage of "Services_Update" 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 SearchServiceResource created on azure
// for more information of creating SearchServiceResource, please refer to the document of SearchServiceResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string searchServiceName = "mysearchservice";
ResourceIdentifier searchServiceResourceId = SearchServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, searchServiceName);
SearchServiceResource searchService = client.GetSearchServiceResource(searchServiceResourceId);
// invoke the operation
SearchServicePatch patch = new SearchServicePatch(new AzureLocation("placeholder"))
{
ReplicaCount = 3,
PartitionCount = 1,
PublicNetworkAccess = SearchServicePublicNetworkAccess.Enabled,
IPRules =
{
new SearchServiceIPRule()
{
Value = "123.4.5.6",
},new SearchServiceIPRule()
{
Value = "123.4.6.0/18",
}
},
};
SearchServiceResource result = await searchService.UpdateAsync(patch);
// 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
示例响应
{
"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",
"new-tag": "Adding a new tag"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "running",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "succeeded",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [
{
"value": "10.2.3.4"
}
]
},
"privateEndpointConnections": []
}
}
SearchUpdateServiceToRemoveIdentity
示例请求
PATCH https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"sku": {
"name": "standard"
},
"identity": {
"type": "None"
}
}
import com.azure.resourcemanager.search.models.Identity;
import com.azure.resourcemanager.search.models.IdentityType;
import com.azure.resourcemanager.search.models.SearchServiceUpdate;
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 Update.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchUpdateServiceToRemoveIdentity.json
*/
/**
* Sample code: SearchUpdateServiceToRemoveIdentity.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchUpdateServiceToRemoveIdentity(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices()
.updateWithResponse("rg1", "mysearchservice", new SearchServiceUpdate()
.withSku(new Sku().withName(SkuName.STANDARD)).withIdentity(new Identity().withType(IdentityType.NONE)),
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_update_service_to_remove_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.update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={"identity": {"type": "None"}, "sku": {"name": "standard"}},
)
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToRemoveIdentity.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToRemoveIdentity.json
func ExampleServicesClient_Update_searchUpdateServiceToRemoveIdentity() {
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)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{
Identity: &armsearch.Identity{
Type: to.Ptr(armsearch.IdentityTypeNone),
},
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)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// },
// Identity: &armsearch.Identity{
// Type: to.Ptr(armsearch.IdentityTypeNone),
// },
// Properties: &armsearch.ServiceProperties{
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// Status: to.Ptr(armsearch.SearchServiceStatusRunning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Updates an existing search service in the given resource group.
*
* @summary Updates an existing search service in the given resource group.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToRemoveIdentity.json
*/
async function searchUpdateServiceToRemoveIdentity() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
identity: { type: "None" },
sku: { name: "standard" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.update(resourceGroupName, searchServiceName, service);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToRemoveIdentity.json
// this example is just showing the usage of "Services_Update" 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 SearchServiceResource created on azure
// for more information of creating SearchServiceResource, please refer to the document of SearchServiceResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string searchServiceName = "mysearchservice";
ResourceIdentifier searchServiceResourceId = SearchServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, searchServiceName);
SearchServiceResource searchService = client.GetSearchServiceResource(searchServiceResourceId);
// invoke the operation
SearchServicePatch patch = new SearchServicePatch(new AzureLocation("placeholder"))
{
SkuName = SearchSkuName.Standard,
Identity = new ManagedServiceIdentity("None"),
};
SearchServiceResource result = await searchService.UpdateAsync(patch);
// 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
示例响应
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "running",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "succeeded",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
},
"identity": {
"type": "None"
}
}
SearchUpdateServiceWithCmkEnforcement
示例请求
PATCH https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"tags": {
"app-name": "My e-commerce app",
"new-tag": "Adding a new tag"
},
"properties": {
"replicaCount": 2,
"encryptionWithCmk": {
"enforcement": "Enabled"
}
}
}
import com.azure.resourcemanager.search.models.EncryptionWithCmk;
import com.azure.resourcemanager.search.models.SearchEncryptionWithCmk;
import com.azure.resourcemanager.search.models.SearchServiceUpdate;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services Update.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchUpdateServiceWithCmkEnforcement.json
*/
/**
* Sample code: SearchUpdateServiceWithCmkEnforcement.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchUpdateServiceWithCmkEnforcement(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().updateWithResponse("rg1", "mysearchservice",
new SearchServiceUpdate().withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag"))
.withReplicaCount(2)
.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_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.update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"properties": {"encryptionWithCmk": {"enforcement": "Enabled"}, "replicaCount": 2},
"tags": {"app-name": "My e-commerce app", "new-tag": "Adding a new tag"},
},
)
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceWithCmkEnforcement.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceWithCmkEnforcement.json
func ExampleServicesClient_Update_searchUpdateServiceWithCmkEnforcement() {
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)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{
Properties: &armsearch.ServiceProperties{
EncryptionWithCmk: &armsearch.EncryptionWithCmk{
Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkEnabled),
},
ReplicaCount: to.Ptr[int32](2),
},
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
"new-tag": to.Ptr("Adding a new tag"),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// "new-tag": to.Ptr("Adding a new tag"),
// },
// Properties: &armsearch.ServiceProperties{
// AuthOptions: &armsearch.DataPlaneAuthOptions{
// APIKeyOnly: map[string]any{
// },
// },
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkEnabled),
// },
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](2),
// SharedPrivateLinkResources: []*armsearch.SharedPrivateLinkResource{
// },
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Updates an existing search service in the given resource group.
*
* @summary Updates an existing search service in the given resource group.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceWithCmkEnforcement.json
*/
async function searchUpdateServiceWithCmkEnforcement() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
encryptionWithCmk: { enforcement: "Enabled" },
replicaCount: 2,
tags: { appName: "My e-commerce app", newTag: "Adding a new tag" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.update(resourceGroupName, searchServiceName, service);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceWithCmkEnforcement.json
// this example is just showing the usage of "Services_Update" 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 SearchServiceResource created on azure
// for more information of creating SearchServiceResource, please refer to the document of SearchServiceResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string searchServiceName = "mysearchservice";
ResourceIdentifier searchServiceResourceId = SearchServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, searchServiceName);
SearchServiceResource searchService = client.GetSearchServiceResource(searchServiceResourceId);
// invoke the operation
SearchServicePatch patch = new SearchServicePatch(new AzureLocation("placeholder"))
{
ReplicaCount = 2,
EncryptionWithCmk = new SearchEncryptionWithCmk()
{
Enforcement = SearchEncryptionWithCmkEnforcement.Enabled,
},
Tags =
{
["app-name"] = "My e-commerce app",
["new-tag"] = "Adding a new tag",
},
};
SearchServiceResource result = await searchService.UpdateAsync(patch);
// 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
示例响应
{
"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",
"new-tag": "Adding a new tag"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 2,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Enabled",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
}
}
}
SearchUpdateServiceWithSemanticSearch
示例请求
PATCH https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"tags": {
"app-name": "My e-commerce app",
"new-tag": "Adding a new tag"
},
"properties": {
"replicaCount": 2,
"semanticSearch": "standard"
}
}
import com.azure.resourcemanager.search.models.SearchSemanticSearch;
import com.azure.resourcemanager.search.models.SearchServiceUpdate;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services Update.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchUpdateServiceWithSemanticSearch.json
*/
/**
* Sample code: SearchUpdateServiceWithSemanticSearch.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchUpdateServiceWithSemanticSearch(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().updateWithResponse("rg1", "mysearchservice",
new SearchServiceUpdate().withTags(mapOf("app-name", "My e-commerce app", "new-tag", "Adding a new tag"))
.withReplicaCount(2).withSemanticSearch(SearchSemanticSearch.STANDARD),
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_update_service_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.update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"properties": {"replicaCount": 2, "semanticSearch": "standard"},
"tags": {"app-name": "My e-commerce app", "new-tag": "Adding a new tag"},
},
)
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceWithSemanticSearch.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceWithSemanticSearch.json
func ExampleServicesClient_Update_searchUpdateServiceWithSemanticSearch() {
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)
}
res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{
Properties: &armsearch.ServiceProperties{
ReplicaCount: to.Ptr[int32](2),
SemanticSearch: to.Ptr(armsearch.SearchSemanticSearchStandard),
},
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
"new-tag": to.Ptr("Adding a new tag"),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// "new-tag": to.Ptr("Adding a new tag"),
// },
// Properties: &armsearch.ServiceProperties{
// AuthOptions: &armsearch.DataPlaneAuthOptions{
// APIKeyOnly: map[string]any{
// },
// },
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkUnspecified),
// },
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](2),
// SemanticSearch: to.Ptr(armsearch.SearchSemanticSearchStandard),
// SharedPrivateLinkResources: []*armsearch.SharedPrivateLinkResource{
// },
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Updates an existing search service in the given resource group.
*
* @summary Updates an existing search service in the given resource group.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceWithSemanticSearch.json
*/
async function searchUpdateServiceWithSemanticSearch() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
replicaCount: 2,
semanticSearch: "standard",
tags: { appName: "My e-commerce app", newTag: "Adding a new tag" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.update(resourceGroupName, searchServiceName, service);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceWithSemanticSearch.json
// this example is just showing the usage of "Services_Update" 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 SearchServiceResource created on azure
// for more information of creating SearchServiceResource, please refer to the document of SearchServiceResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string searchServiceName = "mysearchservice";
ResourceIdentifier searchServiceResourceId = SearchServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, searchServiceName);
SearchServiceResource searchService = client.GetSearchServiceResource(searchServiceResourceId);
// invoke the operation
SearchServicePatch patch = new SearchServicePatch(new AzureLocation("placeholder"))
{
ReplicaCount = 2,
SemanticSearch = SearchSemanticSearch.Standard,
Tags =
{
["app-name"] = "My e-commerce app",
["new-tag"] = "Adding a new tag",
},
};
SearchServiceResource result = await searchService.UpdateAsync(patch);
// 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
示例响应
{
"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",
"new-tag": "Adding a new tag"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 2,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"semanticSearch": "standard"
}
}
定义
AadAuthFailureMode
枚举
描述搜索服务的数据平面 API 针对身份验证失败的请求发送的响应。
值 |
说明 |
http401WithBearerChallenge
|
指示失败身份验证的请求应显示 HTTP 状态代码 401(未授权),并提出持有者质询。
|
http403
|
指示失败身份验证的请求应显示 HTTP 状态代码 403(禁止)。
|
ApiKeyOnly
Object
指示只能使用 API 密钥进行身份验证。
CloudError
Object
包含有关 API 错误的信息。
CloudErrorBody
Object
描述具有错误代码和消息的特定 API 错误。
名称 |
类型 |
说明 |
code
|
string
|
比 HTTP 状态代码更准确地描述错误条件的错误代码。 可用于以编程方式处理特定错误案例。
|
details
|
CloudErrorBody[]
|
包含与此错误相关的嵌套错误。
|
message
|
string
|
详细说明错误并提供调试信息的消息。
|
target
|
string
|
特定错误的目标(例如,错误中属性的名称)。
|
DataPlaneAadOrApiKeyAuthOption
Object
指示 API 密钥或来自 Microsoft Entra ID 租户的访问令牌可用于身份验证。
DataPlaneAuthOptions
Object
定义搜索服务如何对数据平面请求进行身份验证的选项。 如果“disableLocalAuth”设置为 true,则无法设置此项。
EncryptionWithCmk
Object
描述一个策略,该策略确定如何使用 customer=managed 密钥对搜索服务中的资源进行加密。
HostingMode
枚举
仅适用于 standard3 SKU。 可以将此属性设置为最多允许 3 个高密度分区,允许最多 1000 个索引,这远远高于任何其他 SKU 允许的最大索引。 对于 standard3 SKU,该值为“default”或“highDensity”。 对于所有其他 SKU,此值必须为“default”。
值 |
说明 |
default
|
索引数限制取决于 SKU 的默认限制。
|
highDensity
|
只有 standard3 SKU 的应用程序,其中搜索服务最多可以有 1000 个索引。
|
Identity
Object
资源的标识。
名称 |
类型 |
说明 |
principalId
|
string
|
搜索服务的系统分配标识的主体 ID。
|
tenantId
|
string
|
搜索服务的系统分配标识的租户 ID。
|
type
|
IdentityType
|
标识类型。
|
IdentityType
枚举
标识类型。
IpRule
Object
搜索服务的 IP 限制规则。
名称 |
类型 |
说明 |
value
|
string
|
与单个 IPv4 地址(例如,123.1.2.3)或 CIDR 格式(例如,允许 123.1.2.3/24)的 IP 范围对应的值。
|
NetworkRuleSet
Object
确定如何访问搜索服务的网络特定规则。
名称 |
类型 |
说明 |
ipRules
|
IpRule[]
|
用于 IP 防火墙的 IP 限制规则列表。 与规则不匹配的任何 IP 都将被防火墙阻止。 仅当搜索服务的“publicNetworkAccess”已启用时,才应用这些规则。
|
PrivateEndpoint
Object
来自 Microsoft.Network 提供程序的专用终结点资源。
名称 |
类型 |
说明 |
id
|
string
|
Microsoft.Network 提供程序中专用终结点资源的资源 ID。
|
PrivateEndpointConnection
Object
描述与搜索服务的现有专用终结点连接。
名称 |
类型 |
说明 |
id
|
string
|
资源的完全限定资源 ID。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
资源的名称
|
properties
|
PrivateEndpointConnectionProperties
|
描述与搜索服务的现有专用终结点连接的属性。
|
type
|
string
|
资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”
|
PrivateEndpointConnectionProperties
Object
描述与搜索服务的现有专用终结点连接的属性。
PrivateLinkServiceConnectionProvisioningState
枚举
专用链接服务连接的预配状态。 有效值是更新、删除、失败、成功或不完整
值 |
说明 |
Canceled
|
已取消专用链接服务连接资源的预配请求
|
Deleting
|
正在删除专用链接服务连接。
|
Failed
|
无法预配或删除专用链接服务连接。
|
Incomplete
|
已接受专用链接服务连接资源的预配请求,但尚未开始创建过程。
|
Succeeded
|
专用链接服务连接已完成预配,可供审批。
|
Updating
|
专用链接服务连接正在与其他资源一起创建,以便其功能完全正常运行。
|
PrivateLinkServiceConnectionState
Object
描述与 Azure 专用终结点的现有专用链接服务连接的当前状态。
名称 |
类型 |
默认值 |
说明 |
actionsRequired
|
string
|
None
|
对可能需要执行的任何额外作的说明。
|
description
|
string
|
|
专用链接服务连接状态的说明。
|
status
|
PrivateLinkServiceConnectionStatus
|
|
专用链接服务连接的状态。 有效值为 Pending、Approved、Rejected 或 Disconnected。
|
PrivateLinkServiceConnectionStatus
枚举
专用链接服务连接的状态。 有效值为 Pending、Approved、Rejected 或 Disconnected。
值 |
说明 |
Approved
|
专用终结点连接已获批准,可供使用。
|
Disconnected
|
专用终结点连接已从服务中删除。
|
Pending
|
已创建专用终结点连接,并且正在等待审批。
|
Rejected
|
专用终结点连接已被拒绝,不能使用。
|
ProvisioningState
枚举
对搜索服务执行的最后一个预配作的状态。 预配是在建立服务容量时发生的中间状态。 设置容量后,provisioningState 将更改为“succeeded”或“failed”。 客户端应用程序可以使用“获取搜索服务”作来轮询预配状态(建议的轮询间隔为 30 秒到 1 分钟),以查看作何时完成。 如果使用免费服务,此值在调用“创建搜索服务”时往往直接返回为“成功”。 这是因为免费服务使用已设置的容量。
值 |
说明 |
failed
|
上次预配作失败。
|
provisioning
|
正在预配或纵向扩展或缩减搜索服务。
|
succeeded
|
上次预配作已成功完成。
|
PublicNetworkAccess
枚举
此值可以设置为“已启用”,以避免对现有客户资源和模板进行重大更改。 如果设置为“disabled”,则不允许通过公共接口的流量,专用终结点连接将是独占访问方法。
SearchEncryptionComplianceStatus
枚举
描述搜索服务是否与具有非客户加密资源有关。 如果服务具有多个非客户加密的资源,并且“强制”处于“启用状态”,则服务将被标记为“nonCompliant”。
值 |
说明 |
Compliant
|
指示搜索服务符合要求,要么因为非客户加密资源的数量为零,要么禁用强制。
|
NonCompliant
|
指示搜索服务有多个非客户加密资源。
|
SearchEncryptionWithCmk
枚举
描述搜索服务应如何强制实施一个或多个非客户加密资源。
值 |
说明 |
Disabled
|
不会执行任何强制作,搜索服务可以具有非客户加密的资源。
|
Enabled
|
如果存在一个或多个非客户加密资源,搜索服务将标记为不合规。
|
Unspecified
|
未显式指定强制策略,其行为与设置为“Disabled”的行为相同。
|
SearchSemanticSearch
枚举
设置控制语义搜索可用性的选项。 此配置仅适用于特定位置的某些搜索 SKU。
值 |
说明 |
disabled
|
指示为搜索服务禁用语义排名。
|
free
|
在搜索服务上启用语义排名,并指示它在免费层的限制内使用。 这将限制语义排名请求的数量,并免费提供。 这是新预配的搜索服务的默认值。
|
standard
|
启用搜索服务上的语义排名作为可计费功能,吞吐量和语义排名请求量更高。
|
SearchService
Object
描述搜索服务及其当前状态。
名称 |
类型 |
默认值 |
说明 |
id
|
string
|
|
资源的完全限定资源 ID。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
identity
|
Identity
|
|
资源的标识。
|
location
|
string
|
|
资源所在的地理位置
|
name
|
string
|
|
资源的名称
|
properties.authOptions
|
DataPlaneAuthOptions
|
|
定义搜索服务的数据平面 API 如何对请求进行身份验证的选项。 如果“disableLocalAuth”设置为 true,则无法设置此项。
|
properties.disableLocalAuth
|
boolean
|
|
如果设置为 true,则不允许调用搜索服务以使用 API 密钥进行身份验证。 如果定义了“dataPlaneAuthOptions”,则无法将其设置为 true。
|
properties.encryptionWithCmk
|
EncryptionWithCmk
|
|
指定有关使用搜索服务中的客户经理密钥加密资源(如索引)的任何策略。
|
properties.hostingMode
|
HostingMode
|
default
|
仅适用于 standard3 SKU。 可以将此属性设置为最多允许 3 个高密度分区,允许最多 1000 个索引,这远远高于任何其他 SKU 允许的最大索引。 对于 standard3 SKU,该值为“default”或“highDensity”。 对于所有其他 SKU,此值必须为“default”。
|
properties.networkRuleSet
|
NetworkRuleSet
|
|
确定如何访问搜索服务的网络特定规则。
|
properties.partitionCount
|
integer
(int32)
minimum: 1 maximum: 12
|
1
|
搜索服务中的分区数;如果指定,则它可以是 1、2、3、4、6 或 12。 大于 1 的值仅适用于标准 SKU。 对于 hostingMode 设置为“highDensity”的“standard3”服务,允许的值介于 1 到 3 之间。
|
properties.privateEndpointConnections
|
PrivateEndpointConnection[]
|
|
与搜索服务的专用终结点连接列表。
|
properties.provisioningState
|
ProvisioningState
|
|
对搜索服务执行的最后一个预配作的状态。 预配是在建立服务容量时发生的中间状态。 设置容量后,provisioningState 将更改为“succeeded”或“failed”。 客户端应用程序可以使用“获取搜索服务”作来轮询预配状态(建议的轮询间隔为 30 秒到 1 分钟),以查看作何时完成。 如果使用免费服务,此值在调用“创建搜索服务”时往往直接返回为“成功”。 这是因为免费服务使用已设置的容量。
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
enabled
|
此值可以设置为“已启用”,以避免对现有客户资源和模板进行重大更改。 如果设置为“disabled”,则不允许通过公共接口的流量,专用终结点连接将是独占访问方法。
|
properties.replicaCount
|
integer
(int32)
minimum: 1 maximum: 12
|
1
|
搜索服务中的副本数。 如果指定,它必须是标准 SKU 的 1 到 12(含 1 到 3)之间的值,对于基本 SKU,该值必须介于 1 和 3 之间。
|
properties.semanticSearch
|
SearchSemanticSearch
|
|
设置控制语义搜索可用性的选项。 此配置仅适用于特定位置的某些搜索 SKU。
|
properties.sharedPrivateLinkResources
|
SharedPrivateLinkResource[]
|
|
搜索服务管理的共享专用链接资源列表。
|
properties.status
|
SearchServiceStatus
|
|
搜索服务的状态。 可能的值包括:“running”:搜索服务正在运行,未执行任何预配作。 “provisioning”:正在预配或纵向扩展或缩减搜索服务。 “delete”:正在删除搜索服务。 “已降级”:搜索服务已降级。 当基础搜索单元不正常时,可能会发生这种情况。 搜索服务最有可能正常运行,但性能可能很慢,某些请求可能会被删除。 “disabled”:已禁用搜索服务。 在此状态下,服务将拒绝所有 API 请求。 “error”:搜索服务处于错误状态。 如果服务处于降级、禁用或错误状态,Microsoft会积极调查基础问题。 根据预配的搜索单位数,这些状态中的专用服务仍可收费。
|
properties.statusDetails
|
string
|
|
搜索服务状态的详细信息。
|
sku
|
Sku
|
|
搜索服务的 SKU,用于确定计费费率和容量限制。 创建新搜索服务时,此属性是必需的。
|
tags
|
object
|
|
资源标记。
|
type
|
string
|
|
资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”
|
SearchServiceStatus
枚举
搜索服务的状态。 可能的值包括:“running”:搜索服务正在运行,未执行任何预配作。 “provisioning”:正在预配或纵向扩展或缩减搜索服务。 “delete”:正在删除搜索服务。 “已降级”:搜索服务已降级。 当基础搜索单元不正常时,可能会发生这种情况。 搜索服务最有可能正常运行,但性能可能很慢,某些请求可能会被删除。 “disabled”:已禁用搜索服务。 在此状态下,服务将拒绝所有 API 请求。 “error”:搜索服务处于错误状态。 如果服务处于降级、禁用或错误状态,Microsoft会积极调查基础问题。 根据预配的搜索单位数,这些状态中的专用服务仍可收费。
值 |
说明 |
degraded
|
搜索服务已降级,因为基础搜索单元不正常。
|
deleting
|
正在删除搜索服务。
|
disabled
|
搜索服务已禁用,所有 API 请求都将被拒绝。
|
error
|
搜索服务处于错误状态,指示预配失败或被删除。
|
provisioning
|
正在预配或纵向扩展或缩减搜索服务。
|
running
|
搜索服务正在运行,并且未执行任何预配作。
|
SearchServiceUpdate
Object
用于更新搜索服务的参数。
名称 |
类型 |
默认值 |
说明 |
id
|
string
|
|
资源的完全限定资源 ID。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
identity
|
Identity
|
|
资源的标识。
|
location
|
string
|
|
资源的地理位置。 这必须是受支持和注册的 Azure 地理区域之一(例如美国西部、美国东部、东南亚等)。 创建新资源时,此属性是必需的。
|
name
|
string
|
|
资源的名称
|
properties.authOptions
|
DataPlaneAuthOptions
|
|
定义搜索服务的数据平面 API 如何对请求进行身份验证的选项。 如果“disableLocalAuth”设置为 true,则无法设置此项。
|
properties.disableLocalAuth
|
boolean
|
|
如果设置为 true,则不允许调用搜索服务以使用 API 密钥进行身份验证。 如果定义了“dataPlaneAuthOptions”,则无法将其设置为 true。
|
properties.encryptionWithCmk
|
EncryptionWithCmk
|
|
指定有关使用搜索服务中的客户经理密钥加密资源(如索引)的任何策略。
|
properties.hostingMode
|
HostingMode
|
default
|
仅适用于 standard3 SKU。 可以将此属性设置为最多允许 3 个高密度分区,允许最多 1000 个索引,这远远高于任何其他 SKU 允许的最大索引。 对于 standard3 SKU,该值为“default”或“highDensity”。 对于所有其他 SKU,此值必须为“default”。
|
properties.networkRuleSet
|
NetworkRuleSet
|
|
确定如何访问搜索服务的网络特定规则。
|
properties.partitionCount
|
integer
(int32)
minimum: 1 maximum: 12
|
1
|
搜索服务中的分区数;如果指定,则它可以是 1、2、3、4、6 或 12。 大于 1 的值仅适用于标准 SKU。 对于 hostingMode 设置为“highDensity”的“standard3”服务,允许的值介于 1 到 3 之间。
|
properties.privateEndpointConnections
|
PrivateEndpointConnection[]
|
|
与搜索服务的专用终结点连接列表。
|
properties.provisioningState
|
ProvisioningState
|
|
对搜索服务执行的最后一个预配作的状态。 预配是在建立服务容量时发生的中间状态。 设置容量后,provisioningState 将更改为“succeeded”或“failed”。 客户端应用程序可以使用“获取搜索服务”作来轮询预配状态(建议的轮询间隔为 30 秒到 1 分钟),以查看作何时完成。 如果使用免费服务,此值在调用“创建搜索服务”时往往直接返回为“成功”。 这是因为免费服务使用已设置的容量。
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
enabled
|
此值可以设置为“已启用”,以避免对现有客户资源和模板进行重大更改。 如果设置为“disabled”,则不允许通过公共接口的流量,专用终结点连接将是独占访问方法。
|
properties.replicaCount
|
integer
(int32)
minimum: 1 maximum: 12
|
1
|
搜索服务中的副本数。 如果指定,它必须是标准 SKU 的 1 到 12(含 1 到 3)之间的值,对于基本 SKU,该值必须介于 1 和 3 之间。
|
properties.semanticSearch
|
SearchSemanticSearch
|
|
设置控制语义搜索可用性的选项。 此配置仅适用于特定位置的某些搜索 SKU。
|
properties.sharedPrivateLinkResources
|
SharedPrivateLinkResource[]
|
|
搜索服务管理的共享专用链接资源列表。
|
properties.status
|
SearchServiceStatus
|
|
搜索服务的状态。 可能的值包括:“running”:搜索服务正在运行,未执行任何预配作。 “provisioning”:正在预配或纵向扩展或缩减搜索服务。 “delete”:正在删除搜索服务。 “已降级”:搜索服务已降级。 当基础搜索单元不正常时,可能会发生这种情况。 搜索服务最有可能正常运行,但性能可能很慢,某些请求可能会被删除。 “disabled”:已禁用搜索服务。 在此状态下,服务将拒绝所有 API 请求。 “error”:搜索服务处于错误状态。 如果服务处于降级、禁用或错误状态,Microsoft会积极调查基础问题。 根据预配的搜索单位数,这些状态中的专用服务仍可收费。
|
properties.statusDetails
|
string
|
|
搜索服务状态的详细信息。
|
sku
|
Sku
|
|
搜索服务的 SKU,用于确定计费费率和容量限制。 创建新搜索服务时,此属性是必需的。
|
tags
|
object
|
|
用于帮助在 Azure 门户中对资源进行分类的标记。
|
type
|
string
|
|
资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”
|
SharedPrivateLinkResource
Object
描述由搜索服务管理的共享专用链接资源。
名称 |
类型 |
说明 |
id
|
string
|
资源的完全限定资源 ID。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
资源的名称
|
properties
|
SharedPrivateLinkResourceProperties
|
描述由搜索服务管理的共享专用链接资源的属性。
|
type
|
string
|
资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”
|
SharedPrivateLinkResourceProperties
Object
描述由搜索服务管理的现有共享专用链接资源的属性。
名称 |
类型 |
说明 |
groupId
|
string
|
共享专用链接资源的提供程序中的组 ID。
|
privateLinkResourceId
|
string
|
共享专用链接资源的资源的资源 ID。
|
provisioningState
|
SharedPrivateLinkResourceProvisioningState
|
共享专用链接资源的预配状态。 有效值为更新、删除、失败、成功或不完整。
|
requestMessage
|
string
|
请求消息,用于请求批准共享专用链接资源。
|
resourceRegion
|
string
|
可选。 可用于指定要创建共享专用链接的资源的 Azure 资源管理器位置。 只有 DNS 配置是区域(例如 Azure Kubernetes 服务)的资源才需要这样做。
|
status
|
SharedPrivateLinkResourceStatus
|
共享专用链接资源的状态。 有效值为 Pending、Approved、Rejected 或 Disconnected。
|
SharedPrivateLinkResourceProvisioningState
枚举
共享专用链接资源的预配状态。 有效值为更新、删除、失败、成功或不完整。
值 |
说明 |
Deleting
|
|
Failed
|
|
Incomplete
|
|
Succeeded
|
|
Updating
|
|
SharedPrivateLinkResourceStatus
枚举
共享专用链接资源的状态。 有效值为 Pending、Approved、Rejected 或 Disconnected。
值 |
说明 |
Approved
|
|
Disconnected
|
|
Pending
|
|
Rejected
|
|
Sku
Object
定义搜索服务的 SKU,用于确定计费费率和容量限制。
名称 |
类型 |
说明 |
name
|
SkuName
|
搜索服务的 SKU。 有效值包括:“free”:共享服务。 “basic”:最多包含 3 个副本的专用服务。 “standard”:最多包含 12 个分区和 12 个副本的专用服务。 “standard2”:类似于标准,但每个搜索单位的容量更多。 “standard3”:最大标准产品/服务最多包含 12 个分区和 12 个副本(如果同时将 hostingMode 属性设置为“highDensity”,则最多具有 3 个具有更多索引的分区)。 “storage_optimized_l1”:支持每个分区 1TB,最多支持 12 个分区。 “storage_optimized_l2”:支持每个分区 2TB,最多支持 12 个分区。
|
SkuName
枚举
搜索服务的 SKU。 有效值包括:“free”:共享服务。 “basic”:最多包含 3 个副本的专用服务。 “standard”:最多包含 12 个分区和 12 个副本的专用服务。 “standard2”:类似于标准,但每个搜索单位的容量更多。 “standard3”:最大标准产品/服务最多包含 12 个分区和 12 个副本(如果同时将 hostingMode 属性设置为“highDensity”,则最多具有 3 个具有更多索引的分区)。 “storage_optimized_l1”:支持每个分区 1TB,最多支持 12 个分区。 “storage_optimized_l2”:支持每个分区 2TB,最多支持 12 个分区。
值 |
说明 |
basic
|
专用服务的计费层最多包含 3 个副本。
|
free
|
免费层,没有 SLA 保证,以及可计费层上提供的功能子集。
|
standard
|
专用服务的计费层最多包含 12 个分区和 12 个副本。
|
standard2
|
类似于“标准”,但每个搜索单位的容量更多。
|
standard3
|
最大标准产品/服务最多包含 12 个分区和 12 个副本(如果同时将 hostingMode 属性设置为“highDensity”,则最多包含 3 个具有更多索引的分区)。
|
storage_optimized_l1
|
专用服务的计费层支持每个分区 1TB,最多支持 12 个分区。
|
storage_optimized_l2
|
专用服务的计费层支持每个分区 2TB,最多支持 12 个分区。
|