Skip to main content

query_keys

Creates, updates, deletes, gets or lists a query_keys resource.

Overview

Namequery_keys
TypeResource
Idazure.search.query_keys

Fields

The following fields are returned by SELECT queries:

All query keys for the given search service were successfully retrieved and are in the response. You can use any of the query keys as the value of the 'api-key' parameter in the Azure AI Search Service REST API or SDK to perform read-only operations on your Search indexes such as querying and looking up documents by ID.

NameDatatypeDescription
namestringThe name of the query API key. Query names are optional, but assigning a name can help you remember how it's used.
keystringThe value of the query API key.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_by_search_serviceselectresourceGroupName, searchServiceName, subscriptionIdx-ms-client-request-idReturns the list of query API keys for the given Azure AI Search service.
createinsertresourceGroupName, searchServiceName, name, subscriptionIdx-ms-client-request-idGenerates a new query key for the specified search service. You can create up to 50 query keys per service.
deletedeleteresourceGroupName, searchServiceName, key, subscriptionIdx-ms-client-request-idDeletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
keystringThe query key to be deleted. Query keys are identified by value, not by name.
namestringThe name of the new query API key.
resourceGroupNamestringThe name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
searchServiceNamestringThe name of the Azure AI Search service associated with the specified resource group.
subscriptionIdstringThe unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API or the portal.
x-ms-client-request-idstring (uuid)A client-generated GUID value that identifies this request. If specified, this will be included in response information as a way to track the request.

SELECT examples

Returns the list of query API keys for the given Azure AI Search service.

SELECT
name,
key
FROM azure.search.query_keys
WHERE resourceGroupName = '{{ resourceGroupName }}' -- required
AND searchServiceName = '{{ searchServiceName }}' -- required
AND subscriptionId = '{{ subscriptionId }}' -- required
AND x-ms-client-request-id = '{{ x-ms-client-request-id }}'
;

INSERT examples

Generates a new query key for the specified search service. You can create up to 50 query keys per service.

INSERT INTO azure.search.query_keys (
resourceGroupName,
searchServiceName,
name,
subscriptionId,
x-ms-client-request-id
)
SELECT
'{{ resourceGroupName }}',
'{{ searchServiceName }}',
'{{ name }}',
'{{ subscriptionId }}',
'{{ x-ms-client-request-id }}'
RETURNING
name,
key
;

DELETE examples

Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it.

DELETE FROM azure.search.query_keys
WHERE resourceGroupName = '{{ resourceGroupName }}' --required
AND searchServiceName = '{{ searchServiceName }}' --required
AND key = '{{ key }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
AND x-ms-client-request-id = '{{ x-ms-client-request-id }}'
;