Get-AzDenyAssignment

指定したスコープでの Azure RBAC 拒否割り当てを一覧表示します。 既定では、選択した Azure サブスクリプション内のすべての拒否割り当てが一覧表示されます。 特定のユーザーへの拒否割り当てを一覧表示したり、特定のリソース グループまたはリソースに対する拒否割り当てを一覧表示したりするには、それぞれのパラメーターを使用します。

このコマンドレットは、入力パラメーターに従って、以下の Microsoft Graph API を呼び出す場合があります。

  • GET /directoryObjects/{id}
  • POST /directoryObjects/getByIds

構文

Get-AzDenyAssignment
   [-Scope <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -ObjectId <Guid>
   [-ExpandPrincipalGroups]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -ObjectId <Guid>
   -ResourceGroupName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -ObjectId <Guid>
   -ResourceGroupName <String>
   -ResourceName <String>
   -ResourceType <String>
   [-ParentResource <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -ObjectId <Guid>
   -Scope <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -SignInName <String>
   -ResourceGroupName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -SignInName <String>
   -ResourceGroupName <String>
   -ResourceName <String>
   -ResourceType <String>
   [-ParentResource <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -SignInName <String>
   -Scope <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -SignInName <String>
   [-ExpandPrincipalGroups]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -ServicePrincipalName <String>
   -ResourceGroupName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -ServicePrincipalName <String>
   -ResourceGroupName <String>
   -ResourceName <String>
   -ResourceType <String>
   [-ParentResource <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -ServicePrincipalName <String>
   -Scope <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -ServicePrincipalName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -ResourceGroupName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -ResourceGroupName <String>
   -ResourceName <String>
   -ResourceType <String>
   [-ParentResource <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   -Scope <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   [-Scope <String>]
   -Id <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDenyAssignment
   [-Scope <String>]
   -DenyAssignmentName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

説明

Get-AzDenyAssignment コマンドを使用して、スコープで有効なすべての拒否割り当てを一覧表示します。 パラメーターを指定しない場合、このコマンドは、サブスクリプションで行われたすべての拒否割り当てを返します。 この一覧は、プリンシパル、拒否割り当ての名前、スコープのフィルター 処理パラメーターを使用してフィルター処理できます。 ユーザーを指定するには、SignInName パラメーターまたは Microsoft Entra ObjectId パラメーターを使用します。 セキュリティ グループを指定するには、Microsoft Entra ObjectId パラメーターを使用します。 Microsoft Entra アプリケーションを指定するには、ServicePrincipalName または ObjectId パラメーターを使用します。 アクセスが拒否されるスコープを指定できます。 既定では、選択したサブスクリプションが使用されます。 拒否割り当てのスコープは、次のいずれかのパラメーターの組み合わせを使用して指定できます。 スコープ - /subscriptions/<subscriptionId> で始まる完全修飾スコープです。 これにより、その特定のスコープで有効な拒否割り当て (つまり、そのスコープ以上のすべての拒否割り当て) がフィルター処理されます。 b. ResourceGroupName - サブスクリプションの下にある任意のリソース グループの名前。 これにより、指定されたリソース グループで有効な割り当て (つまり、そのスコープ以上のすべての拒否割り当て) がフィルター処理されます。 c. ResourceName、ResourceType、ResourceGroupName、および (必要に応じて) ParentResource - サブスクリプションの特定のリソースを識別し、そのリソース スコープで有効な拒否割り当てをフィルター処理します。 サブスクリプション内の特定のユーザーに対して拒否されるアクセスを確認するには、ExpandPrincipalGroups スイッチを使用します。 これにより、ユーザーとユーザーがメンバーになっているグループに割り当てられているすべての拒否割り当てが一覧表示されます。

例 1

サブスクリプション内のすべての拒否割り当てを一覧表示する

Get-AzDenyAssignment

Id                      : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/providers/Microsoft.Authorization/denyAssignments/22704996-fbd0-4ab1-8625-722d897825d2
DenyAssignmentName      : Test deny assignment 1
Description             : Test deny assignment for PS cmdlets
Actions                 : {foo/*}
NotActions              : {foo/*/read}
DataActions             : {foo/*}
NotDataActions          : {}
Scope                   : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f
DoNotApplyToChildScopes : False
Principals              : {
                          DisplayName:  All Principals
                          ObjectType:   SystemDefined
                          ObjectId:     00000000-0000-0000-0000-000000000000
                          }
ExcludePrincipals       : {
                          DisplayName:  testuser
                          ObjectType:   User
                          ObjectId:     f8d526a0-54eb-4941-ae69-ebf4a334d0f0
                          }
IsSystemProtected       : True

Id                      : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourcegroups/testRG/providers/Microsoft.Authorization/denyAssignments/43af7d0c-0bf8-407f-96c0-96a29d076431
DenyAssignmentName      : Test deny assignment 2
Description             : Test deny assignment for PS cmdlets
Actions                 : {foo/*}
NotActions              : {foo/*/read}
DataActions             : {foo/*}
NotDataActions          : {}
Scope                   : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourcegroups/testRG
DoNotApplyToChildScopes : False
Principals              : {
                          DisplayName:  testuser
                          ObjectType:   User
                          ObjectId:     f8d526a0-54eb-4941-ae69-ebf4a334d0f0
                          ,
                          DisplayName:  PowershellTestingApp
                          ObjectType:   ServicePrincipal
                          ObjectId:     f2dc21ac-702a-4bde-a4ce-146edf751d81
                          }
ExcludePrincipals       : {}
IsSystemProtected       : True

例 2

スコープ testRG 以上でユーザー john.doe@contoso.com に対して行われたすべての拒否割り当てを取得します。

Get-AzDenyAssignment -ResourceGroupName testRG -SignInName john.doe@contoso.com

Id                      : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/providers/Microsoft.Authorization/denyAssignments/22704996-fbd0-4ab1-8625-722d897825d2
DenyAssignmentName      : Test deny assignment 1
Description             : Test deny assignment for PS cmdlets
Actions                 : {foo/*}
NotActions              : {foo/*/read}
DataActions             : {foo/*}
NotDataActions          : {}
Scope                   : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f
DoNotApplyToChildScopes : False
Principals              : {
                          DisplayName:  john.doe
                          ObjectType:   User
                          ObjectId:     f8d526a0-54eb-4941-ae69-ebf4a334d0f0
                          }
ExcludePrincipals       : {}
IsSystemProtected       : True

Id                      : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourcegroups/testRG/providers/Microsoft.Authorization/denyAssignments/43af7d0c-0bf8-407f-96c0-96a29d076431
DenyAssignmentName      : Test deny assignment
Description             : Test deny assignment for PS cmdlets
Actions                 : {foo/*}
NotActions              : {foo/*/read}
DataActions             : {foo/*}
NotDataActions          : {}
Scope                   : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourcegroups/testRG
DoNotApplyToChildScopes : False
Principals              : {
                          DisplayName:  john.doe
                          ObjectType:   User
                          ObjectId:     f8d526a0-54eb-4941-ae69-ebf4a334d0f0
                          ,
                          DisplayName:  PowershellTestingApp
                          ObjectType:   ServicePrincipal
                          ObjectId:     f2dc21ac-702a-4bde-a4ce-146edf751d81
                          }
ExcludePrincipals       : {}
IsSystemProtected       : True

例 3

指定したサービス プリンシパルのすべての拒否割り当てを取得します。

Get-AzDenyAssignment -ServicePrincipalName 'http://testapp1.com'

Id                      : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourcegroups/testRG/providers/Microsoft.Authorization/denyAssignments/43af7d0c-0bf8-407f-96c0-96a29d076431
DenyAssignmentName      : Test deny assignment 1
Description             : Test deny assignment for PS cmdlets
Actions                 : {foo/*}
NotActions              : {foo/*/read}
DataActions             : {foo/*}
NotDataActions          : {}
Scope                   : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourcegroups/testRG
DoNotApplyToChildScopes : False
Principals              : {
                          DisplayName:  TestApp
                          ObjectType:   ServicePrincipal
                          ObjectId:     f2dc21ac-702a-4bde-a4ce-146edf751d81
                          }
ExcludePrincipals       : {}
IsSystemProtected       : True

Id                      : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourceGroups/testRG/providers/Microsoft.Web/sites/site1/providers/Microsoft.Authorization/denyAssignments/94e3d9da-3700-4113-aab4-15f6c173d794
DenyAssignmentName      : Test deny assignment 2
Description             : Test deny assignment for PS cmdlets
Actions                 : {foo/*}
NotActions              : {foo/*/read}
DataActions             : {foo/*}
NotDataActions          : {}
Scope                   : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourceGroups/testRG/providers/Microsoft.Web/sites/site1
DoNotApplyToChildScopes : False
Principals              : {
                          DisplayName:  testuser
                          ObjectType:   User
                          ObjectId:     f8d526a0-54eb-4941-ae69-ebf4a334d0f0
                          ,
                          DisplayName:  TestApp
                          ObjectType:   ServicePrincipal
                          ObjectId:     f2dc21ac-702a-4bde-a4ce-146edf751d81
                          }
ExcludePrincipals       : {}
IsSystemProtected       : True

例 4

'site1' Web サイト スコープでの拒否割り当てを取得します。

Get-AzDenyAssignment -Scope '/subscriptions/96231a05-34ce-4eb4-aa6a-70759cbb5e83/resourcegroups/testRG/providers/Microsoft.Web/sites/site1'

Id                      : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourcegroups/testRG/providers/Microsoft.Authorization/denyAssignments/43af7d0c-0bf8-407f-96c0-96a29d076431
DenyAssignmentName      : Test deny assignment 1
Description             : Test deny assignment for PS cmdlets
Actions                 : {foo/*}
NotActions              : {foo/*/read}
DataActions             : {foo/*}
NotDataActions          : {}
Scope                   : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourcegroups/testRG
DoNotApplyToChildScopes : False
Principals              : {
                          DisplayName:  testuser
                          ObjectType:   User
                          ObjectId:     f8d526a0-54eb-4941-ae69-ebf4a334d0f0
                          }
ExcludePrincipals       : {}
IsSystemProtected       : True

Id                      : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourceGroups/testRG/providers/Microsoft.Web/sites/site1/providers/Microsoft.Authorization/denyAssignments/594e3d9da-3700-4113-aab4-15f6c173d794
DenyAssignmentName      : Test deny assignment 2
Description             : Test deny assignment for PS cmdlets
Actions                 : {foo/*}
NotActions              : {foo/*/read}
DataActions             : {foo/*}
NotDataActions          : {}
Scope                   : /subscriptions/4004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourceGroups/testRG/providers/Microsoft.Web/sites/site1
DoNotApplyToChildScopes : False
Principals              : {
                          DisplayName:  testuser
                          ObjectType:   User
                          ObjectId:     f8d526a0-54eb-4941-ae69-ebf4a334d0f0
                          ,
                          DisplayName:  TestApp
                          ObjectType:   ServicePrincipal
                          ObjectId:     f2dc21ac-702a-4bde-a4ce-146edf751d81
                          }
ExcludePrincipals       : {}
IsSystemProtected       : True

パラメーター

-DefaultProfile

Azure との通信に使用される資格情報、アカウント、テナント、サブスクリプション

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DenyAssignmentName

拒否割り当ての名前です。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ExpandPrincipalGroups

指定した場合、ユーザーとユーザーがメンバーであるグループに直接割り当てられた拒否割り当てを返します (推移的)。 ユーザー プリンシパルに対してのみサポートされます。

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Id

割り当ての完全修飾 ID または GUID を拒否します。 ID を GUID として指定すると、現在のサブスクリプションが既定のスコープとして取得されます。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ObjectId

ユーザー、グループ、またはサービス プリンシパルの Microsoft Entra ObjectId。 指定したプリンシパルに対して行われたすべての拒否割り当てをフィルター処理します。

Type:Nullable<T>[Guid]
Aliases:PrincipalId
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ParentResource

ResourceName パラメーターを使用して指定されたリソースの階層内の親リソース。 ResourceGroupName、ResourceType、および ResourceName パラメーターと組み合わせて使用する必要があります。

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

リソース グループ名。 指定したリソース グループで有効な拒否割り当てを一覧表示します。 ResourceName、ResourceType、ParentResource の各パラメーターと組み合わせて使用すると、リソース グループ内のリソースで有効な拒否割り当てが一覧表示されます。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ResourceName

リソースの名前。 例: storageaccountprod。 ResourceGroupName、ResourceType、および (オプションで) ParentResource パラメーターと組み合わせて使用する必要があります。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ResourceType

リソースの種類。 たとえば、Microsoft.Network/virtualNetworks などです。 ResourceGroupName、ResourceName、および (オプションで) ParentResource パラメーターと組み合わせて使用する必要があります。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Scope

ロールの割り当てのスコープ。 相対 URI の形式。 例: /subscriptions/9004a9fd-d58e-48dc-aeb2-4a4aec58606f/resourceGroups/TestRG。 "/subscriptions/{id}" で始まる必要があります。 このコマンドは、そのスコープで有効なすべての拒否割り当てをフィルター処理します。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ServicePrincipalName

サービス プリンシパルの ServicePrincipalName。 指定した Microsoft Entra アプリケーションに対して行われたすべての拒否割り当てをフィルター処理します。

Type:String
Aliases:SPN
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-SignInName

ユーザーの電子メール アドレスまたはユーザー プリンシパル名。 指定したユーザーに対して行われたすべての拒否割り当てをフィルター処理します。

Type:String
Aliases:Email, UserPrincipalName
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

入力

Guid

String

出力

PSDenyAssignment

メモ

キーワード: azure, azurerm, arm, リソース, 管理, マネージャー, リソース, グループ, テンプレート, デプロイ