access-policies — команда для Claude Code: обзор и установка
Команда для Claude Code помогает собрать конфигурацию access_policies в формате IAM. Администратор настраивает правила доступа надстройки к файлам с метками конфиденциальности.
Apache-2.0 ★ 41 441 обновлён 2026-09-21
/plugin marketplace add anthropics/financial-services
/plugin install claude-for-msft-365-install@claude-for-financial-servicesЧто делает access-policies
Команда генерирует JSON-список правил с эффектами allow или deny для надстройки. В отличие от плоского списка disabled_features, здесь условия привязываются к ресурсам: меткам Microsoft Purview или путям к файлам.
Каждое правило управляет конкретным действием. Блокировка addin.access полностью отключает надстройку на секретных документах. Действие file.upload запрещает прикреплять вложения с выбранной меткой, а skills.authoring закрывает создание пользовательских скиллов. Правило без указания ресурса действует глобально на всех пользователей.
Для работы с метками администратору нужны их GUID из Purview. Модуль ExchangeOnlineManagement позволяет выгрузить список командлетом Get-Label через PowerShell. Сопоставление по GUID защищает правила от сбоев при переименовании меток.
Какие задачи решает
- запретить запуск надстройки на документах с метками строгой конфиденциальности
- заблокировать загрузку закрытых файлов и PDF во вложения
- ограничить создание скиллов без отключения готовых административных инструментов
- настроить белый список документов по сетевым путям или меткам Purview
Примеры запросов агенту
- Собери правило access_policies для блокировки Claude на файлах с меткой Highly Confidential
- Настрой запрет загрузки вложений с меткой Restricted в чат
- Сделай белый список меток Purview, на которых разрешена работа надстройки
Как установить access-policies
1Через маркетплейс плагинов
/plugin marketplace add anthropics/financial-services/plugin install claude-for-msft-365-install@claude-for-financial-services2Вручную: положить файлы
.claude/commands/access-policies.mdВызов — /access-policies. Для всех проектов — ~/.claude/commands/
Вручную: положить файлы
~/.codex/prompts/access-policies.mdВызов — /prompts:access-policies. В Codex этот формат помечен устаревшим, замена — скиллы
Вручную: положить файлы
.github/prompts/access-policies.prompt.mdВручную: положить файлы
.gemini/commands/access-policies.tomlGemini хранит команды в TOML: текст запроса — в поле prompt
Вопросы об access-policies
Как установить access-policies в Claude Code?
Подключите каталог командой /plugin marketplace add anthropics/financial-services, затем установите пакет /plugin install claude-for-msft-365-install@claude-for-financial-services. Команда будет доступна в файле .claude/commands/access-policies.md.
Что делает команда access-policies?
Она помогает по шагам составить блок access_policies для манифеста. На выходе получается массив правил IAM с фильтрацией по действиям и меткам документов.
Что нужно для работы access-policies?
Нужны GUID меток чувствительности Microsoft Purview. Их получают в консоли PowerShell через Connect-IPPSSession и Get-Label, в Graph Explorer или в URL портала Purview.
Исходный текст
access-policies.md · Apache-2.0
--- description: Build the access_policies value — the granular, IAM-shaped way to allow or deny add-in features --- # Configure access_policies `access_policies` is the add-in's access-control mechanism going forward: a JSON list of allow/deny **statements** — IAM-shaped — that decide which features are available and under what conditions. Where `disabled_features` is a single flat list — a feature is on or off for everyone — `access_policies` gives you the same off switch *plus* conditions and effects: | Want | `disabled_features` | `access_policies` | |---|---|---| | Turn a feature off for everyone | ✔ `disabled_features='skills.authoring'` | ✔ a resource-less `deny` statement (same effect) | | Turn a feature off only on certain documents | ✗ | ✔ add a `resource` (e.g. a sensitivity label) | | Turn a feature off *except* for approved documents (allowlist) | ✗ | ✔ `"effect": "allow"` | | Attribute the block in UI copy / telemetry | limited | ✔ per-statement `description` and source | A statement with **no `resource`** is exactly `disabled_features` — so anything you'd put there, you can put here. The `resource` is what adds granularity, and its `type` is the extension point: today the resource is a document (`open_file`, `uploaded_file`) identified by its **Microsoft Purview sensitivity label** or, for the open document, by its **file path**; further resource types plug into the same shape without a new config key. New deployments should start here; `disabled_features` remains supported for the simple flat case. Two document-conditioned controls have worked examples in step 2: - **Whether the add-in runs at all on an open document** (the `addin.access` kill switch), keyed off the open document's label or its path. - **Whether a file may be attached as an upload** (`file.upload`), keyed off the *attached* file's own label — Office files and PDFs. Every other feature can also be scoped to the open document: a `deny` turns it off while a matching document is open. Walk the admin through the four steps below, then hand the finished JSON to [manifest](manifest.md#access_policies) as one more key. ## 1. Get the label GUIDs Skip this step if every rule matches on a file path (step 2) rather than a label. Statements match on the label's **GUID** (`mip_label_guid`) — stable across renames and locales. Have the admin pull their taxonomy once with the Purview compliance PowerShell module (no app registration needed; it uses Microsoft's first-party sign-in): ```powershell # One-time: Install-Module ExchangeOnlineManagement Connect-IPPSSession -UserPrincipalName [email protected] Get-Label | Sort-Object Priority | Format-Table Priority, DisplayName, Name, Guid, ParentId ``` Ask them to paste the table. From it, note for each label they care about: `Guid` (what you'll match), `DisplayName`, and `ParentId` (non-empty means it's a *sublabel* — see the parent-label rule below). If they can't run PowerShell, GUIDs are also visible in the Purview compliance portal URL when a label is opened for editing, or via Microsoft Graph Explorer (`GET /security/informationProtection/sensitivityLabels`). ## 2. Choose the statements Ask which of these shapes they need — most tenants want the first, second, or both. Then substitute their GUIDs. **Block the add-in on documents with a given label** (the common ask — "Claude must not run on our top-secret files"): ```json { "effect": "deny", "action": "addin.access", "resource": { "type": "open_file", "identifiers": [{ "type": "mip_label_guid", "equals": "<guid>" }], "description": "Highly Confidential" } } ``` **Block the add-in on documents in a given location** (for files that can't carry a label, such as those on a network share — see the path rule below): ```json { "effect": "deny", "action": "addin.access", "resource": { "type": "open_file", "identifiers": [{ "type": "file_path", "startsWith": "//fileserver/restricted/" }], "description": "Restricted share" } } ``` **Refuse uploading files that carry a given label** ("users may not attach restricted files"): ```json { "effect": "deny", "action": "file.upload", "resource": { "type": "uploaded_file", "identifiers": [{ "type": "mip_label_guid", "equals": "<guid>" }], "description": "Confidential - Restricted" } } ``` **Turn a feature off for everyone** (the `disabled_features` equivalent — no `resource`, so it applies everywhere; here, no user may author skills): ```json { "effect": "deny", "action": "skills.authoring" } ``` **Allowlist — the add-in runs only on approved labels.** The first `allow` written for an `(action, resource type)` flips that scope to default-deny: only files matching an `allow`'s identifiers pass, and unlabeled files no longer pass either. A matching `deny` still wins over a matching `allow`. ```json { "effect": "allow", "action": "addin.access", "resource": { "type": "open_file", "identifiers": [ { "type": "mip_label_guid", "equals": "<general-guid>" }, { "type": "mip_label_guid", "equals": "<public-guid>" } ] } } ``` Combine as needed — the value is one JSON array of statements. `action` also accepts an array to apply one statement to several actions: ```json [ { "effect": "deny", "action": "addin.access", "resource": { ... } }, { "effect": "deny", "action": ["file.upload", "skills.authoring"] } ] ``` ### Statement grammar (reference) ``` statement := { effect, action, resource? } effect := "allow" | "deny" action := <slug> | [ <slug>, ... ] # feature slugs; unknown -> skipped + reported resource := { type, identifiers: [identifier, ...], description? } type := "open_file" | "uploaded_file" # the extension point identifier := { type: "mip_label_guid" | "mip_label_name" | "file_path", <one operator> } ``` | `action` slug | Gates | Takes a `resource`? | |---|---|---| | `addin.access` | Whether the add-in runs at all on the open document — the kill switch | `open_file` | | `file.upload` | Whether a file may be attached to the conversation | `uploaded_file`, `open_file` | | `skills.authoring` | Creating, editing, and uploading skills; running admin-provisioned skills is unaffected | `open_file` | | `thumbs` | Response feedback (thumbs up / down and the follow-up prompt) | `open_file` | | `web_search` | The built-in web search and web fetch tools and the user-facing web-search toggle; code execution is unaffected | `open_file` | | `permission_mode.accept_all_edits` | The "Accept all edits" and "Skip all permissions" modes; users in either go back to "Ask before edits". Connector (MCP) "Always allow" choices are unaffected | `open_file` | | `permission_mode.dangerously_always_allow` | The "Dangerously always allow" button and the "Skip all permissions" mode it switches to; users in that mode move to "Accept all edits", or "Ask before edits" if `permission_mode.accept_all_edits` is denied too | `open_file` | Unknown slugs are skipped and reported — forward-compatible. A resource-less statement works with any slug. Every slug can scope to `open_file`; `uploaded_file` is evaluated only for `file.upload`. A feature named in an `open_file` statement stays off, whether or not the document matches, until the add-in has read the open document's label, and stays off if the label can't be read. | Operator | Value | Semantics | |---|---|---| | `equals` | string | GUID: case-insensitive. Name: exact, case-sensitive. Path: see the path rule | | `startsWith` | string | prefix match — `mip_label_name` (see the parent-label rule) and `file_path` | | `endsWith` | string | suffix match — `mip_label_name` only | | `exists` | boolean | presence check — `false` = unlabeled, `true` = any label | Exactly one operator per identifier; `mip_label_guid` supports only `equals` and `exists`, `file_path` only `equals` and `startsWith`. A resource needs at least one identifier — an empty `identifiers` array never matches. Statements OR together; identifiers within a resource OR together; a matching `deny` beats a matching `allow`; the first `allow` for an `(action, resource type)` flips that scope to default-deny. `description` is inert prose (surfaced in UI copy / telemetry, never matched). ## 3. Rules to explain before they ship it Tell the admin these six things before they ship; each is a common surprise. **A statement does exactly what it says — nothing is implied.** Blocking the add-in on a label (`addin.access` on `open_file`) does *not* also stop that document from being uploaded into a *different* document, and vice versa. A label blocked "in all its forms" is **two statements** — one on `open_file`, one on `uploaded_file`. Statements, and the identifiers within each, OR together. **Parent labels have no GUID inside a file — only sublabels do.** A document carries its sublabel's GUID (the row with a `ParentId`). To block a whole parent group ("everything under *Confidential*"), either list each sublabel's GUID, or match on the composed display name, which Office writes as `"Parent - Sublabel"` (include the ` - ` separator in the prefix so a sibling label like *Confidentiality Waiver* doesn't also match): ```json { "type": "mip_label_name", "startsWith": "Confidential - " } ``` **Name matching is exact and rename-hazardous.** `mip_label_name` compares the label's display name character-for-character — case-sensitive, whitespace included — as the labeling client wrote it, in that user's locale. `equals`, `startsWith`, and `endsWith` are available. Prefer GUIDs; use names only for the parent-group case above, and tell the admin a rename breaks the match. **A label the add-in can't read fails closed.** When any statement targets `uploaded_file`, an attachment whose label is unreadable — a Purview-*encrypted* package, or legacy `.xls` / `.ppt` / `.doc` — is refused rather than let through. If their sensitive labels apply encryption, that's the behavior they want; if they must upload legacy formats, they'll need to convert them. **"Only classified documents"** — to make the add-in refuse *unlabeled* files, match on presence rather than a GUID: ```json { "type": "mip_label_guid", "exists": false } ``` On `uploaded_file` this also matches formats that can't carry a label at all (images, CSV, plain text) — say so, so they aren't surprised when a screenshot is refused. **A path rule matches the path exactly as Office reports it.** `file_path` compares against the open document's path or URL as the Office host spells it, with three normalizations only: ASCII letters are case-folded, `\` and `/` are the same separator in Windows paths (`"//fileserver/restricted/"` and `"\\\\fileserver\\restricted\\"` are the same prefix — the forward-slash form avoids JSON escaping), and a `file:` URL is read as the path it names. Beyond that: - End every prefix with a separator — `//fileserver/restricted` also matches `//fileserver/restricted-archive/`. - Nothing resolves aliases. The same share reached through a mapped drive letter, a DFS namespace, or another server name is a different path — add each spelling as another identifier. - SharePoint and OneDrive documents report a percent-encoded URL (`%20` for a space); write the prefix encoded the same way. Non-ASCII characters must match exactly. - A document with no path — unsaved, or one Office can't report a path for — never matches a `deny`, and is refused under an `allow` list, like an unlabeled document. - Only the open document is gated. Uploads have no path, so `file_path` never matches `uploaded_file`. A document saved to a new location is judged by the new path once the pane regains focus. - Add-in versions released before `file_path` drop any statement that contains it, so the path rule does not apply on those versions. Keep `file_path` identifiers in their own statements so an older version still applies the label rules. ## 4. Validate and hand off Read the finished array back to the admin as a table (effect / action / resource / identifiers) before generating anything. Then pass it to [manifest](manifest.md#access_policies) as the `access_policies` key. The build script rejects a value that isn't valid JSON and warns on each statement that doesn't fit the grammar above (bad `effect`, unknown resource / identifier type, missing or duplicate operator, a `file_path` on `uploaded_file`). Fix every warning now: the add-in reports unknown action slugs and an unparseable value, but a statement that fails the grammar is dropped silently — this build-time check is the only catch, and the admin would otherwise ship a rule that quietly never applies. `access_policies` belongs in the manifest or bootstrap — it is not one of the eight keys Anthropic's Entra app carries as extension attrs, and more than one statement soon outgrows an attr's 256-char cap anyway (see [update-user-attrs](update-user-attrs.md)). If they use per-user [bootstrap](bootstrap.md), the same array goes there as a native JSON value rather than a string.
© Anthropic · Apache-2.0 · anthropics/financial-services