Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure AI Search supports role-based access control through Microsoft Entra ID. Role-based access is optional but recommended. The alternative is key-based authentication, which is the default.
If you assign multiple roles to a security principal, permissions are combined. Role assignments apply across all tools and client libraries. You can assign roles using any supported approach.
This article explains how to assign built-in roles for service administration, development, and read-only query and retrieval access. It also provides steps for creating custom roles and testing role assignments.
Tip
- Want a quick overview of the built-in roles? See Summary of permissions.
- To control access to search results at the document level, also known as row-level security, see Document-level access control in Azure AI Search.
Prerequisites
An Azure AI Search service (any region and any tier) with role-based access enabled.
Permission to assign Azure roles. Any of the following roles work:
- Owner
- User Access Administrator
- Role Based Access Control Administrator
- A custom role with Microsoft.Authorization/roleAssignments/write permissions
Built-in roles
Roles are a collection of permissions that affect the control plane or data plane:
Control plane: Operations for service provisioning, configuration, and administration. Control plane operations include creating or deleting search services, listing API keys, and managing network and authentication settings. Available through the Azure Resource Manager REST APIs, Search Management REST APIs, and equivalent Azure SDK client libraries.
Data plane: Operations against the search service endpoint. Data plane operations fall into two categories: object management and content access. Available through the Search Service REST APIs and equivalent Azure SDK client libraries.
Role descriptions
The following built-in roles grant permissions to Azure AI Search. Control plane roles are always available, while data plane roles require role-based access to be enabled on your search service. You can combine built-in roles for broader access or create a custom role with the specific permissions you need.
| Role | Plane | Description |
|---|---|---|
| Owner | Control |
|
| Contributor | Control |
|
| Reader | Control |
|
| Search Service Contributor | Control & Data |
|
| Search Index Data Contributor | Data |
|
| Search Index Data Reader | Data |
|
Important
- Owner, Contributor, and Search Service Contributor can retrieve admin keys, which provide full read-write access to the data plane. Only grant these roles to trusted users.
- By default, data plane roles apply to all indexes on the search service. To scope Search Index Data Contributor or Search Index Data Reader to a single index, see Grant access to a single index.
Summary of permissions
Use the following table to quickly find which role provides the permissions you need.
| Permissions | Owner/Contributor | Reader | Search Service Contributor | Search Index Data Contributor | Search Index Data Reader |
|---|---|---|---|---|---|
| Create and configure Azure AI Search services | ✅ | ❌ | ✅ | ❌ | ❌ |
| Access service in the Azure portal | ✅ | ✅ | ✅ | ❌ | ❌ |
| View service properties, metrics, and endpoint | ✅ | ✅ | ✅ | ❌ | ❌ |
| List all objects on the service | ✅ | ✅ | ✅ | ❌ | ❌ |
| Access quotas and service statistics | ✅ | ❌ | ✅ | ❌ | ❌ |
| View, copy, and regenerate keys | ✅ | ❌ | ✅ | ❌ | ❌ |
| Set authentication options | ✅ | ❌ | ✅ | ❌ | ❌ |
| View roles, policies, and definitions | ✅ | ✅ | ✅ | ❌ | ❌ |
| Configure network security and private connections | ✅ | ❌ | ✅ | ❌ | ❌ |
| Create, run, and manage search objects 1 | ❌ | ❌ | ✅ | ❌ | ❌ |
| Upload data for indexing 2 | ❌ | ❌ | ❌ | ✅ | ❌ |
| Query an index | ❌ | ❌ | ❌ | ✅ | ✅ |
| Retrieve from a knowledge base | ❌ | ❌ | ❌ | ✅ | ✅ |
| Bypass permission filters with elevated read | ❌ | ❌ | ❌ | ✅ | ❌ |
1 Includes indexes, indexers, data sources, skillsets, aliases, synonym maps, debug sessions, knowledge bases, and knowledge sources. Indexers also support run and reset operations.
2 An Owner or Contributor can run the Import data wizard to create and load indexes, even though they can't upload documents in other clients. Similarly, indexers can write to any index on the search service, regardless of per-index role assignments. In both cases, the search service (not the user) performs the data plane actions using its Microsoft.Search/searchServices/indexes/documents/* permissions.
Assign built-in roles
In this section, you assign roles for:
Assign roles for service administration
The following roles let you create, configure, and manage a search service. These roles are hierarchical, so select one based on the access level you need.
| Role | ID |
|---|---|
| Owner | 8e3af657-a8ff-443c-a75c-2fe8c4bcb635 |
| Contributor | b24988ac-6180-42a0-ab88-20f7382dd24c |
| Reader | acdd72a7-3385-48ef-bd42-f606fba81ae7 |
Go to your search service in the Azure portal.
From the left pane, select Access control (IAM).
Select + Add > Add role assignment.
Select a role: Owner, Contributor, or Reader.
On the Members tab, select the Microsoft Entra user or group identity. If you're setting up permissions for another Azure service, select a system-assigned or user-assigned managed identity.
On the Review + assign tab, select Review + assign to assign the role.
Assign roles for development
The following roles let you create search objects, load documents, query indexes, and retrieve from knowledge bases. Assign all three roles to cover the full range of development tasks.
| Role | ID |
|---|---|
| Search Service Contributor | 7ca78c08-252a-4471-8644-bb5ff32d4ba0 |
| Search Index Data Contributor | 8ebe5a00-799e-43f5-93ac-243d3dce84a7 |
| Search Index Data Reader | 1407120a-92aa-4202-b7e9-c0e197c71c8f |
Go to your search service in the Azure portal.
From the left pane, select Access control (IAM).
Select + Add > Add role assignment.
Select Search Service Contributor.
On the Members tab, select the Microsoft Entra user or group identity. If you're setting up permissions for another Azure service, select a system-assigned or user-assigned managed identity.
On the Review + assign tab, select Review + assign to assign the role.
Repeat these steps to assign Search Index Data Contributor and Search Index Data Reader.
Assign roles for read-only access
Use the following role for apps and processes that only need read access to indexes and knowledge bases. Supported operations include search, lookup, autocomplete, and suggestions for indexes and retrieve for knowledge bases.
| Role | ID |
|---|---|
| Search Index Data Reader | 1407120a-92aa-4202-b7e9-c0e197c71c8f |
Go to your search service in the Azure portal.
From the left pane, select Access control (IAM).
Select + Add > Add role assignment.
Select the Search Index Data Reader role.
On the Members tab, select the Microsoft Entra user or group identity. If you're setting up permissions for another Azure service, select a system-assigned or user-assigned managed identity.
On the Review + assign tab, select Review + assign to assign the role.
Test role assignments
Use a client to test role assignments. Remember that roles are cumulative. You can't delete or deny inherited roles that are scoped to the subscription or resource group level at the resource (search service) level.
Before you proceed, configure your application for keyless connections and have role assignments in place.
Go to your search service in the Azure portal.
From the left pane, select Search management > Indexes to test index-related permissions:
Search Service Contributors can create, modify, and delete search objects but can't load documents or run queries. To verify permissions, create a search index.
Search Index Data Contributors can load documents. There's no load documents option in the Azure portal outside of the Import data wizard, but you can reset and run an indexer to confirm document load permissions.
Search Index Data Readers can query indexes. To verify permissions, use Search explorer. You should be able to send queries and view results, but you shouldn't be able to view index definitions or create indexes.
Grant access to a single index
In some scenarios, you might want to limit an application's access to a single resource, such as an index.
The Azure portal doesn't currently support role assignments at this level of granularity, but you can assign roles using PowerShell or the Azure CLI.
In PowerShell, use New-AzRoleAssignment, providing the Azure user or group name and the scope of the assignment.
Load the
AzureandAzureADmodules and connect to your Azure account:Import-Module -Name Az Import-Module -Name AzureAD Connect-AzAccountAdd a role assignment scoped to an individual index:
New-AzRoleAssignment -ObjectId <objectId> ` -RoleDefinitionName "Search Index Data Contributor" ` -Scope "/subscriptions/<subscription>/resourceGroups/<resource-group>/providers/Microsoft.Search/searchServices/<search-service>/indexes/<index-name>"Reference: New-AzRoleAssignment
Per-index scope and indexer operations
Per-index role assignments apply to direct API operations only, such as queries or document uploads from users or applications. Indexers aren't restricted by per-index permissions because they operate with service-level credentials.
A user with the Search Service Contributor role can create indexers that write to any index on the search service, even indexes where that user has no per-index role assignment.
For strict data isolation between indexes, consider these approaches:
- Use separate search services for teams or users who require index-level isolation.
- Assign Search Service Contributor only to administrators who manage indexers.
- Use document-level access control with security filters to restrict query results within a shared index.
Create a custom role
If built-in roles don't provide the right combination of permissions, you can create a custom role to support the operations you require.
The following examples clone Search Index Data Reader and then add the ability to list indexes by name. Normally, listing the indexes on a search service is considered an administrative right.
Sign in to the Azure portal and navigate to your search service.
From the left pane, select Access control (IAM).
On the Roles tab, find Search Index Data Reader or another role, select the ellipsis (...), and then select Clone.
On the Basics tab, enter a name for the custom role, such as "Search Index Data Explorer", and then select Next.
On the Permissions tab, select Add permissions.
In the Add permissions pane, select the Microsoft Search tile.
With Actions selected at the top, set the following permissions:
- Under
Microsoft.Search/operations, select Read : List all available operations. - Under
Microsoft.Search/searchServices/indexes, select Read : Read Index.
- Under
Switch to Data Actions at the top, and under
Microsoft.Search/searchServices/indexes/documents, select Read : Read Documents.The JSON definition looks like the following example:
{ "properties": { "roleName": "search index data explorer", "description": "", "assignableScopes": [ "/subscriptions/0000000000000000000000000000000/resourceGroups/free-search-svc/providers/Microsoft.Search/searchServices/demo-search-svc" ], "permissions": [ { "actions": [ "Microsoft.Search/operations/read", "Microsoft.Search/searchServices/indexes/read" ], "notActions": [], "dataActions": [ "Microsoft.Search/searchServices/indexes/documents/read" ], "notDataActions": [] } ] } }Select Add to close the pane.
Select Review + create to create the role.
You can now assign users and groups to the role. For more information about these steps, see Create or update Azure custom roles using the Azure portal.
Create a Conditional Access policy
If you need to enforce organizational policies, such as multifactor authentication, use Microsoft Entra Conditional Access.
To create a Conditional Access policy for Azure AI Search:
Sign in to the Azure portal.
Search for Microsoft Entra Conditional Access.
On the Overview page, select Create new policy.
Under Cloud apps or actions, add Azure AI Search as a cloud app, depending on how you want to set up your policy.
Update the remaining parameters of your policy. For example, specify which users and groups to which the policy applies.
Save the policy.
Important
If your search service has a managed identity assigned to it, the specific search service appears as a cloud app. However, selecting that specific search service doesn't enforce the policy. Instead, select the general Azure AI Search cloud app to apply Conditional Access policies to your search service.
Troubleshooting
When you develop applications that use role-based access control for authentication, you might encounter some common problems:
The default configuration for a search service is key-based authentication. If you don't change this setting to Both or Role-based access control, all requests that use role-based authentication are automatically denied, regardless of the underlying permissions.
If your request includes an API key alongside role-based credentials, the service authenticates using the key. Remove the API key from your request headers to use role-based authentication.
If the authorization token comes from a managed identity and you recently assigned the appropriate permissions, it might take several hours for the permissions assignments to take effect.
If queries with document-level permissions don't return expected results, use Search Index Data Contributor or create a custom role with elevated permissions to investigate.
Next step
This article explains how to assign roles for control and data plane operations on Azure AI Search. For comprehensive instructions on adding role-based access to your application code: