Document permissions in an embedding migration: Blob, Data Lake and SharePoint are not the same

Document permissions in an embedding migration: Blob, Data Lake and SharePoint are not the same

A bonus part of the Embedding Migration in Production series (change the model, not the reliability): engineer-level, on Azure AI Search and Microsoft Foundry, mapped to Microsoft exam AI-103.

TL;DR for managers. When you rebuild a search index for a new embedding model, the documents' permissions have to be rebuilt too, and that's where a migration can quietly turn into a data leak. Azure AI Search can enforce permissions natively, but it behaves differently for Blob Storage, Data Lake, SharePoint, Purview labels and custom pipelines. Check which mechanism you actually use, what it does and doesn't cover, and prove with real test users that nobody sees more in the new index than in the source.

The seven parts of this series kept coming back to one rule: nobody may see a chunk in the new index that they couldn't open in the source. Part 7 made it the one gate with zero tolerance. This bonus part explains why it deserves that status, because "copy the permissions across" means something different for every source system.

Why the migration touches permissions at all

The embedding model has nothing to do with who can read a document. But the new index is a new index. Its permission fields are filled by a new indexer, a new skillset or your own backfill code (part 3), and if your pipeline splits documents into chunks, every chunk needs its own copy of the permissions. Any of these can go wrong without a single error:

  • A skillset chunks documents but the permission fields are only mapped onto the parent, not projected onto each chunk.
  • Backfill code copies a field called group_ids from the old index instead of reading permissions from the source.
  • The new pipeline uses a parsing mode that native permission ingestion doesn't support.
  • Permission changes made during a five-week backfill never reach the new index.

The five ways Azure AI Search enforces document permissions

Microsoft documents five approaches. Which one you use decides everything else in this article.

Approach How it works Status (REST 2026-10-01)
Security filters Your application adds a filter with the user's IDs as strings Works with any API version; only as trustworthy as the application building the filter
ACL and RBAC scopes Indexed Entra user and group IDs, or storage container scopes, checked against the user's token GA for ADLS Gen2, standard Blob and push ingestion
SharePoint in Microsoft 365 ACLs The SharePoint indexer stores a supported subset of item permissions GA
Microsoft Purview sensitivity labels Labels extracted at indexing and evaluated against Purview policy at query time Preview, REST 2026-11-01-preview
OneLake source permissions Query-time OneLake authorisation using indexed source locations Preview

With the native approaches, every query carries two tokens. The Authorization header authenticates the caller (often your application's managed identity) to Search. The x-ms-query-source-authorization header carries the end user's delegated token, and that user's permissions decide what comes back. Microsoft is explicit that an application allowed to call Search "isn't automatically a supported document-permission subject".

Same feature name, different behaviour per source

Source What gets indexed Freshness Watch out for
Standard Blob Storage The container's RBAC scope only The user's container access is evaluated at query time; role changes follow Azure propagation and caches No per-file permissions. If different files in one container need different access, Blob RBAC can't express it
ADLS Gen2 Effective user and group ACLs per file, plus container scope ACLs are a snapshot, refreshed roughly daily on eligible indexer runs, or by an explicit permissions resync Up to 32 ACL entries per file or directory. ACLs that grant broad access but exclude named people (implicit block lists) aren't supported
SharePoint in Microsoft 365 A supported subset: inheritance, unique item ACLs, Entra groups, site groups (with extra configuration) Detected item changes and supported folder changes during incremental runs; other changes may need an explicit refresh Not supported: "Anyone" and "People in your organization" links, sharing-link expiry, guest users, Information Management policies, tenants with Entra Conditional Access. Nested groups work to five levels. Up to 1,000 permission entries per file
Custom push pipeline Whatever your code sends: Entra object IDs (GUIDs), not email addresses Your responsibility: re-ingest affected documents when permissions change Your pipeline is now the authority on who may see what, so treat it like one
Purview labels (preview) Sensitivity labels from Blob, ADLS Gen2, SharePoint and OneLake Label metadata is synchronised by the indexer Preview API, system-assigned managed identity, single tenant; labels must be projected onto every chunk

Two consequences for a migration. First, if your old index used SharePoint links shared with "People in your organization" as the way people got access, native SharePoint ACL ingestion won't reproduce it. Users will see less in the new index, and your evaluation in part 5 will report it as a relevance drop. Second, Microsoft states plainly that "permission refresh doesn't provide immediate revocation or a corpus-wide freshness SLA". If your risk assessment assumed instant revocation, it was wrong for the old index too.

Migration traps specific to native permissions

  • Parsing modes. Native permission ingestion supports default parsing or Content Understanding-based extraction. JSON, JSON array, JSON Lines, delimited text, plain-text and Markdown parsing modes aren't supported. If the old pipeline relied on one of them, you can't simply switch native permissions on during the migration.
  • Chunk projections. If a skillset chunks documents, permissions go onto every chunk through index projections, not indexer field mappings alone. A chunk without permission metadata is a chunk nobody's rules apply to.
  • Features that switch off. With SharePoint ACL ingestion, the enrichment cache and debug sessions aren't supported. Knowledge sources can't combine permission ingestion with an asset store, so image serving isn't available. Plan the new pipeline around that rather than discovering it mid-backfill.
  • Field names aren't authority. Microsoft warns not to treat lower-trust content "as authorized permission metadata merely because a field name matches". A document key selects a record; it isn't a security boundary.
  • Any grant is enough. User ACLs, group ACLs and RBAC scopes are evaluated independently, and any matching grant gives access. When you test a revocation, remove the alternative grants too, or a container role will make the test pass for the wrong reason.
  • Fail closed. If permission evaluation fails, the application must fail the request. Don't retry without the user token, with an application identity, or with elevated read.

Old preview APIs. Before REST 2025-11-01-preview, the 2025-05-01 and 2025-08-01 previews returned every document when a query had a service key or Entra role but no user token. Microsoft changed this in November 2025 so that permission filters apply even then. If your current system was built on those previews, check what your application does when the user token is missing, and don't let the migration copy an old assumption into new code.

Prove it: permission parity per user

Two tests, run with real test accounts in a non-production tenant or with clearly marked test documents.

1. Expected outcomes from the source. Write the cases from what the source system says each test user can open, including the edge cases above: a recent revocation, a deep nested group, a user with two separate grants.

# security-cases.yaml: expected outcomes come from the SOURCE system, not from the old index
- user: alice@contoso.test            # member of Finance (Entra group)
  must_see:     [finance-budget-2026:0, policy-hr-012:0]
  must_not_see: [board-minutes-nov:0, legal-case-77:0]
- user: bob@contoso.test              # access to legal-case-77 revoked yesterday
  must_not_see: [legal-case-77:0]     # tests freshness: expect a delay, measure it
- user: carol@contoso.test            # only path is a group nested 6 levels deep
  must_not_see: [eng-roadmap:0]       # beyond the supported depth: no access through that path
- user: dave@contoso.test             # had an ACL grant removed BUT still has container RBAC
  must_see:     [shared-specs:0]      # any supported grant authorises: don't mistake this for a leak

2. Old and new index side by side. For each test user, list everything they can see in both indexes and compare. Anything extra in the new index blocks the release. Anything missing is either a fixed bug in the old index or a new gap, and someone has to decide which.

import requests

API = "2026-10-01"

def visible(index: str, user_token: str, app_token: str, query: str = "*") -> set[str]:
    """Chunk IDs one user can see. The caller authenticates with its own token; the user's token decides access."""
    seen, skip = set(), 0
    while True:
        r = requests.post(
            f"{ENDPOINT}/indexes('{index}')/docs/search.post.search?api-version={API}",
            headers={"Authorization": f"Bearer {app_token}",               # caller: Search RBAC
                     "x-ms-query-source-authorization": user_token},       # subject: document permissions
            json={"search": query, "select": "chunk_id", "top": 1000, "skip": skip},
            timeout=30)
        r.raise_for_status()      # on an auth error: FAIL. Never retry without the user token or with elevated read
        page = [d["chunk_id"] for d in r.json()["value"]]
        seen.update(page)
        if len(page) < 1000:
            return seen
        skip += 1000

def permission_parity(test_users, app_token):
    failures = []
    for u in test_users:                           # tokens for real test accounts, acquired at run time
        old = visible("rag-content-v1", u.token, app_token)
        new = visible("rag-content-v2", u.token, app_token)
        if new - old:
            failures.append((u.name, "EXTRA in new index", sorted(new - old)[:20]))   # blocks the release
        if old - new:
            failures.append((u.name, "MISSING in new index", sorted(old - new)[:20]))
    return failures                                # log IDs only, never content

For investigating a mismatch, an administrator can use elevated read (the x-ms-enable-elevated-read header, GA in REST 2026-10-01) to see indexed documents regardless of permissions. It needs a specific role, it's for audited investigation only, and it must never become the fallback when an end-user query fails.

Common mistakes

  • Assuming "native permissions" behave the same for Blob, Data Lake and SharePoint.
  • Testing only what users should see, never what they shouldn't.
  • Copying permission fields from the old index instead of re-ingesting them from the source.
  • Running evaluation and shadow queries with an identity that can see everything.
  • Treating a permission refresh schedule as a revocation guarantee.

Key takeaways

  • Name the exact permission mechanism per source, with its API version, before designing the new index.
  • Read the unsupported list for that source and decide what to do about each item.
  • Re-ingest permissions from the source through a trusted flow, onto every chunk.
  • Prove parity per test user against the source and the old index; extra visibility blocks the release.
  • Fail closed, and keep elevated read for investigations.

References

Learning this for AI-103? Microsoft's AI-103 exam (Azure AI Apps and Agents Developer Associate) covers implementing RAG with Azure AI Search, vector and hybrid search, and monitoring retrieval quality. Our live online AI-103 course builds these pipelines hands-on in Microsoft Foundry and Azure AI Search, on UK time, with mock assessments before you book the exam.

The Embedding Migration in Production series

Change the model, not the reliability.

  1. Part 1: Your embedding model is being retired
  2. Part 2: Why you can't simply swap embedding models
  3. Part 3: Re-embedding 10 million documents
  4. Part 4: Blue-green migration for Azure AI Search
  5. Part 5: Did the new model improve retrieval?
  6. Part 6: BM25, hybrid and semantic ranking
  7. Part 7: The enterprise migration playbook
  8. Bonus: Document permissions in a migration (you are here)
Back to blog

Ready to take the first step?

Live online courses on UK time, mapped to the current Microsoft AI exams. No coding needed for AI at work.

Explore AI coursesAsk us a question