Editar

Partilhar via


Get-AzKeyVaultRoleDefinition

List role definitions of a given managed HSM at a given scope.

Syntax

Get-AzKeyVaultRoleDefinition
   [-HsmName] <String>
   [-Scope <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzKeyVaultRoleDefinition
   [-HsmName] <String>
   [-Scope <String>]
   [-Custom]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzKeyVaultRoleDefinition
   [-HsmName] <String>
   [-Scope <String>]
   -RoleDefinitionName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

List role definitions of a given managed HSM at a given scope.

Examples

Example 1

Get-AzKeyVaultRoleDefinition -HsmName myHsm -Scope "/keys"

RoleName                              Description Permissions
--------                              ----------- -----------
Managed HSM Administrator                         1 permission(s)
Managed HSM Crypto Officer                        1 permission(s)
Managed HSM Crypto User                           1 permission(s)
Managed HSM Policy Administrator                  1 permission(s)
Managed HSM Crypto Auditor                        1 permission(s)
Managed HSM Crypto Service Encryption             1 permission(s)
Managed HSM Backup                                1 permission(s)

The example lists all the roles at "/keys" scope.

Example 2

$backupRole = Get-AzKeyVaultRoleDefinition -HsmName myHsm -RoleDefinitionName "Managed HSM Backup User"

$backupRole.Permissions

Actions     NotActions  DataActions NotDataActions
-------     ----------  ----------- --------------
0 action(s) 0 action(s) 3 action(s) 0 action(s)

$backupRole.Permissions.DataActions

Microsoft.KeyVault/managedHsm/backup/start/action
Microsoft.KeyVault/managedHsm/backup/status/action
Microsoft.KeyVault/managedHsm/keys/backup/action

The example gets the "Managed HSM Backup" role and inspects its permissions.

Example 3

Get-AzKeyVaultRoleDefinition -HsmName myHsm -Custom

This example lists all the custom role definitions belong to "myHsm".

Parameters

-Custom

If specified, only displays the custom created roles in the directory.

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

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

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

-HsmName

Name of the HSM.

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

-RoleDefinitionName

Name of the role definition to get.

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

-Scope

Scope at which the role assignment or definition applies to, e.g., '/' or '/keys' or '/keys/{keyName}'. '/' is used when omitted.

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

Inputs

None

Outputs

PSKeyVaultRoleDefinition