Enable Admin roles in O365 - Enable-PrivilegedRoleAssignment

Copper Contributor

Hi,

I'm using Powershell to activate Admin roles in O365. Since a week the command below gives an error. Does anyone have an idea why it isn't working anymore?

 

Command:
Connect-PimService –UserName ""
$roleAssignmentsa = Get-PrivilegedRoleAssignment | Where {$_.RoleName -eq "SharePoint Service Administrator"}
Enable-PrivilegedRoleAssignment -TicketNumber "" -TicketSystem "" –Reason “” –Duration 8 –RoleAssignment $roleAssignmentsa

 

Error:

Enable-PrivilegedRoleAssignment : An error occurred while processing this request.
At line:1 char:1
+ Enable-PrivilegedRoleAssignment -TicketNumber "" -TicketSystem "" –Re ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Enable-PrivilegedRoleAssignment], DataServiceQueryException
    + FullyQualifiedErrorId : Microsoft.OData.Client.DataServiceQueryException,Microsoft.Azure.ActiveDirectory.PIM.PSModule.Cmdlets.EnablePrivilegedRoleAssignment
6 Replies

Have you figured this out yet? I'm having the same problem.

No, were still having this issue!

 

Hi Jeroen,

 

Try running Get-PrivilegedRoleAssignment without any parameters to see what it returns. Also run $Error[0] | Select * to see more detail on the exception. It almost looks like the query is returning null.

Hi Matthew,

Thanks for your response, I've added two screenshots.

 

The command  "Get-PrivilegedRoleAssignment" is returning the available Roles as expected.

Jeroen,

 

The module has been updated on 10/3/2018, I would check to see if you have the latest version. Here is a link to the gallery for more details:

 

PowerShell Gallery - PIM PSModule

Hi Jeroen, I know it's been a few years but just wondering did you able to figure it out because I'm facing the same issue?. I think this might be related to ticket and I heard that Microsoft haven't provide the perameter for it but just wondering if there is still work around to pass the ticket parameter.