Azure DevOps Services |Azure DevOps Server 2022 および Azure DevOps Server 2019
この記事では、Azure DevOps でサービス フックの 表示 または 編集 のアクセス許可を付与する方法について説明します。 既定では、これらのアクセス許可を持つのはプロジェクト管理者だけです。 他のユーザーまたはグループに割り当てるには、 コマンド ライン ツール または Security REST API を使用します。
ServiceHooks
セキュリティ名前空間 ID は、リスト セキュリティ名前空間で定義されています。
前提条件
カテゴリ | 必要条件 |
---|---|
プロジェクト アクセス | プロジェクト メンバー。 |
アクセス許可 | - プロジェクト コレクション管理者グループのメンバー。 組織の所有者は、自動的にこのグループのメンバーになります。 - Azure DevOps プロファイルの Microsoft Entra トークンまたは個人用アクセス トークン (PAT)。 >[!重要] > リスクの高い個人用アクセス トークンよりも安全な Microsoft Entra トークンをお勧めします。 PAT 使用量の削減に向けた取り組みの詳細をご覧ください。 > 認証ガイダンスを確認して、ニーズに適した認証メカニズムを選択してください。 |
ツール |
Azure CLI。 1. az devops login でサインインします。2. 組織を既定の組織として定義できます。 それ以外の場合は、各コマンドの --org "https://dev.azure.com/{organization}" を定義します。 az devops configure --defaults organization="https://dev.azure.com/{organization}" 3. 組織のアクセス許可の一覧が表示されるかどうかを確認する: az devops security permission namespace list --org "https://dev.azure.com/{organization}" . |
グループ ID とアクセス許可トークンの読み取り
グループ ID 記述子を見つけます。
> az devops security group list --project 00000000-0000-0000-0000-000000000000 --output table Name Descriptor ----------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------- [TEAM FOUNDATION]\EntraServiceHooksRead Aa1Bb~2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_Jj0Kk1Ll2
グループ名でフィルター処理する場合は、コマンド プロンプトに応じて
findstr
またはgrep
コマンドを使用できます。アクセス許可トークンを取得します。
> az devops security permission list --id 00000000-0000-0000-0000-000000000000 --subject <Group or user descriptor> --output table Token Effective Allow Effective Deny ------------------------------------------------------ ----------------- ---------------- PublisherSecurity 0 0 PublisherSecurity/00000000-0000-0000-0000-000000000000 0 0
サービス フックの読み取りアクセス許可を更新する
--allow-bit
に対して定義できるアクセス許可の一覧。- サブスクリプションの表示
- サブスクリプションの編集
- サブスクリプションの削除
- イベントの発行
> az devops security permission namespace show --id 00000000-0000-0000-0000-000000000000 { "actions": [ { "bit": 1, "displayName": "View Subscriptions", "name": "ViewSubscriptions", "namespaceId": "00000000-0000-0000-0000-000000000000" }, { "bit": 2, "displayName": "Edit Subscription", "name": "EditSubscriptions", "namespaceId": "00000000-0000-0000-0000-000000000000" }, { "bit": 4, "displayName": "Delete Subscriptions", "name": "DeleteSubscriptions", "namespaceId": "00000000-0000-0000-0000-000000000000" }, { "bit": 8, "displayName": "Publish Events", "name": "PublishEvents", "namespaceId": "00000000-0000-0000-0000-000000000000" } ], "dataspaceCategory": "Default", "displayName": "ServiceHooks", "elementLength": -1, "extensionType": null, "isRemotable": true, "name": "ServiceHooks", "namespaceId": "00000000-0000-0000-0000-000000000000", "readPermission": 1, "separatorValue": "/", "structureValue": 1, "systemBitMask": 0, "useTokenTranslator": true, "writePermission": 7 }
グループの View アクセスを設定します。
--allow-bit
の ServiceHooks サブスクリプションの表示は 1 です。> az devops security permission update --namespace-id 00000000-0000-0000-0000-000000000000 --subject <Group or user descriptor> --token PublisherSecurity/00000000-0000-0000-0000-000000000000 --allow-bit 1 [ { "acesDictionary": { "Microsoft.TeamFoundation.Identity;00000000-0000-0000-0000-000000000000": { "allow": 1, "deny": 0, "descriptor": "Microsoft.TeamFoundation.Identity;00000000-0000-0000-0000-000000000000", "extendedInfo": { "effectiveAllow": 1 }, "resolvedPermissions": [ { "bit": 1, "displayName": "View Subscriptions", "effectivePermission": "Allow", "name": "ViewSubscriptions" } ] } }, "includeExtendedInfo": true, "inheritPermissions": true, "token": "PublisherSecurity/00000000-0000-0000-0000-000000000000" } ]
変更を確認するためのアクセス許可トークンを取得します。
> az devops security permission list --id 00000000-0000-0000-0000-000000000000 --subject <Group or user descriptor> --output table Token Effective Allow Effective Deny ------------------------------------------------------ ----------------- ---------------- PublisherSecurity 0 0 PublisherSecurity/00000000-0000-0000-0000-000000000000 1 0
次の例は、ユーザーがサービスフックサブスクリプションを表示できることを示しています。
グループのすべてのサービス フックのアクセス許可をリセットする
グループまたはユーザーのすべてのサービス フックのアクセス許可をリセットする必要がある場合は、
reset-all
を呼び出すことができます。> az devops security permission reset-all --id 00000000-0000-0000-0000-000000000000 --subject <Group or user descriptor> --token PublisherSecurity/00000000-0000-0000-0000-000000000000 Are you sure you want to reset all explicit permissions for this user/group and token? (y/n): Y true > az devops security permission list --id 00000000-0000-0000-0000-000000000000 --subject <Group or user descriptor> --output table Token Effective Allow Effective Deny ------------------------------------------------------ ----------------- ---------------- PublisherSecurity 0 0 PublisherSecurity/00000000-0000-0000-0000-000000000000 0 0
次の例は、アクセス許可がリセットされた後、ユーザーがサブスクリプションをサービスフックに表示できないことを示しています。