匯報 指定資源群組中的現有搜尋服務。
PATCH https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}?api-version=2023-11-01
URI 參數
名稱 |
位於 |
必要 |
類型 |
Description |
resourceGroupName
|
path |
True
|
string
|
目前訂用帳戶內的資源組名。 您可以從 Azure 資源管理員 API 或入口網站取得這個值。
|
searchServiceName
|
path |
True
|
string
|
要更新之搜尋服務的名稱。
|
subscriptionId
|
path |
True
|
string
|
Microsoft Azure 訂用帳戶的唯一標識符。 您可以從 Azure Resource Manager API、命令行工具或入口網站取得此值。
|
api-version
|
query |
True
|
string
|
要用於每個要求的 API 版本。
|
名稱 |
必要 |
類型 |
Description |
x-ms-client-request-id
|
|
string
uuid
|
用戶端產生之可識別此要求的 GUID 值。 如果已指定,則會將回應資訊包含在響應資訊中,以作為追蹤要求的方式。
|
要求本文
名稱 |
類型 |
Description |
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
|
搜尋服務中的數據分割數目;如果指定,它可以是 1、2、3、4、6 或 12。 大於 1 的值僅適用於標準 SKU。 對於 hostingMode 設定為 'highDensity' 的 'standard3' 服務,允許的值介於 1 到 3 之間。
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
此值可以設定為 「已啟用」,以避免對現有的客戶資源和範本進行重大變更。 如果設定為 「已停用」,則不允許透過公用介面的流量,而且私人端點聯機會是獨佔存取方法。
|
properties.replicaCount
|
integer
|
搜尋服務中的複本數目。 如果指定,它必須是標準 SKU 介於 1 到 12 之間的值,或基本 SKU 的 1 到 3 內含值。
|
properties.semanticSearch
|
SearchSemanticSearch
|
設定控制語意搜尋可用性的選項。 此設定僅適用於特定位置中的特定搜尋 SKU。
|
sku
|
Sku
|
搜尋服務的 SKU,決定計費率和容量限制。 建立新的搜尋服務時,需要這個屬性。
|
tags
|
object
|
標籤,協助分類 Azure 入口網站中的資源。
|
回應
名稱 |
類型 |
Description |
200 OK
|
SearchService
|
已成功更新現有的服務定義。 如果您變更複本或分割區的數目,則調整作業會以異步方式發生。 您可以定期取得服務定義,並透過 provisioningState 屬性監視進度。
|
Other Status Codes
|
CloudError
|
HTTP 400 (不正確的要求) :指定的服務定義無效,或您嘗試變更不可變的屬性;如需詳細資訊,請參閱回應中的錯誤碼和訊息。 找不到 HTTP 404 () :找不到訂用帳戶或資源群組。 HTTP 409 (衝突) :指定的訂用帳戶已停用。
|
安全性
azure_auth
Microsoft Entra ID OAuth2 授權流程。
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
名稱 |
Description |
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 會針對驗證失敗的要求傳送哪些回應。
名稱 |
類型 |
Description |
http401WithBearerChallenge
|
string
|
指出失敗驗證的要求應該會顯示 HTTP 狀態代碼 401 (未經授權) ,並呈現持有人挑戰。
|
http403
|
string
|
指出失敗驗證的要求應該會顯示 HTTP 狀態代碼 403 (禁止) 。
|
ApiKeyOnly
表示只能使用 API 金鑰進行驗證。
CloudError
包含 API 錯誤的相關信息。
CloudErrorBody
描述具有錯誤碼和訊息的特定 API 錯誤。
名稱 |
類型 |
Description |
code
|
string
|
比起 HTTP 狀態代碼,更精確地描述錯誤狀況的錯誤碼。 可用來以程式設計方式處理特定錯誤案例。
|
details
|
CloudErrorBody[]
|
包含與此錯誤相關的巢狀錯誤。
|
message
|
string
|
描述錯誤的詳細訊息,並提供偵錯資訊。
|
target
|
string
|
例如,錯誤 (中屬性的名稱) 的特定錯誤目標。
|
DataPlaneAadOrApiKeyAuthOption
表示 API 金鑰或來自 Microsoft Entra ID 租使用者的存取令牌可用於驗證。
DataPlaneAuthOptions
定義搜尋服務如何驗證數據平面要求的選項。 如果 'disableLocalAuth' 設定為 true,則無法設定此設定。
EncryptionWithCmk
描述一個原則,決定搜尋服務內的資源如何以 customer=managed 密鑰加密。
HostingMode
僅適用於 standard3 SKU。 您可以設定此屬性來啟用最多 3 個高密度分割區,最多允許 1000 個索引,這遠高於任何其他 SKU 允許的最大索引。 針對 standard3 SKU,此值為 'default' 或 'highDensity'。 對於所有其他 SKU,此值必須是 'default'。
名稱 |
類型 |
Description |
default
|
string
|
索引數目的限制取決於 SKU 的預設限制。
|
highDensity
|
string
|
只有 standard3 SKU 的應用程式,其中搜尋服務最多可以有 1000 個索引。
|
Identity
資源的身分識別。
名稱 |
類型 |
Description |
principalId
|
string
|
搜尋服務系統指派之身分識別的主體標識碼。
|
tenantId
|
string
|
搜尋服務系統指派身分識別的租用戶標識碼。
|
type
|
IdentityType
|
識別類型。
|
IdentityType
識別類型。
名稱 |
類型 |
Description |
None
|
string
|
|
SystemAssigned
|
string
|
|
IpRule
搜尋服務的IP限制規則。
名稱 |
類型 |
Description |
value
|
string
|
對應至單一 IPv4 位址的值 (例如 123.1.2.3) 或 CIDR 格式的 IP 範圍 (,例如 123.1.2.3/24) 。
|
NetworkRuleSet
決定如何連線到搜尋服務的網路特定規則。
名稱 |
類型 |
Description |
ipRules
|
IpRule[]
|
用於IP防火牆的IP限制規則清單。 防火牆會封鎖不符合規則的任何IP。 只有在搜尋服務的 'publicNetworkAccess' 已啟用時,才會套用這些規則。
|
PrivateEndpoint
來自 Microsoft.Network 提供者的私人端點資源。
名稱 |
類型 |
Description |
id
|
string
|
Microsoft.Network 提供者私人端點資源的資源標識符。
|
PrivateEndpointConnection
描述與搜尋服務的現有私人端點連線。
名稱 |
類型 |
Description |
id
|
string
|
資源的完整資源識別碼。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
資源的名稱
|
properties
|
PrivateEndpointConnectionProperties
|
描述現有私人端點連線與搜尋服務的屬性。
|
type
|
string
|
資源類型。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”
|
PrivateEndpointConnectionProperties
描述與搜尋服務之現有私人端點連線的屬性。
PrivateLinkServiceConnectionProvisioningState
私人鏈接服務連線的布建狀態。 有效值為 [更新]、[刪除]、[失敗]、[成功] 或 [不完整]
名稱 |
類型 |
Description |
Canceled
|
string
|
已取消私人連結服務連線資源的布建要求
|
Deleting
|
string
|
私人鏈接服務連線正在進行刪除。
|
Failed
|
string
|
無法布建或刪除私人連結服務連線。
|
Incomplete
|
string
|
已接受私人連結服務連線資源的布建要求,但尚未開始建立程式。
|
Succeeded
|
string
|
私人鏈接服務連線已完成佈建,且已準備好進行核准。
|
Updating
|
string
|
私人鏈接服務連線正在建立時,與其他資源一起建立,使其功能完整。
|
PrivateLinkServiceConnectionState
描述現有與 Azure 私人端點 Private Link 服務連線的目前狀態。
名稱 |
類型 |
預設值 |
Description |
actionsRequired
|
string
|
None
|
任何可能需要的額外動作的描述。
|
description
|
string
|
|
私人鏈接服務連線狀態的描述。
|
status
|
PrivateLinkServiceConnectionStatus
|
|
私人鏈接服務連線的狀態。 有效值為 Pending、Approved、Rejected 或 Disconnected。
|
PrivateLinkServiceConnectionStatus
私人鏈接服務連線的狀態。 有效值為 Pending、Approved、Rejected 或 Disconnected。
名稱 |
類型 |
Description |
Approved
|
string
|
私人端點連線已核准並可供使用。
|
Disconnected
|
string
|
私人端點連線已從服務中移除。
|
Pending
|
string
|
已建立私人端點連線,並擱置核准。
|
Rejected
|
string
|
私人端點連線已遭到拒絕且無法使用。
|
ProvisioningState
在搜尋服務上執行的最後一個布建作業狀態。 佈建是一種過渡狀態,當服務容量正在建立時發生。 設定容量之後,provisioningState 會變更為「成功」或「失敗」。 用戶端應用程式可以使用取得搜尋服務作業來查看作業完成的時間, (建議的輪詢間隔是從 30 秒到一分鐘) 輪詢狀態。 如果您使用免費服務,此值通常會直接在建立搜尋服務的呼叫中回復為「成功」。 這是因為免費服務使用早已設定的容量。
名稱 |
類型 |
Description |
failed
|
string
|
上次布建作業失敗。
|
provisioning
|
string
|
正在布建或相應增加或減少搜尋服務。
|
succeeded
|
string
|
上次布建作業已順利完成。
|
PublicNetworkAccess
此值可以設定為 「已啟用」,以避免對現有的客戶資源和範本進行重大變更。 如果設定為 「已停用」,則不允許透過公用介面的流量,而且私人端點聯機會是獨佔存取方法。
名稱 |
類型 |
Description |
disabled
|
string
|
|
enabled
|
string
|
|
SearchEncryptionComplianceStatus
描述搜尋服務是否符合非客戶加密資源規範。 如果服務具有一個以上的非客戶加密資源,且「強制」為「已啟用」,則服務將會標示為「不符合規範」。
名稱 |
類型 |
Description |
Compliant
|
string
|
表示搜尋服務符合規範,可能是因為非客戶加密的資源數目是零或停用強制執行。
|
NonCompliant
|
string
|
表示搜尋服務有多個非客戶加密的資源。
|
SearchEncryptionWithCmk
描述搜尋服務應如何強制執行一或多個非客戶加密的資源。
名稱 |
類型 |
Description |
Disabled
|
string
|
不會強制執行,而且搜尋服務可以有非客戶加密的資源。
|
Enabled
|
string
|
如果有一或多個非客戶加密的資源,搜尋服務 將會標示為不符合規範。
|
Unspecified
|
string
|
未明確指定強制原則,其行為與設定為 『Disabled』 的行為相同。
|
SearchSemanticSearch
設定控制語意搜尋可用性的選項。 此設定僅適用於特定位置中的特定搜尋 SKU。
名稱 |
類型 |
Description |
disabled
|
string
|
表示搜尋服務已停用語意排名。
|
free
|
string
|
在搜尋服務上啟用語意排名,並指出它在免費層的限制內使用。 這會限制語意排名要求的數量,而且不需額外費用。 這是新布建搜尋服務的預設值。
|
standard
|
string
|
在搜尋服務上啟用語意排名作為可計費功能,並具有較高的輸送量和語意排名要求數量。
|
SearchService
描述搜尋服務及其目前狀態。
名稱 |
類型 |
預設值 |
Description |
id
|
string
|
|
資源的完整資源識別碼。 例如 - /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
|
1
|
搜尋服務中的數據分割數目;如果指定,它可以是 1、2、3、4、6 或 12。 大於 1 的值僅適用於標準 SKU。 對於 hostingMode 設定為 'highDensity' 的 'standard3' 服務,允許的值介於 1 到 3 之間。
|
properties.privateEndpointConnections
|
PrivateEndpointConnection[]
|
|
搜尋服務的私人端點連線清單。
|
properties.provisioningState
|
ProvisioningState
|
|
在搜尋服務上執行的最後一個布建作業狀態。 佈建是一種過渡狀態,當服務容量正在建立時發生。 設定容量之後,provisioningState 會變更為「成功」或「失敗」。 用戶端應用程式可以使用取得搜尋服務作業來查看作業完成的時間, (建議的輪詢間隔是從 30 秒到一分鐘) 輪詢狀態。 如果您使用免費服務,此值通常會直接在建立搜尋服務的呼叫中回復為「成功」。 這是因為免費服務使用早已設定的容量。
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
enabled
|
此值可以設定為 「已啟用」,以避免對現有的客戶資源和範本進行重大變更。 如果設定為 「已停用」,則不允許透過公用介面的流量,而且私人端點聯機會是獨佔存取方法。
|
properties.replicaCount
|
integer
|
1
|
搜尋服務中的複本數目。 如果指定,它必須是標準 SKU 介於 1 到 12 之間的值,或基本 SKU 的 1 到 3 內含值。
|
properties.semanticSearch
|
SearchSemanticSearch
|
|
設定控制語意搜尋可用性的選項。 此設定僅適用於特定位置中的特定搜尋 SKU。
|
properties.sharedPrivateLinkResources
|
SharedPrivateLinkResource[]
|
|
由搜尋服務管理的共用私人鏈接資源清單。
|
properties.status
|
SearchServiceStatus
|
|
搜尋服務的狀態。 可能的值包括:「執行中」:搜尋服務正在執行,且未進行任何布建作業。 「布建」:正在布建或相應增加或減少搜尋服務。 'delete':正在刪除搜尋服務。 「已降級」:搜尋服務已降級。 當基礎搜尋單位狀況不良時,就會發生這種情況。 搜尋服務最有可能運作,但效能可能會變慢,而且可能會捨棄某些要求。 'disabled':搜尋服務已停用。 在此狀態下,此服務將拒絕所有 API 要求。 'error':搜尋服務處於錯誤狀態。 如果您的服務處於降級、已停用或錯誤狀態,Microsoft 會主動調查基礎問題。 根據已佈建的搜尋單位數目,在這些狀態下的專用服務仍需收費。
|
properties.statusDetails
|
string
|
|
搜尋服務狀態的詳細數據。
|
sku
|
Sku
|
|
搜尋服務的 SKU,決定計費率和容量限制。 建立新的搜尋服務時,需要這個屬性。
|
tags
|
object
|
|
資源標籤。
|
type
|
string
|
|
資源類型。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”
|
SearchServiceStatus
搜尋服務的狀態。 可能的值包括:「執行中」:搜尋服務正在執行,且未進行任何布建作業。 「布建」:正在布建或相應增加或減少搜尋服務。 'delete':正在刪除搜尋服務。 「已降級」:搜尋服務已降級。 當基礎搜尋單位狀況不良時,就會發生這種情況。 搜尋服務最有可能運作,但效能可能會變慢,而且可能會捨棄某些要求。 'disabled':搜尋服務已停用。 在此狀態下,此服務將拒絕所有 API 要求。 'error':搜尋服務處於錯誤狀態。 如果您的服務處於降級、已停用或錯誤狀態,Microsoft 會主動調查基礎問題。 根據已佈建的搜尋單位數目,在這些狀態下的專用服務仍需收費。
名稱 |
類型 |
Description |
degraded
|
string
|
搜尋服務已降級,因為基礎搜尋單位狀況不良。
|
deleting
|
string
|
正在刪除搜尋服務。
|
disabled
|
string
|
搜尋服務已停用,且所有 API 要求都會遭到拒絕。
|
error
|
string
|
搜尋服務處於錯誤狀態,表示無法布建或刪除。
|
provisioning
|
string
|
正在布建或相應增加或減少搜尋服務。
|
running
|
string
|
搜尋服務正在執行,且未進行任何布建作業。
|
SearchServiceUpdate
用來更新搜尋服務的參數。
名稱 |
類型 |
預設值 |
Description |
id
|
string
|
|
資源的完整資源識別碼。 例如 - /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
|
1
|
搜尋服務中的數據分割數目;如果指定,它可以是 1、2、3、4、6 或 12。 大於 1 的值僅適用於標準 SKU。 對於 hostingMode 設定為 'highDensity' 的 'standard3' 服務,允許的值介於 1 到 3 之間。
|
properties.privateEndpointConnections
|
PrivateEndpointConnection[]
|
|
搜尋服務的私人端點連線清單。
|
properties.provisioningState
|
ProvisioningState
|
|
在搜尋服務上執行的最後一個布建作業狀態。 佈建是一種過渡狀態,當服務容量正在建立時發生。 設定容量之後,provisioningState 會變更為「成功」或「失敗」。 用戶端應用程式可以使用取得搜尋服務作業來查看作業完成的時間, (建議的輪詢間隔是從 30 秒到一分鐘) 輪詢狀態。 如果您使用免費服務,此值通常會直接在建立搜尋服務的呼叫中回復為「成功」。 這是因為免費服務使用早已設定的容量。
|
properties.publicNetworkAccess
|
PublicNetworkAccess
|
enabled
|
此值可以設定為 「已啟用」,以避免對現有的客戶資源和範本進行重大變更。 如果設定為 「已停用」,則不允許透過公用介面的流量,而且私人端點聯機會是獨佔存取方法。
|
properties.replicaCount
|
integer
|
1
|
搜尋服務中的複本數目。 如果指定,它必須是標準 SKU 介於 1 到 12 之間的值,或基本 SKU 的 1 到 3 內含值。
|
properties.semanticSearch
|
SearchSemanticSearch
|
|
設定控制語意搜尋可用性的選項。 此設定僅適用於特定位置中的特定搜尋 SKU。
|
properties.sharedPrivateLinkResources
|
SharedPrivateLinkResource[]
|
|
由搜尋服務管理的共用私人鏈接資源清單。
|
properties.status
|
SearchServiceStatus
|
|
搜尋服務的狀態。 可能的值包括:「執行中」:搜尋服務正在執行,且未進行任何布建作業。 「布建」:正在布建或相應增加或減少搜尋服務。 'delete':正在刪除搜尋服務。 「已降級」:搜尋服務已降級。 當基礎搜尋單位狀況不良時,就會發生這種情況。 搜尋服務最有可能運作,但效能可能會變慢,而且可能會捨棄某些要求。 'disabled':搜尋服務已停用。 在此狀態下,此服務將拒絕所有 API 要求。 'error':搜尋服務處於錯誤狀態。 如果您的服務處於降級、已停用或錯誤狀態,Microsoft 會主動調查基礎問題。 根據已佈建的搜尋單位數目,在這些狀態下的專用服務仍需收費。
|
properties.statusDetails
|
string
|
|
搜尋服務狀態的詳細數據。
|
sku
|
Sku
|
|
搜尋服務的 SKU,決定計費率和容量限制。 建立新的搜尋服務時,需要這個屬性。
|
tags
|
object
|
|
標籤,協助分類 Azure 入口網站中的資源。
|
type
|
string
|
|
資源類型。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”
|
SharedPrivateLinkResource
描述由搜尋服務管理的共用 Private Link 資源。
名稱 |
類型 |
Description |
id
|
string
|
資源的完整資源識別碼。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
資源的名稱
|
properties
|
SharedPrivateLinkResourceProperties
|
描述由搜尋服務管理的共用 Private Link 資源屬性。
|
type
|
string
|
資源類型。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”
|
SharedPrivateLinkResourceProperties
描述由搜尋服務管理之現有共用 Private Link 資源的屬性。
名稱 |
類型 |
Description |
groupId
|
string
|
共用私人鏈接資源提供者的群組標識碼。
|
privateLinkResourceId
|
string
|
共用私人鏈接資源的資源資源識別碼。
|
provisioningState
|
SharedPrivateLinkResourceProvisioningState
|
共用私人鏈接資源的布建狀態。 有效值為 [更新]、[刪除]、[失敗]、[成功] 或 [不完整]。
|
requestMessage
|
string
|
要求核准共用私人鏈接資源的要求訊息。
|
resourceRegion
|
string
|
選擇性。 可用來指定要建立共用私人連結之資源的 Azure Resource Manager 位置。 只有 DNS 設定為區域 (的資源,例如 Azure Kubernetes Service) ,才需要此專案。
|
status
|
SharedPrivateLinkResourceStatus
|
共用私人鏈接資源的狀態。 有效值為 Pending、Approved、Rejected 或 Disconnected。
|
SharedPrivateLinkResourceProvisioningState
共用私人鏈接資源的布建狀態。 有效值為 [更新]、[刪除]、[失敗]、[成功] 或 [不完整]。
名稱 |
類型 |
Description |
Deleting
|
string
|
|
Failed
|
string
|
|
Incomplete
|
string
|
|
Succeeded
|
string
|
|
Updating
|
string
|
|
SharedPrivateLinkResourceStatus
共用私人鏈接資源的狀態。 有效值為 Pending、Approved、Rejected 或 Disconnected。
名稱 |
類型 |
Description |
Approved
|
string
|
|
Disconnected
|
string
|
|
Pending
|
string
|
|
Rejected
|
string
|
|
Sku
定義搜尋服務的 SKU,以決定計費率和容量限制。
名稱 |
類型 |
Description |
name
|
SkuName
|
搜尋服務的 SKU。 有效值包括:『free』:共用服務。 'basic':最多 3 個複本的專用服務。 'standard':最多 12 個分割區和 12 個復本的專用服務。 'standard2':類似於標準,但每個搜尋單位具有更多容量。 'standard3':如果您也將 hostingMode 屬性設定為 'highDensity') ,則最多 12 個分割區和 12 個復本 (或最多 3 個分割區的標準供應專案。 'storage_optimized_l1':支援每個分割區 1TB,最多可支援 12 個分割區。 'storage_optimized_l2':支援每個分割區 2TB,最多 12 個分割區。」
|
SkuName
搜尋服務的 SKU。 有效值包括:『free』:共用服務。 'basic':最多 3 個複本的專用服務。 'standard':最多 12 個分割區和 12 個復本的專用服務。 'standard2':類似於標準,但每個搜尋單位具有更多容量。 'standard3':如果您也將 hostingMode 屬性設定為 'highDensity') ,則最多 12 個分割區和 12 個復本 (或最多 3 個分割區的標準供應專案。 'storage_optimized_l1':支援每個分割區 1TB,最多可支援 12 個分割區。 'storage_optimized_l2':支援每個分割區 2TB,最多 12 個分割區。」
名稱 |
類型 |
Description |
basic
|
string
|
專用服務的可計費層最多可有3個複本。
|
free
|
string
|
免費層,沒有 SLA 保證,以及可計費層上提供的功能子集。
|
standard
|
string
|
專用服務的計費層最多可有12個分割區和12個複本。
|
standard2
|
string
|
類似於 『standard』,但每個搜尋單位的容量更多。
|
standard3
|
string
|
如果您也將 hostingMode 屬性設定為 『highDensity』) ,則具有最多 12 個分割區和 12 個復本的最大標準供應專案 (或最多 3 個具有更多索引的分割區。
|
storage_optimized_l1
|
string
|
專用服務的計費層支援每個分割區 1TB,最多 12 個分割區。
|
storage_optimized_l2
|
string
|
專用服務的計費層支援每個分割區 2TB,最多 12 個分割區。
|