기본 또는 보조 관리자 API 키를 다시 생성합니다. 한번에 하나의 키만 다시 생성할 수 있습니다.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}?api-version=2024-03-01-preview
URI 매개 변수
Name |
In(다음 안에) |
필수 |
형식 |
Description |
keyKind
|
path |
True
|
AdminKeyKind
|
다시 생성할 키를 지정합니다. 유효한 값에는 'primary' 및 'secondary'가 포함됩니다.
|
resourceGroupName
|
path |
True
|
string
|
현재 구독 내의 리소스 그룹 이름입니다. Azure 리소스 관리자 API 또는 포털에서 이 값을 가져올 수 있습니다.
|
searchServiceName
|
path |
True
|
string
|
지정된 리소스 그룹과 연결된 Azure AI Search Service 이름입니다.
regex 패턴: ^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$
|
subscriptionId
|
path |
True
|
string
|
Microsoft Azure 구독의 고유 식별자입니다. Azure 리소스 관리자 API 또는 포털에서 이 값을 가져올 수 있습니다.
|
api-version
|
query |
True
|
string
|
각 요청에 사용할 API 버전입니다.
|
Name |
필수 |
형식 |
Description |
x-ms-client-request-id
|
|
string
uuid
|
이 요청을 식별하는 클라이언트에서 생성한 GUID 값입니다. 지정된 경우 요청을 추적하는 방법으로 응답 정보에 포함됩니다.
|
응답
Name |
형식 |
Description |
200 OK
|
AdminKeyResult
|
지정된 관리 키가 성공적으로 다시 생성되었습니다. 새로 생성된 키를 포함하여 두 관리자 키가 모두 응답에 포함됩니다.
|
Other Status Codes
|
CloudError
|
HTTP 404(찾을 수 없음): 구독, 리소스 그룹 또는 검색 서비스를 찾을 수 없습니다. HTTP 409(충돌): 지정된 구독을 사용할 수 없습니다.
|
보안
azure_auth
Microsoft ID 플랫폼에서 지원되는 암시적 허용 흐름을 지정합니다.
형식:
oauth2
Flow:
implicit
권한 부여 URL:
https://login.microsoftonline.com/common/oauth2/authorize
범위
Name |
Description |
user_impersonation
|
사용자 계정 가장
|
예제
SearchRegenerateAdminKey
샘플 요청
POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/regenerateAdminKey/primary?api-version=2024-03-01-preview
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python search_regenerate_admin_key.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.admin_keys.regenerate(
resource_group_name="rg1",
search_service_name="mysearchservice",
key_kind="primary",
)
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-03-01-preview/examples/SearchRegenerateAdminKey.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/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/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/search/resource-manager/Microsoft.Search/preview/2024-03-01-preview/examples/SearchRegenerateAdminKey.json
func ExampleAdminKeysClient_Regenerate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAdminKeysClient().Regenerate(ctx, "rg1", "mysearchservice", armsearch.AdminKeyKindPrimary, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.AdminKeyResult = armsearch.AdminKeyResult{
// PrimaryKey: to.Ptr("<your primary admin API key>"),
// SecondaryKey: to.Ptr("<your secondary admin API key>"),
// }
}
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 Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time.
*
* @summary Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-03-01-preview/examples/SearchRegenerateAdminKey.json
*/
async function searchRegenerateAdminKey() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["SEARCH_RESOURCE_GROUP"] || "rg1";
const searchServiceName = "mysearchservice";
const keyKind = "primary";
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.adminKeys.regenerate(resourceGroupName, searchServiceName, keyKind);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search.Models;
using Azure.ResourceManager.Search;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/preview/2024-03-01-preview/examples/SearchRegenerateAdminKey.json
// this example is just showing the usage of "AdminKeys_Regenerate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SearchServiceResource created on azure
// for more information of creating SearchServiceResource, please refer to the document of SearchServiceResource
string subscriptionId = "subid";
string resourceGroupName = "rg1";
string searchServiceName = "mysearchservice";
ResourceIdentifier searchServiceResourceId = SearchServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, searchServiceName);
SearchServiceResource searchService = client.GetSearchServiceResource(searchServiceResourceId);
// invoke the operation
SearchServiceAdminKeyKind keyKind = SearchServiceAdminKeyKind.Primary;
SearchServiceAdminKeyResult result = await searchService.RegenerateAdminKeyAsync(keyKind);
Console.WriteLine($"Succeeded: {result}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
샘플 응답
{
"primaryKey": "<your primary admin API key>",
"secondaryKey": "<your secondary admin API key>"
}
정의
AdminKeyKind
다시 생성할 키를 지정합니다. 유효한 값에는 'primary' 및 'secondary'가 포함됩니다.
Name |
형식 |
Description |
primary
|
string
|
검색 서비스의 기본 API 키입니다.
|
secondary
|
string
|
검색 서비스에 대한 보조 API 키입니다.
|
AdminKeyResult
지정된 Azure AI Search Service 대한 기본 및 보조 관리자 API 키가 포함된 응답입니다.
Name |
형식 |
Description |
primaryKey
|
string
|
검색 서비스의 기본 관리자 API 키입니다.
|
secondaryKey
|
string
|
검색 서비스의 보조 관리자 API 키입니다.
|
CloudError
API 오류에 대한 정보를 포함합니다.
Name |
형식 |
Description |
error
|
CloudErrorBody
|
오류 코드와 메시지가 있는 특정 API 오류를 설명합니다.
|
message
|
string
|
무엇이 잘못되었는지를 암시하는 오류에 대한 간략한 설명입니다(세부 정보/디버깅 정보는 'error.message' 속성을 참조).
|
CloudErrorBody
오류 코드와 메시지가 있는 특정 API 오류를 설명합니다.
Name |
형식 |
Description |
code
|
string
|
HTTP 상태 코드보다 오류 조건을 보다 정확하게 설명하는 오류 코드입니다. 프로그래밍 방식으로 특정 오류 사례를 처리하는 데 사용할 수 있습니다.
|
details
|
CloudErrorBody[]
|
이 오류와 관련된 중첩된 오류를 포함합니다.
|
message
|
string
|
오류를 자세히 설명하고 디버깅 정보를 제공하는 메시지입니다.
|
target
|
string
|
특정 오류의 대상입니다(예: 오류에 있는 속성의 이름).
|