SearchCredentials(String) Constructor


Initializes a new instance of the SearchCredentials class with a query key or an admin key. Use a query key if your application does not require write access to the Search Service or index.

public SearchCredentials (string apiKey);
new Microsoft.Azure.Search.SearchCredentials : string -> Microsoft.Azure.Search.SearchCredentials
Public Sub New (apiKey As String)



api-key used to authenticate to the search service.


If your application performs only query operations on an index, we recommend passing a query key for the apiKey parameter. This ensures that you have read-only access to the index, which is consistent with the principle of least privilege.

Applies to