question

Srini-4386 avatar image
0 Votes"
Srini-4386 asked MarileeTurscak-MSFT commented

Need help in setting the duration for role assignment using Azure PIM

Team,

Can you help setting the correct time duration for a specific user like Ex: 4 hrs OR 12 hrs or 24hrs . Below code i'm using not working as expected for the time stamp.
It should always set the current system time.


Open-AzureADMSPrivilegedRoleAssignmentRequest -ProviderId 'aadRoles' -ResourceId 'fb108fc9-23c2-4d1e-b22e-ff2ew77623da' -RoleDefinitionId 'fe430be4-5e62-47db-91af-98c3a49a38b1' -SubjectId '504f2f84-5aa4-42e8-99eb-d1a509f69f78' -Type 'adminAdd' -AssignmentState 'Eligible' -schedule $schedule -reason "test using powershell"

 **$Duration = 4 # Number in Hours**
 $Date = Get-Date
 $start = $Date.ToUniversalTime()
 $end = $Date.AddHours($Duration).ToUniversalTime()

 $schedule = New-Object Microsoft.Open.MSGraph.Model.AzureADMSPrivilegedSchedule
 $schedule.Type = 'Once'
 $schedule.StartDateTime = $start.ToString('yyyy-MM-ddTHH:mm:ss.fffZ')
 $schedule.endDateTime = $end.ToString('yyyy-MM-ddTHH:mm:ss.fffZ')


@SharonZhao-MSFT

azure-active-directorymicrosoft-graph-identity
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Can you try using the example in this thread?


0 Votes 0 ·

0 Answers