Redigera

Dela via


Get-AzRoleManagementPolicy

Get the specified role management policy for a resource scope

Syntax

Get-AzRoleManagementPolicy
   -Scope <String>
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzRoleManagementPolicy
   -Name <String>
   -Scope <String>
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzRoleManagementPolicy
   -InputObject <IAuthorizationIdentity>
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]

Description

Get the specified role management policy for a resource scope

Examples

Example 1: List all role management policies under a resource scope

$scope = "/subscriptions/38ab2ccc-3747-4567-b36b-9478f5602f0d/"
Get-AzRoleManagementPolicy -Scope $scope

Name                                 Type                                           Scope
----                                 ----                                           -----
588b80cc-f50c-4616-acc9-0003872624db Microsoft.Authorization/roleManagementPolicies /subscriptions/38ab2ccc-3747-4567-b36b-9478f5602f0d
8dbbf139-4d46-4ad4-a56b-004156c117d2 Microsoft.Authorization/roleManagementPolicies /subscriptions/38ab2ccc-3747-4567-b36b-9478f5602f0d
1c8bc687-402c-4e62-b38b-009d6fc244d3 Microsoft.Authorization/roleManagementPolicies /subscriptions/38ab2ccc-3747-4567-b36b-9478f5602f0d

Returns all roleManagementPolicies for the scope

Example 2: Get a role management policy by Scope and Name

$scope = "/subscriptions/38ab2ccc-3747-4567-b36b-9478f5602f0d/"
$name = "33b520ea-3544-4abc-8565-3588deb8e68e"
Get-AzRoleManagementPolicy -Scope $scope -Name $name

Name                                 Type                                           Scope
----                                 ----                                           -----
33b520ea-3544-4abc-8565-3588deb8e68e Microsoft.Authorization/roleManagementPolicies /subscriptions/38ab2ccc-3747-4567-b36b-9478f5602f0d

Use the Id property to get scope and name

Parameters

-DefaultProfile

The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.

Type:PSObject
Aliases:AzureRMContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

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

-Name

The name (guid) of the role management policy to get.

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

-Scope

The scope of the role management policy.

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

Inputs

IAuthorizationIdentity

Outputs

IRoleManagementPolicy