🔐dv-security
- プラグイン
- dataverse
- ソース
- GitHub で見る ↗
説明
セキュリティロールの割り当て、ユーザーアクセス、アプリケーションユーザー、ビジネスユニット、および Dataverse 環境における管理者の自己昇格を管理します。 次のような場合に使用: ユーザーに対してアクセス権の付与やロールの割り当てを行いたい場合、管理者権限を取得したい場合、またはサービスプリンシパルを追加したい場合。
原文を表示
Security-role assignment, user access, application users, business units, and admin self-elevation in Dataverse environments. Use when the user wants to give someone access, grant a role, become an admin, or add a service principal.
ユースケース
- ✓ユーザーにアクセス権を付与するとき
- ✓ロールを割り当てるとき
- ✓管理者権限を取得するとき
- ✓サービスプリンシパルを追加するとき
本文(日本語訳)
スキル: セキュリティ — ロール割り当てと自己昇格
このスキルは PAC CLI のみを使用します。 ロール操作に Python スクリプトを記述しないでください。
実行前のプレビュー
ロールの付与および自己昇格は破壊的な操作です(セキュリティ状態を変更し、Purview にログが記録されます)。
実行前に、対象ユーザー・ロール・環境などの内容を平易な文章でプレビューしてください。
不明な情報にはプレースホルダー(<ENV_URL>、<USER_EMAIL>)を使用し、確認と不足情報の入力要求を同じターンで行ってください。
生の pac admin コマンドブロックは省略してください。セキュリティ変更を承認するためにユーザーが CLI 構文を読む必要はありません。
基本原則: ユーザーが最初のレスポンスから「これから何が起きるか」を判断できるようにすること。 単なる 「対象の環境はどれですか?」 はこの基準を満たしません。 一文の散文プレビューであれば基準を満たします。
例
ロール割り当て(ユーザーは指定済み、環境が未指定の場合):
- ❌ 「対象の環境を指定してください。」
- ✅ 「
user@contoso.comに対し、<ENV_URL>上で System Administrator を割り当てます。続行する場合は確認のうえ、対象の環境 URL(または「all」と入力すると一覧表示・一括処理)を提供してください。」
全環境への管理者アクセス付与:
- ❌ 「メールアドレスを入力してください。」
- ✅ 「環境の一覧を取得し、
<YOUR_UPN>に対して各環境で System Administrator を並列で割り当てます。いずれかの環境でassign-userが失敗した場合は、その環境に限り自己昇格(Purview にログ記録)にフォールバックします。続行する場合は確認のうえ、UPN を提供してください。」
スキルの適用範囲
| 目的 | 代わりに使用するもの |
|---|---|
| テーブル・列・リレーションシップの作成または変更 | dv-metadata |
| 組織設定・監査・一括削除・保持ポリシーの管理 | dv-admin |
| レコードのクエリまたは読み取り | dv-query |
| レコードの書き込み・更新・削除 | dv-data |
| テナントレベルのガバナンス(DLP、環境ライフサイクル) | pac admin --help |
前提条件
- PAC CLI がインストール済みかつ認証済みであること(
pac auth create) - 対象環境での System Administrator ロール(自己昇格の場合は グローバル管理者 / Power Platform 管理者 / D365 管理者)
- アクティブな認証プロファイル:
pac auth list
ユーザーへのセキュリティロール割り当て
pac admin assign-user --user <email-or-object-id> --role "System Administrator" --environment <url>
引数
| 引数 | エイリアス | 必須 | 説明 |
|---|---|---|---|
--user |
-u |
必須 | ユーザーのメールアドレス(UPN)または Azure AD オブジェクト ID |
--role |
-r |
必須 | セキュリティロール名(例: System Administrator、Basic User) |
--environment |
-env |
必須 | 対象環境の URL または ID |
--application-user |
-au |
任意 | ユーザーをアプリケーションユーザー(サービスプリンシパル)として扱う |
--business-unit |
-bu |
任意 | ビジネスユニット ID。省略時は呼び出し元のビジネスユニットが使用される |
バッチワークフロー: 複数環境へのロール一括割り当て
順次実行ではなく、並列で実行してください:
Step 1: pac admin list -> 全環境を取得
Step 2: 必要に応じてタイプでフィルタ(例: Developer、Sandbox) -> 対象を絞り込む
Step 3: ユーザーに確認 — 対象環境の一覧を表示
Step 4: 全割り当てを単一の bash 呼び出しで実行:
pac admin assign-user --user user@contoso.com --role "System Administrator" --environment https://dev1.crm.dynamics.com &
pac admin assign-user --user user@contoso.com --role "System Administrator" --environment https://dev2.crm.dynamics.com &
pac admin assign-user --user user@contoso.com --role "System Administrator" --environment https://dev3.crm.dynamics.com &
wait
Step 5: 結果サマリーを報告(例: 「3 環境中 3 環境で System Administrator を割り当てました」)
重要: ロールを割り当てる前に、必ず対象環境を確認してください。
テナント管理者の自己昇格(フォールバック)
自己昇格は、他のユーザーへのロール割り当てとは本質的に異なります。
pac admin assign-user <other> は 他のユーザー に権限を付与しますが、
pac admin self-elevate は 呼び出し元自身 に権限を付与します。
リスクプロファイルと監査上の位置づけが異なるため、確認プロトコルがより厳格になります。
pac admin assign-user が「user has not been assigned any roles」エラーで失敗した場合は、以下を使用してください:
pac admin self-elevate --environment https://myorg.crm.dynamics.com
- グローバル管理者、Power Platform 管理者、または Dynamics 365 管理者が必要
- すべての昇格は Microsoft Purview にログ記録されます
--environmentを省略した場合、アクティブな認証プロファイルが使用されます
自己昇格の確認プロトコル(assign-user より厳格)
pac admin self-elevate を実行する前に、agent は以下を 必ず 行ってください:
-
リスクを明示する。 実行前のサマリーに以下の文言(または同等の表現)を含める:
「この操作により、あなた自身が
<env>の System Administrator になります。この操作はあなたの ID とタイムスタンプとともに Microsoft Purview にログ記録されます。」 -
理由を収集する。 チケット ID、インシデント番号、または
"dev sandbox アクセス — チケットなし"のような自由記述で、一行の理由を求める。 その内容を実行前サマリーにエコーバックして、記録に残る内容をユーザーが確認できるようにする。 -
上記 (1) と (2) をユーザーが確認した後に、明示的な承認を待つ。 リスクの説明と理由が画面に表示される前に行われた「はい」という単純な返答は承認として受け付けないこと。
-
サイレントフォールバックを行わない。
pac admin assign-userが失敗した場合は、まずその失敗を表示し、その後このプロトコルに従ってself-elevateを提案すること。自動的に連鎖させてはいけません。
フロー: 常にまず pac admin assign-user を試みること。admin self-elevate は上記プロトコルによってゲートされたフォールバックです。
CLI フォールバック: pac admin self-elevate がエラーになった場合は、Power Platform 管理センター → 対象環境を選択 → アクセス → System Administrator ロール から手動で自己昇格を行ってください。
いずれの場合もすべての昇格は Purview にログ記録されます。
(PAC CLI 2.6.4 では、CLI がバックエンドに空の api-version= を送信するため、bolt.authentication.http.AuthenticatedClientException / ApiVersionInvalid エラーでコマンドが失敗します。)
安全規則
- System Administrator ロールを割り当てる前に 必ず確認 を行うこと
- バッチ操作を行う前に対象環境の一覧を表示すること
- 自己昇格はログに記録され監査可能であることをユーザーに警告すること
原文(English)を表示
Skill: Security — Role Assignment and Self-Elevation
This skill uses PAC CLI exclusively. Do NOT write Python scripts for role operations.
Preview Before Running
Role grants and self-elevate are destructive (they change security posture and are logged to Purview). Before running, preview the action in plain prose — target user, role, environment(s) — using placeholders (<ENV_URL>, <USER_EMAIL>) for anything unknown, and ask for confirmation and missing values in the same turn. Skip the raw pac admin block; the user shouldn't have to read CLI syntax to approve a security change.
Key principle: the user should be able to evaluate what's about to happen from your first response. A bare "which environment?" fails that test; a one-line prose preview passes it.
Examples
Assign role (user given, env missing):
- ❌ "Which environment should I target?"
- ✅ "I'll assign System Administrator to
user@contoso.comon<ENV_URL>. Confirm to proceed and provide the target environment URL (or 'all' to list and batch)."
Admin access across all environments:
- ❌ "Please provide your email address."
- ✅ "I'll list your environments, then assign System Administrator in parallel on each one for
<YOUR_UPN>. Ifassign-userfails on any environment, I'll fall back to self-elevate (logged to Purview) for that one. Confirm to proceed and provide your UPN."
Skill boundaries
| Need | Use instead |
|---|---|
| Create or modify tables, columns, relationships | dv-metadata |
| Manage org settings, audit, bulk delete, retention | dv-admin |
| Query or read records | dv-query |
| Write, update, or delete records | dv-data |
| Tenant-level governance (DLP, env lifecycle) | pac admin --help |
Prerequisites
- PAC CLI installed and authenticated (
pac auth create) - System Administrator role in target environment (or Global/PP/D365 Admin for self-elevate)
- Active auth profile:
pac auth list
Assign a Security Role to a User
pac admin assign-user --user <email-or-object-id> --role "System Administrator" --environment <url>
Arguments
| Argument | Alias | Required | Description |
|---|---|---|---|
--user |
-u |
Yes | User email (UPN) or Azure AD object ID |
--role |
-r |
Yes | Security role name (e.g., System Administrator, Basic User) |
--environment |
-env |
Yes | Target environment URL or ID |
--application-user |
-au |
No | Treat user as an application user (service principal) |
--business-unit |
-bu |
No | Business unit ID. Defaults to the caller's business unit |
Batch Workflow: Assign Role Across Multiple Environments
Run in parallel — never sequentially:
Step 1: pac admin list -> Get all environments
Step 2: Filter by type if needed (e.g., Developer, Sandbox) -> Identify targets
Step 3: Confirm with user — show list of target environments
Step 4: Run ALL assignments in a single bash call:
pac admin assign-user --user user@contoso.com --role "System Administrator" --environment https://dev1.crm.dynamics.com &
pac admin assign-user --user user@contoso.com --role "System Administrator" --environment https://dev2.crm.dynamics.com &
pac admin assign-user --user user@contoso.com --role "System Administrator" --environment https://dev3.crm.dynamics.com &
wait
Step 5: Report summary ("Assigned System Administrator on 3/3 environments")
Important: Always confirm which environments will be affected before assigning roles.
Tenant Admin Self-Elevation (Fallback)
Self-elevation is materially different from assigning a role to another user. pac admin assign-user <other> grants privilege to someone else; pac admin self-elevate grants privilege to the caller. The risk profile and audit posture are different, so the confirmation protocol is stricter.
If pac admin assign-user fails with "user has not been assigned any roles", use:
pac admin self-elevate --environment https://myorg.crm.dynamics.com
- Requires Global Admin, Power Platform Admin, or Dynamics 365 Admin
- All elevations are logged to Microsoft Purview
- Uses the active auth profile if
--environmentis omitted
Self-elevation confirmation protocol (stricter than assign-user)
Before running pac admin self-elevate, the agent MUST:
- State the risk explicitly. Include this wording (or equivalent) in the pre-run summary:
"This grants YOU System Administrator on
<env>. The action is logged to Microsoft Purview with your identity and timestamp." - Capture a reason. Ask for a one-line reason — ticket ID, incident number, or a free-form note such as
"dev sandbox access — no ticket". Echo the reason back in the pre-run summary so the user sees what will be on the record. - Wait for an explicit confirmation AFTER the user has seen both (1) and (2). Do NOT accept a bare "yes" given before the risk statement and reason are on screen.
- Do NOT silently fall back. If
pac admin assign-userfails, surface the failure first, then offerself-elevatewith this protocol — never chain them automatically.
Flow: Always try pac admin assign-user first. admin self-elevate is the documented fallback, gated by the protocol above.
CLI fallback: If pac admin self-elevate errors out, self-elevate manually via Power Platform Admin Center → select the environment → Access → System Administrator role. All elevations are still logged to Purview. (In PAC CLI 2.6.4 the command fails with bolt.authentication.http.AuthenticatedClientException / ApiVersionInvalid because the CLI sends an empty api-version= to the backend.)
Safety Rules
- Always confirm before assigning System Administrator role
- Show the list of target environments before batch operations
- Self-elevation is logged and auditable — warn the user
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。