Join our Newsletter — 33% off our NHI Course
Home› Guides› Azure AI Search for RAG Security Guide: Document-Level…
Guide AI Platforms

Azure AI Search for RAG Security Guide: Document-Level Security, Managed Identity and Private Endpoints

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 18 November 2026 17 min read
On this page

Most retrieval-augmented generation (RAG) builds on Azure put their chunks, vectors and permission metadata in Azure AI Search, and the index will return any matching chunk to any caller unless you make it check who is asking. This guide covers the customer-side settings that decide whether an Azure AI Search index behind a copilot or agent leaks data: document-level security (security filters and the native ACL, RBAC scope, SharePoint and Purview label options), Microsoft Entra role-based access in place of API keys, managed identities for indexers and vectorisers, private endpoints and shared private links, encryption, and logging. The general patterns are in the Permission-Aware RAG Guide; this page covers how Azure AI Search implements them. It is written for Azure architects, platform engineers and security reviewers signing off a RAG design.

This is an independent guide from NHI Mgmt Group, based on Microsoft's public documentation for Azure AI Search as of November 2026. It is not sponsored or reviewed by Microsoft. Product features change, so confirm settings against Microsoft's current documentation.

Key takeaways

  • Trimming is your job unless you turn it on. Microsoft lists document-level permissions as a customer responsibility; with a plain index, every caller with read access sees every chunk.
  • Security filters are strings, not authorisation. Microsoft states that "the principal is just a string", so your application must resolve the caller's groups from a verified token and apply the filter on every query.
  • Native ACL trimming is preview and fails closed. With the permission filter option and the x-ms-query-source-authorization header, the service compares Entra claims to document permissions and returns a 5xx rather than a partial result when evaluation fails.
  • Admin keys bypass everything. Owner, Contributor and Search Service Contributor can read admin keys, and a request carrying a key is authenticated by the key, so move to role-based access control and disable keys.
  • The indexer identity is the widest reader in the design. It runs with service-level credentials and is not limited by per-index role assignments, so scope its managed identity on each source and keep its network path private.

Where Azure AI Search sits in a RAG design

In a typical Azure RAG build, an indexer or your own push code reads documents from Blob Storage, ADLS Gen2, SharePoint, OneLake, Cosmos DB or SQL; a skillset chunks and embeds them through Azure OpenAI or Foundry; and an application, agent or knowledge base retrieve call queries the index. Microsoft's shared responsibility statement for the service lists what the customer configures: "network access controls, authentication and authorization, outbound connections, document-level permissions, monitoring and alerting, and optional CMK and confidential computing."

That gives four identities to secure, each with a different failure mode.

IdentityWhat it does in Azure AI SearchTypical failureControl
Indexer and skillset identity (search service managed identity)Reads sources, calls embedding and enrichment endpoints, writes to the indexContributor or broad data roles on whole storage accounts; connection strings with account keysSystem or user-assigned managed identity, read-only data roles scoped to the container or database
Application or agent identityQueries the index on a user's behalfA query or admin API key in app settings, shared across apps and environmentsEntra token with Search Index Data Reader, scoped to one index where possible
End user identityThe person whose permissions should limit resultsNever passed to the service, or passed as a filter value the client or model can changeNative ACL header with the user's token, or a server-side security filter built from verified claims
Administrators and pipelinesCreate indexes, indexers and skillsets; deploy schema changesStanding Owner or Contributor that can read admin keysPrivileged Identity Management for control plane roles, Search Service Contributor only for builders

See the Azure OpenAI and Azure AI Foundry Security Guide for the model side of the same design.

Choosing a document-level security approach

Microsoft documents four ways to trim results to what the user may see. They differ in status, source support and who resolves identity.

ApproachStatus (November 2026)How it worksFits when
Security filtersGenerally availableThe application passes user or group identifiers as a filter; documents without a matching string are excludedCustom identity systems, non-Entra users, push-model indexes, production workloads that cannot use preview features
POSIX-like ACLs and RBAC scopesPreviewThe indexer stores ADLS Gen2 ACLs or Azure RBAC scopes as permission metadata; the service compares the query token's user, group and scope claims to itContent already governed by ADLS Gen2 ACLs or Blob RBAC assignments
SharePoint in Microsoft 365 ACLsPreviewThe indexer extracts SharePoint permission metadata, including SharePoint site groupsDocument libraries, lists and site pages
Microsoft Purview sensitivity labelsPreviewThe indexer extracts labels from Blob, ADLS Gen2, SharePoint and OneLake and evaluates them at query time against the user's token and Purview policiesContent already labelled under Purview information protection

Decision guidance. Microsoft's own advice is that preview features "aren't recommended for production workloads, and might change or be constrained before they become generally available." A regulated organisation shipping to production this quarter will usually build security filters now, with group resolution in its own API layer, and pilot native ACLs in a non-production index. An organisation whose content is in ADLS Gen2 or SharePoint with clean permissions gains most from native ACLs, because the service rather than the application does the comparison and refuses to return partial results. Small teams with one or two sensitivity levels often do better with separate indexes per audience, scoped by index-level role assignments.

Implementing security filters safely

The generally available pattern is a filterable string collection holding the Entra object IDs of the groups (or users) allowed to read each document, and a filter on every query. Microsoft's example field is group_ids of type Collection(Edm.String) with filterable: true and retrievable: false, queried with group_ids/any(g:search.in(g, 'group_id1, group_id2')). Microsoft recommends search.in over chains of equality comparisons, which it says slow responses "by many seconds" with hundreds or thousands of values.

  • Resolve identity server-side: Microsoft states that there is "no authentication or authorization through the security principal". Take the user's object ID and group memberships from a validated Entra token in your API, never from a request parameter, and never let the model or an agent tool compose the filter.
  • Append, do not replace: combine the security clause with any user-supplied filter using and in code you control, so a user filter cannot widen the result set.
  • Treat retrievable as cosmetic: Microsoft warns that retrievable: false "isn't a content-obfuscation or field-level security mechanism". It hides the ACL field from responses; the filter is what enforces access.
  • Cover every query path: search, vector, hybrid, semantic, suggest and autocomplete.
  • Empty means deny: write documents with no resolvable ACL to a quarantine index or with a sentinel value no user holds, rather than leaving the field empty.
  • Keep ACLs in step: update access lists with merge or mergeOrUpload when source permissions change, and record sync time per document.

Implementing native ACL and label trimming

For the preview approaches you enable permission filtering on the index (the searchIndexPermissionFilterOption setting), mark string fields with a permissionFilter role for user IDs, group IDs or RBAC scope, and send the querying user's Entra access token in the x-ms-query-source-authorization header, alongside the application's own bearer token in Authorization. Microsoft documents REST API version 2026-08-01-preview for ACL, RBAC scope and Purview label features, with SharePoint incremental ACL sync for items with unique permissions from 2026-05-01-preview. Group membership is resolved through Microsoft Graph.

BehaviourWhat the documentation saysDesign consequence
User token omittedOnly public documents are returned; ACL-protected content is notA missing header fails safe, but test that your app always sends it
ACL evaluation fails (for example Graph unavailable)The service returns 5xx and no partially filtered resultHandle the error as "no context", not as a reason to retry without the header
Multiple permission fieldsA document is authorised if any filter succeeds (user IDs or group IDs)A stale direct user grant keeps access even after group removal
Per-item ACL limitsADLS Gen2 up to 32 ACL entries per file or directory; SharePoint up to 1,000 permission entries per file; entries beyond the limit might not be enforcedGrant to groups, not individuals, and alert on items near the limit
Nested groups in SharePointAn Entra group nested inside a SharePoint group is not expandedAdd Entra groups directly to SharePoint permissions, or flatten before indexing
Permission changesAppear only after an indexer run, push update or Purview refresh; inherited SharePoint and ADLS changes need an explicit resyncSchedule resyncs and measure lag; plan a forced resync in offboarding
Chunked indexesACL fields move from indexer field mappings to index projections; labels must be projected to each chunkWithout projection, chunk-level results are not filtered
RBAC scope granularityDocument level for ADLS Gen2; container level for Blob indexersSplit Blob content into containers by audience

Purview labels: label extraction requires a system-assigned managed identity (user-assigned is not used for this), RBAC authentication on the service, single-tenant scenarios, and a grant from a Global Administrator or Privileged Role Administrator so the service can call Purview. Autocomplete and Suggest are not available on Purview-enabled indexes. Retrieve responses carry sensitivityLabelInfo per reference and a response-level label, which the client can use for banners or to block onward sharing.

Elevated read: to troubleshoot trimming, an administrator can send x-ms-enable-elevated-read: true on a search POST and see all documents. It needs Search Index Data Contributor or a custom role with Microsoft.Search/searchServices/indexes/contentSecurity/elevatedOperations/read, and it does not work on knowledge base retrieve. Grant it through PIM and alert on its use. From 2026-05-01-preview the header must be sent explicitly; earlier previews returned all documents to API keys or authorised roles without a user token, so retire applications pinned to 2025-05-01-preview or 2025-08-01-preview.

Authentication: retire API keys

Key-based authentication is the default. An admin key gives full read-write access to the data plane, a query key gives read-only access to documents, and Microsoft notes that "If your request includes an API key alongside role-based credentials, the service authenticates using the key." Under Settings > Keys the service offers API Key, Role-based access control or Both; Both is meant for migration only.

RolePlaneGrantsGive it to
OwnerControlFull control plane, role assignment, authentication settings, can manage API keysBreak-glass and platform owners via PIM
ContributorControlAs Owner without role assignment; can retrieve admin keysDeployment pipelines only where keys are disabled
ReaderControlView metrics and object definitions; no keys, no dataAuditors and operations
Search Service ContributorControl and object managementCreate indexes, indexers, skillsets and knowledge bases; can retrieve admin keys; can create indexers that write to any indexSearch engineers, time-bound
Search Index Data ContributorDataLoad documents, query, retrieve from knowledge bases; includes elevated readPush-model ingestion identities only
Search Index Data ReaderDataQuery and retrieveApplication and agent identities
  1. Inventory key use: the activity log records a Get Admin Key entry for calls that used an admin key. Find every app setting, pipeline variable and notebook holding a key.
  2. Switch to Both: assign Search Index Data Reader to each application's managed identity, scoped to its index with the CLI, PowerShell or REST (the portal does not assign at index level), and allow 5 to 10 minutes for assignments to apply.
  3. Remove keys from clients: deploy token-based clients and remove the key header, since a key in the request overrides the token.
  4. Switch to Role-based access control: this disables API keys for data plane requests (in the management API, the disableLocalAuth property). Delete query keys; regenerate both admin keys, which can be disabled but not deleted.
  5. Roll back: if a client breaks, set Both again, which accepts keys immediately, fix the client, and repeat.

For Conditional Access, Microsoft notes that selecting a specific search service does not enforce the policy; target the general Azure AI Search cloud app. See the Azure RBAC and Service Principals Guide.

Managed identities for indexers, skills and vectorisers

Basic tier and above can use a system-assigned identity (one per service, tied to its lifetime) or user-assigned identities for indexer data sources, Azure OpenAI, Foundry and Azure Functions skills and vectorisers, Key Vault for customer-managed keys, knowledge stores and the enrichment cache. A data source uses the system identity when its connection string is a resource ID with no key (ResourceId=/subscriptions/.../storageAccounts/name;); a user-assigned identity is named in an identity property. Skills and vectorisers use the system identity when apiKey and authIdentity are empty, and Microsoft's example role on Azure OpenAI is Cognitive Services OpenAI User.

  • Read for sources, write only where needed: Microsoft says read permissions are needed for indexer connections and Key Vault, and write permissions only for debug sessions, the enrichment cache and knowledge stores. Grant data roles on the container, database or vault, not the subscription.
  • Know the same-region rule: only a system-assigned identity can make a same-region connection to Azure Storage, and that connection must use the trusted service exception or a resource instance rule.
  • Remember the indexer scope gap: per-index role assignments do not limit indexers, which use service-level credentials, and a Search Service Contributor can point an indexer at any index. Keep sensitive and general indexes on separate services when builders should not be able to write across them.
  • Allow for propagation: managed identity permission changes may take several hours to apply.

See the Azure Managed Identities Security Guide and How to find over-privileged Azure managed identities.

Private networking in and out

  • Inbound private endpoint: Basic tier or above; target subresource searchService; private DNS zone privatelink.search.windows.net. Then set public network access to disabled (portal: Networking, Firewalls and virtual networks, Disabled). Portal access to index data and object definitions is then restricted to browsers inside the network. Private Link is billed separately.
  • IP firewall and network security perimeter: where a private endpoint is not possible, inbound IP rules admit only named ranges; a network security perimeter can place search, Azure OpenAI, Storage and Azure Monitor inside one logical boundary.
  • Outbound shared private link: lets indexers, skills and knowledge bases reach sources behind Private Link. Group IDs include blob, dfs, Sql (Cosmos DB, case-sensitive), sqlServer, vault, sites and openai_account. The resource owner must approve the pending private endpoint connection, and the link shows status: Approved when done.
  • Force the private execution environment: set executionEnvironment: private on indexers that use shared private links; Microsoft notes that without it the service may move processing between environments under load, making runs inconsistent.
  • Check tier limits: skills over shared private link need a service created after 3 April 2024 (S1 or above for non-embedding skills), and connections to non-Azure providers go over the public internet.

See the Azure Storage Security Guide for the source side.

Encryption and data residency

All content is encrypted with 256-bit AES under Microsoft-managed keys. Customer-managed keys in Key Vault add a second layer over indexes and synonym maps; Microsoft warns they "can degrade query performance by 30-60%". Object names may appear in telemetry outside the region, so keep sensitive terms out of index and field names. See the Azure Key Vault Security Guide.

Detection and measurement

Resource logs are not collected until you create a diagnostic setting. Logs land in AzureDiagnostics under Microsoft.Search with category OperationLogs, operation names such as Query.Search, Indexing.Index and Indexers.*, and properties including IndexName_s, Query_s and Description_s. Microsoft states that resource logs do not record user identities, so log the end user, agent and filter applied in your own application layer and correlate on time and index. Control plane changes and Get Admin Key entries are in AzureActivity.

  • Alert on: any Get Admin Key entry after keys are disabled; role assignments of Search Index Data Contributor or custom roles with elevated read; changes to authentication mode, public network access or shared private links; new indexers or data sources; Query.Search spikes per index outside the application's pattern.
  • Metrics that show it is working: share of query traffic carrying a user identity (target 100% for ACL-protected indexes); median and maximum ACL sync lag between source change and index; number of services with API keys enabled (target zero); indexer identities with roles above container or database scope; documents with empty or over-limit ACLs; red-team retrieval tests passing per release.

See the Azure Monitor, Activity Log and Diagnostic Settings Guide.

Common failure patterns

  • Filter built from model output: an agent tool takes a filter string as a parameter, so a prompt injection removes the security clause. Build the clause in code. See the Prompt Injection Guide.
  • Query key in the front end: a browser app calls the index with a query key, so anyone can read every document.
  • ACLs lost at chunking: the parent document carries permissions but projections do not copy them to chunks, so vector hits are unfiltered.
  • Over-shared source, faithfully indexed: native ACLs reproduce "everyone" grants in SharePoint. Clean up sharing before indexing; see the SharePoint and OneDrive Security Guide.
  • Poisoned or credential-bearing content: writable sources let anyone with edit rights plant instructions or secrets that retrieval serves back. See AML.T0070 RAG Poisoning and MITRE ATLAS AML.T0082 RAG Credential Harvesting.

Framework mapping

FrameworkReferenceAzure AI Search control
NIST SP 800-53 Rev. 5AC-3 Access EnforcementSecurity filters or native ACL trimming on every query
NIST SP 800-53 Rev. 5AC-6 Least PrivilegeIndex-scoped data roles, container-scoped indexer roles, PIM for admins
NIST SP 800-53 Rev. 5IA-2 Identification and AuthenticationEntra tokens instead of API keys; user token in the query header
NIST SP 800-53 Rev. 5SC-7 Boundary ProtectionPrivate endpoint, public access disabled, shared private link
NIST SP 800-53 Rev. 5SC-28 Protection of Information at Rest; SC-12Customer-managed keys in Key Vault
NIST SP 800-53 Rev. 5AU-2 Event Logging; AU-12Diagnostic settings, application-layer identity logging
NIST CSF 2.0PR.AA-05; PR.DS-01; DE.CM-09Permission management, data at rest, runtime monitoring
OWASP Top 10 for LLM Applications 2025LLM02 Sensitive Information Disclosure; LLM08 Vector and Embedding WeaknessesDocument-level trimming and index segregation
MITRE ATT&CKT1213 Data from Information RepositoriesLogging and anomaly detection on query volume per index

Practitioner checklist

  • Decide per index: security filters (GA), native ACLs or labels (preview), or separate indexes per audience, and record why.
  • Build security filter clauses server-side from validated Entra claims; never accept them from clients or model tools.
  • Project ACL and label fields to every chunk and test vector, hybrid and semantic queries with low-privilege users.
  • Move every client to Entra tokens, then set authentication to Role-based access control and regenerate admin keys.
  • Scope Search Index Data Reader to single indexes and keep Owner, Contributor and Search Service Contributor under PIM.
  • Give indexers managed identities with read-only roles on the specific container, database or vault.
  • Add an inbound private endpoint, disable public access, and use approved shared private links with the private execution environment.
  • Turn on diagnostic settings, log user identity in the application, and alert on admin key use and elevated read.
  • Measure ACL sync lag and force a resync as part of leaver and access-removal processes.

Standards and references

Related NHI Mgmt Group resources: Permission-Aware RAG Guide · Azure OpenAI and Azure AI Foundry Security Guide · Azure Managed Identities Security Guide · Threat Modelling RAG Systems · RAG Security Test Plan Template

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.