在指定的資源群組中建立或更新搜尋服務。 如果搜尋服務已經存在,則會使用指定的值來更新所有屬性。
PUT 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
|
要建立或更新之搜尋服務的名稱。 搜尋服務 名稱只能包含小寫字母、數位或破折號,不能使用虛線作為前兩個字元或最後一個字元、不能包含連續的破折號,且長度必須介於 2 到 60 個字元之間。 搜尋服務 名稱必須是全域唯一的,因為它們是服務 URI (https://.search.windows.net). 建立服務之後,您無法變更服務名稱。
|
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 |
location
|
True
|
string
|
資源所在的地理位置
|
identity
|
|
Identity
|
資源的身分識別。
|
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
|
此值可以設定為 「已啟用」,以避免現有客戶資源和範本的重大變更。 如果設定為 『disabled』,則不允許透過公用介面的流量,而私人端點聯機會是獨佔存取方法。
|
properties.replicaCount
|
|
integer
|
搜尋服務中的複本數目。 如果指定,它必須是標準 SKU 介於 1 到 12 之間的值,或基本 SKU 包含 1 到 3 之間的值。
|
properties.semanticSearch
|
|
SearchSemanticSearch
|
設定控制語意搜尋可用性的選項。 此設定僅適用於特定位置中的特定搜尋 SKU。
|
sku
|
|
Sku
|
搜尋服務的 SKU,決定計費率和容量限制。 建立新的搜尋服務時,需要這個屬性。
|
tags
|
|
object
|
資源標籤。
|
回應
名稱 |
類型 |
Description |
200 OK
|
SearchService
|
已成功更新現有的服務定義。 如果您變更復本或分割區的數目,調整作業將會以異步方式進行。 您可以定期取得服務定義,並透過 provisioningState 屬性監視進度。
|
201 Created
|
SearchService
|
如果您要求建立免費搜尋服務,服務現在已布建且可供使用,但受限於 DNS 傳播延遲。 針對其他 SKU 類型,布建會以異步方式進行。 您可以定期取得服務定義,並透過 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
|
模擬您的用戶帳戶
|
範例
SearchCreateOrUpdateService
範例要求
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateService.
* json
*/
/**
* Sample code: SearchCreateOrUpdateService.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCreateOrUpdateService(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(3).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {"hostingMode": "default", "partitionCount": 1, "replicaCount": 3},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateService.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateService.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateService() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](3),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateService.json
*/
async function searchCreateOrUpdateService() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
hostingMode: "default",
location: "westus",
partitionCount: 1,
replicaCount: 3,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateService.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
}
}
SearchCreateOrUpdateServiceAuthOptions
範例要求
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"authOptions": {
"aadOrApiKey": {
"aadAuthFailureMode": "http401WithBearerChallenge"
}
}
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.AadAuthFailureMode;
import com.azure.resourcemanager.search.models.DataPlaneAadOrApiKeyAuthOption;
import com.azure.resourcemanager.search.models.DataPlaneAuthOptions;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateServiceAuthOptions.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceAuthOptions.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCreateOrUpdateServiceAuthOptions(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(3).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT)
.withAuthOptions(new DataPlaneAuthOptions().withAadOrApiKey(new DataPlaneAadOrApiKeyAuthOption()
.withAadAuthFailureMode(AadAuthFailureMode.HTTP401WITH_BEARER_CHALLENGE))),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service_auth_options.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {
"authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "http401WithBearerChallenge"}},
"hostingMode": "default",
"partitionCount": 1,
"replicaCount": 3,
},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceAuthOptions.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceAuthOptions.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceAuthOptions() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
AuthOptions: &armsearch.DataPlaneAuthOptions{
AADOrAPIKey: &armsearch.DataPlaneAADOrAPIKeyAuthOption{
AADAuthFailureMode: to.Ptr(armsearch.AADAuthFailureModeHttp401WithBearerChallenge),
},
},
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](3),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// AuthOptions: &armsearch.DataPlaneAuthOptions{
// AADOrAPIKey: &armsearch.DataPlaneAADOrAPIKeyAuthOption{
// AADAuthFailureMode: to.Ptr(armsearch.AADAuthFailureModeHttp401WithBearerChallenge),
// },
// },
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceAuthOptions.json
*/
async function searchCreateOrUpdateServiceAuthOptions() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
authOptions: {
aadOrApiKey: { aadAuthFailureMode: "http401WithBearerChallenge" },
},
hostingMode: "default",
location: "westus",
partitionCount: 1,
replicaCount: 3,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceAuthOptions.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
AuthOptions = new SearchAadAuthDataPlaneAuthOptions()
{
AadAuthFailureMode = SearchAadAuthFailureMode.Http401WithBearerChallenge,
},
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"authOptions": {
"aadOrApiKey": {
"aadAuthFailureMode": "http401WithBearerChallenge"
}
}
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"authOptions": {
"aadOrApiKey": {
"aadAuthFailureMode": "http401WithBearerChallenge"
}
}
}
}
SearchCreateOrUpdateServiceDisableLocalAuth
範例要求
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"disableLocalAuth": true
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateServiceDisableLocalAuth.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceDisableLocalAuth.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
searchCreateOrUpdateServiceDisableLocalAuth(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(3).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT).withDisableLocalAuth(true),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service_disable_local_auth.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {"disableLocalAuth": True, "hostingMode": "default", "partitionCount": 1, "replicaCount": 3},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceDisableLocalAuth() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
DisableLocalAuth: to.Ptr(true),
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](3),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// DisableLocalAuth: to.Ptr(true),
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json
*/
async function searchCreateOrUpdateServiceDisableLocalAuth() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
disableLocalAuth: true,
hostingMode: "default",
location: "westus",
partitionCount: 1,
replicaCount: 3,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
IsLocalAuthDisabled = true,
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"disableLocalAuth": true,
"authOptions": null
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"disableLocalAuth": true,
"authOptions": null
}
}
SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints
範例要求
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"publicNetworkAccess": "disabled",
"hostingMode": "default"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.PublicNetworkAccess;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(3).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT).withPublicNetworkAccess(PublicNetworkAccess.DISABLED),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service_to_allow_access_from_private_endpoints.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {
"hostingMode": "default",
"partitionCount": 1,
"publicNetworkAccess": "disabled",
"replicaCount": 3,
},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled),
ReplicaCount: to.Ptr[int32](3),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled),
// ReplicaCount: to.Ptr[int32](3),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json
*/
async function searchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
hostingMode: "default",
location: "westus",
partitionCount: 1,
publicNetworkAccess: "disabled",
replicaCount: 3,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
PublicNetworkAccess = SearchServicePublicNetworkAccess.Disabled,
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "disabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "disabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
}
}
SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs
範例要求
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 1,
"partitionCount": 1,
"networkRuleSet": {
"ipRules": [
{
"value": "123.4.5.6"
},
{
"value": "123.4.6.0/18"
}
]
},
"hostingMode": "default"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.IpRule;
import com.azure.resourcemanager.search.models.NetworkRuleSet;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs(
com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(1).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT)
.withNetworkRuleSet(new NetworkRuleSet().withIpRules(
Arrays.asList(new IpRule().withValue("123.4.5.6"), new IpRule().withValue("123.4.6.0/18")))),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service_to_allow_access_from_public_custom_ips.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {
"hostingMode": "default",
"networkRuleSet": {"ipRules": [{"value": "123.4.5.6"}, {"value": "123.4.6.0/18"}]},
"partitionCount": 1,
"replicaCount": 1,
},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
HostingMode: to.Ptr(armsearch.HostingModeDefault),
NetworkRuleSet: &armsearch.NetworkRuleSet{
IPRules: []*armsearch.IPRule{
{
Value: to.Ptr("123.4.5.6"),
},
{
Value: to.Ptr("123.4.6.0/18"),
}},
},
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](1),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// {
// Value: to.Ptr("123.4.5.6"),
// },
// {
// Value: to.Ptr("123.4.6.0/18"),
// }},
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](1),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json
*/
async function searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
hostingMode: "default",
location: "westus",
networkRuleSet: {
ipRules: [{ value: "123.4.5.6" }, { value: "123.4.6.0/18" }],
},
partitionCount: 1,
replicaCount: 1,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 1,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
IPRules =
{
new SearchServiceIPRule()
{
Value = "123.4.5.6",
},new SearchServiceIPRule()
{
Value = "123.4.6.0/18",
}
},
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 1,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [
{
"value": "123.4.5.6"
},
{
"value": "123.4.6.0/18"
}
]
},
"privateEndpointConnections": []
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 1,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": [
{
"value": "123.4.5.6"
},
{
"value": "123.4.6.0/18"
}
]
},
"privateEndpointConnections": []
}
}
SearchCreateOrUpdateServiceWithCmkEnforcement
範例要求
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"encryptionWithCmk": {
"enforcement": "Enabled"
}
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.EncryptionWithCmk;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.SearchEncryptionWithCmk;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateServiceWithCmkEnforcement.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceWithCmkEnforcement.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
searchCreateOrUpdateServiceWithCmkEnforcement(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(3).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT)
.withEncryptionWithCmk(new EncryptionWithCmk().withEnforcement(SearchEncryptionWithCmk.ENABLED)),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service_with_cmk_enforcement.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {
"encryptionWithCmk": {"enforcement": "Enabled"},
"hostingMode": "default",
"partitionCount": 1,
"replicaCount": 3,
},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceWithCmkEnforcement() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
EncryptionWithCmk: &armsearch.EncryptionWithCmk{
Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkEnabled),
},
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](3),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// AuthOptions: &armsearch.DataPlaneAuthOptions{
// APIKeyOnly: map[string]any{
// },
// },
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkEnabled),
// },
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// SharedPrivateLinkResources: []*armsearch.SharedPrivateLinkResource{
// },
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json
*/
async function searchCreateOrUpdateServiceWithCmkEnforcement() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
encryptionWithCmk: { enforcement: "Enabled" },
hostingMode: "default",
location: "westus",
partitionCount: 1,
replicaCount: 3,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
EncryptionWithCmk = new SearchEncryptionWithCmk()
{
Enforcement = SearchEncryptionWithCmkEnforcement.Enabled,
},
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Enabled",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
}
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Enabled",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
}
}
}
SearchCreateOrUpdateServiceWithIdentity
範例要求
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default"
},
"identity": {
"type": "SystemAssigned"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.Identity;
import com.azure.resourcemanager.search.models.IdentityType;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateServiceWithIdentity.json
*/
/**
* Sample code: SearchCreateOrUpdateServiceWithIdentity.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCreateOrUpdateServiceWithIdentity(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD))
.withIdentity(new Identity().withType(IdentityType.SYSTEM_ASSIGNED)).withReplicaCount(3)
.withPartitionCount(1).withHostingMode(HostingMode.DEFAULT),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_service_with_identity.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"identity": {"type": "SystemAssigned"},
"location": "westus",
"properties": {"hostingMode": "default", "partitionCount": 1, "replicaCount": 3},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithIdentity.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithIdentity.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceWithIdentity() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Identity: &armsearch.Identity{
Type: to.Ptr(armsearch.IdentityTypeSystemAssigned),
},
Properties: &armsearch.ServiceProperties{
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](3),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Identity: &armsearch.Identity{
// Type: to.Ptr(armsearch.IdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("9d1e1f18-2122-4988-a11c-878782e40a5c"),
// TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"),
// },
// Properties: &armsearch.ServiceProperties{
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithIdentity.json
*/
async function searchCreateOrUpdateServiceWithIdentity() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
hostingMode: "default",
identity: { type: "SystemAssigned" },
location: "westus",
partitionCount: 1,
replicaCount: 3,
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithIdentity.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
Identity = new ManagedServiceIdentity("SystemAssigned"),
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
},
"identity": {
"type": "SystemAssigned",
"principalId": "9d1e1f18-2122-4988-a11c-878782e40a5c",
"tenantId": "f686d426-8d16-42db-81b7-ab578e110ccd"
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": []
},
"identity": {
"type": "SystemAssigned",
"principalId": "9d1e1f18-2122-4988-a11c-878782e40a5c",
"tenantId": "f686d426-8d16-42db-81b7-ab578e110ccd"
}
}
SearchCreateOrUpdateWithSemanticSearch
範例要求
PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice?api-version=2023-11-01
{
"location": "westus",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"hostingMode": "default",
"semanticSearch": "free"
}
}
import com.azure.resourcemanager.search.fluent.models.SearchServiceInner;
import com.azure.resourcemanager.search.models.HostingMode;
import com.azure.resourcemanager.search.models.SearchSemanticSearch;
import com.azure.resourcemanager.search.models.Sku;
import com.azure.resourcemanager.search.models.SkuName;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Services CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/
* SearchCreateOrUpdateWithSemanticSearch.json
*/
/**
* Sample code: SearchCreateOrUpdateWithSemanticSearch.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void searchCreateOrUpdateWithSemanticSearch(com.azure.resourcemanager.AzureResourceManager azure) {
azure.searchServices().manager().serviceClient().getServices().createOrUpdate("rg1", "mysearchservice",
new SearchServiceInner().withLocation("westus").withTags(mapOf("app-name", "My e-commerce app"))
.withSku(new Sku().withName(SkuName.STANDARD)).withReplicaCount(3).withPartitionCount(1)
.withHostingMode(HostingMode.DEFAULT).withSemanticSearch(SearchSemanticSearch.FREE),
null, com.azure.core.util.Context.NONE);
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_create_or_update_with_semantic_search.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.services.begin_create_or_update(
resource_group_name="rg1",
search_service_name="mysearchservice",
service={
"location": "westus",
"properties": {"hostingMode": "default", "partitionCount": 1, "replicaCount": 3, "semanticSearch": "free"},
"sku": {"name": "standard"},
"tags": {"app-name": "My e-commerce app"},
},
).result()
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateWithSemanticSearch.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateWithSemanticSearch.json
func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateWithSemanticSearch() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{
Location: to.Ptr("westus"),
Tags: map[string]*string{
"app-name": to.Ptr("My e-commerce app"),
},
Properties: &armsearch.ServiceProperties{
HostingMode: to.Ptr(armsearch.HostingModeDefault),
PartitionCount: to.Ptr[int32](1),
ReplicaCount: to.Ptr[int32](3),
SemanticSearch: to.Ptr(armsearch.SearchSemanticSearchFree),
},
SKU: &armsearch.SKU{
Name: to.Ptr(armsearch.SKUNameStandard),
},
}, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Service = armsearch.Service{
// Name: to.Ptr("mysearchservice"),
// Type: to.Ptr("Microsoft.Search/searchServices"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"),
// Location: to.Ptr("westus"),
// Tags: map[string]*string{
// "app-name": to.Ptr("My e-commerce app"),
// },
// Properties: &armsearch.ServiceProperties{
// AuthOptions: &armsearch.DataPlaneAuthOptions{
// APIKeyOnly: map[string]any{
// },
// },
// DisableLocalAuth: to.Ptr(false),
// EncryptionWithCmk: &armsearch.EncryptionWithCmk{
// EncryptionComplianceStatus: to.Ptr(armsearch.SearchEncryptionComplianceStatusCompliant),
// Enforcement: to.Ptr(armsearch.SearchEncryptionWithCmkUnspecified),
// },
// HostingMode: to.Ptr(armsearch.HostingModeDefault),
// NetworkRuleSet: &armsearch.NetworkRuleSet{
// IPRules: []*armsearch.IPRule{
// },
// },
// PartitionCount: to.Ptr[int32](1),
// PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{
// },
// ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled),
// ReplicaCount: to.Ptr[int32](3),
// SemanticSearch: to.Ptr(armsearch.SearchSemanticSearchFree),
// SharedPrivateLinkResources: []*armsearch.SharedPrivateLinkResource{
// },
// Status: to.Ptr(armsearch.SearchServiceStatusProvisioning),
// StatusDetails: to.Ptr(""),
// },
// SKU: &armsearch.SKU{
// Name: to.Ptr(armsearch.SKUNameStandard),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
*
* @summary Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateWithSemanticSearch.json
*/
async function searchCreateOrUpdateWithSemanticSearch() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const service = {
hostingMode: "default",
location: "westus",
partitionCount: 1,
replicaCount: 3,
semanticSearch: "free",
sku: { name: "standard" },
tags: { appName: "My e-commerce app" },
};
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.services.beginCreateOrUpdateAndWait(
resourceGroupName,
searchServiceName,
service
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateWithSemanticSearch.json
// this example is just showing the usage of "Services_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SearchServiceResource
SearchServiceCollection collection = resourceGroupResource.GetSearchServices();
// invoke the operation
string searchServiceName = "mysearchservice";
SearchServiceData data = new SearchServiceData(new AzureLocation("westus"))
{
SkuName = SearchSkuName.Standard,
ReplicaCount = 3,
PartitionCount = 1,
HostingMode = SearchServiceHostingMode.Default,
SemanticSearch = SearchSemanticSearch.Free,
Tags =
{
["app-name"] = "My e-commerce app",
},
};
ArmOperation<SearchServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, searchServiceName, data);
SearchServiceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SearchServiceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"semanticSearch": "free"
}
}
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice",
"name": "mysearchservice",
"location": "westus",
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
},
"properties": {
"replicaCount": 3,
"partitionCount": 1,
"status": "provisioning",
"statusDetails": "",
"hostingMode": "default",
"provisioningState": "provisioning",
"publicNetworkAccess": "enabled",
"networkRuleSet": {
"ipRules": []
},
"privateEndpointConnections": [],
"sharedPrivateLinkResources": [],
"encryptionWithCmk": {
"enforcement": "Unspecified",
"encryptionComplianceStatus": "Compliant"
},
"disableLocalAuth": false,
"authOptions": {
"apiKeyOnly": {}
},
"semanticSearch": "free"
}
}
定義
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
|
資源的完整資源識別碼。 Ex - /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
此值可以設定為 「已啟用」,以避免現有客戶資源和範本的重大變更。 如果設定為 『disabled』,則不允許透過公用介面的流量,而私人端點聯機會是獨佔存取方法。
名稱 |
類型 |
Description |
disabled
|
string
|
|
enabled
|
string
|
|
SearchEncryptionComplianceStatus
描述搜尋服務是否符合具有非客戶加密資源的規範。 如果服務具有一個以上的非客戶加密資源,且「強制執行」為「已啟用」,則服務將會標示為「不符合規範」。
名稱 |
類型 |
Description |
Compliant
|
string
|
表示搜尋服務符合規範,可能是因為非客戶加密的資源數目為零,或停用強制執行。
|
NonCompliant
|
string
|
表示搜尋服務有多個非客戶加密的資源。
|
SearchEncryptionWithCmk
描述搜尋服務應如何強制執行一或多個非客戶加密的資源。
名稱 |
類型 |
Description |
Disabled
|
string
|
不會強制執行,而且搜尋服務可以有非客戶加密的資源。
|
Enabled
|
string
|
如果有一或多個非客戶加密的資源,搜尋服務 將會標示為不符合規範。
|
Unspecified
|
string
|
未明確指定強制執行原則,其行為與設定為 [已停用] 的行為相同。
|
SearchSemanticSearch
設定控制語意搜尋可用性的選項。 此設定僅適用於特定位置中的特定搜尋 SKU。
名稱 |
類型 |
Description |
disabled
|
string
|
表示搜尋服務已停用語意排名。
|
free
|
string
|
啟用搜尋服務上的語意排名,並指出它在免費層的限制內使用。 這會限制語意排名要求的數量,而且不需額外費用。 這是新布建的搜尋服務預設值。
|
standard
|
string
|
在搜尋服務上啟用語意排名作為可計費功能,並具有較高的輸送量和語意排名要求量。
|
SearchService
描述搜尋服務及其目前狀態。
名稱 |
類型 |
預設值 |
Description |
id
|
string
|
|
資源的完整資源識別碼。 Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
identity
|
Identity
|
|
資源的身分識別。
|
location
|
string
|
|
資源所在的地理位置
|
name
|
string
|
|
資源的名稱
|
properties.authOptions
|
DataPlaneAuthOptions
|
|
定義搜尋服務數據平面 API 如何驗證要求的選項。 如果 'disableLocalAuth' 設定為 true,則無法設定此設定。
|
properties.disableLocalAuth
|
boolean
|
|
設定為 true 時,不允許對搜尋服務的呼叫利用 API 金鑰進行驗證。 如果定義 『dataPlaneAuthOptions』,則無法將此設定為 true。
|
properties.encryptionWithCmk
|
EncryptionWithCmk
|
|
指定任何有關資源加密的原則 (,例如在搜尋服務中使用客戶管理員密鑰) 索引。
|
properties.hostingMode
|
HostingMode
|
default
|
僅適用於 standard3 SKU。 您可以設定此屬性來啟用最多 3 個高密度分割區,允許最多 1000 個索引,這比任何其他 SKU 允許的最大索引還要高。 針對 standard3 SKU,此值為 'default' 或 'highDensity'。 對於所有其他 SKU,此值必須是 'default'。
|
properties.networkRuleSet
|
NetworkRuleSet
|
|
決定如何連線到搜尋服務的網路特定規則。
|
properties.partitionCount
|
integer
|
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
|
此值可以設定為 「已啟用」,以避免現有客戶資源和範本的重大變更。 如果設定為 『disabled』,則不允許透過公用介面的流量,而私人端點聯機會是獨佔存取方法。
|
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
|
搜尋服務正在執行,且未進行任何布建作業。
|
SharedPrivateLinkResource
描述由搜尋服務管理的共用 Private Link 資源。
名稱 |
類型 |
Description |
id
|
string
|
資源的完整資源識別碼。 Ex - /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
|
類似於「標準」,但每個搜尋單位具有更多容量。
|
standard3
|
string
|
如果您也將 hostingMode 屬性設定為 『highDensity』) ,則具有最多 12 個分割區和 12 個復本的最大標準供應專案 (或最多 3 個數據分割。
|
storage_optimized_l1
|
string
|
每個分割區支援 1TB 的專用服務計費層,最多 12 個數據分割。
|
storage_optimized_l2
|
string
|
每個分割區支援 2TB 的專用服務計費層,最多 12 個數據分割。
|