Skip to content

Commit b6237d2

Browse files
Merge pull request #210910 from amsliu/pim-update
Pim update
2 parents 4aca22c + e90f513 commit b6237d2

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

articles/active-directory/privileged-identity-management/pim-resource-roles-activate-your-roles.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.topic: how-to
1010
ms.tgt_pltfrm: na
1111
ms.workload: identity
1212
ms.subservice: pim
13-
ms.date: 08/24/2022
13+
ms.date: 09/12/2022
1414
ms.author: amsliu
1515
ms.reviewer: ilyal
1616
ms.custom: pim
@@ -160,6 +160,21 @@ Status code: 201
160160
"type": "Microsoft.Authorization/RoleAssignmentScheduleRequests"
161161
}
162162
````
163+
## Activate a role with PowerShell
164+
165+
There is also an option to activate Privileged Identity Management using PowerShell. You may find more details as documented in the article [PowerShell for Azure AD roles PIM](powershell-for-azure-ad-roles.md).
166+
167+
The following is a sample script for how to activate Azure resource roles using PowerShell.
168+
169+
```powershell
170+
$managementgroupID = "<management group ID" # Tenant Root Group
171+
$guid = (New-Guid)
172+
$startTime = Get-Date -Format o
173+
$userObjectID = "<user object ID"
174+
$RoleDefinitionID = "b24988ac-6180-42a0-ab88-20f7382dd24c" # Contributor
175+
$scope = "/providers/Microsoft.Management/managementGroups/$managementgroupID"
176+
New-AzRoleAssignmentScheduleRequest -Name $guid -Scope $scope -ExpirationDuration PT8H -ExpirationType AfterDuration -PrincipalId $userObjectID -RequestType SelfActivate -RoleDefinitionId /providersproviders/Microsoft.Management/managementGroups/$managementgroupID/providers/Microsoft.Authorization/roleDefinitions/$roledefinitionId -ScheduleInfoStartDateTime $startTime -Justification work
177+
```
163178

164179
## View the status of your requests
165180

0 commit comments

Comments
 (0)