Enable Admin roles in O365 - Enable-PrivilegedRoleAssignment

%3CLINGO-SUB%20id%3D%22lingo-sub-269144%22%20slang%3D%22en-US%22%3EEnable%20Admin%20roles%20in%20O365%20-%20Enable-PrivilegedRoleAssignment%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-269144%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI'm%20using%20Powershell%20to%20activate%20Admin%20roles%20in%20O365.%20Since%20a%20week%20the%20command%20below%20gives%20an%20error.%20Does%20anyone%20have%20an%20idea%20why%20it%20isn't%20working%20anymore%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CH6%20id%3D%22toc-hId-864337464%22%20id%3D%22toc-hId-977906488%22%3ECommand%3A%3CBR%20%2F%3EConnect-PimService%20%E2%80%93UserName%20%22%22%3C%2FH6%3E%3CH6%20id%3D%22toc-hId--1687819497%22%20id%3D%22toc-hId--1574250473%22%3E%24roleAssignmentsa%20%3D%20Get-PrivilegedRoleAssignment%20%7C%20Where%20%7B%24_.RoleName%20-eq%20%22SharePoint%20Service%20Administrator%22%7D%3C%2FH6%3E%3CH6%20id%3D%22toc-hId-54990838%22%20id%3D%22toc-hId-168559862%22%3EEnable-PrivilegedRoleAssignment%20-TicketNumber%20%22%22%20-TicketSystem%20%22%22%20%E2%80%93Reason%20%E2%80%9C%E2%80%9D%20%E2%80%93Duration%208%20%E2%80%93RoleAssignment%20%24roleAssignmentsa%3C%2FH6%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EError%3A%3C%2FP%3E%3CH6%20id%3D%22toc-hId-1797801173%22%20id%3D%22toc-hId-1911370197%22%3EEnable-PrivilegedRoleAssignment%20%3A%20An%20error%20occurred%20while%20processing%20this%20request.%3CBR%20%2F%3EAt%20line%3A1%20char%3A1%3CBR%20%2F%3E%2B%20Enable-PrivilegedRoleAssignment%20-TicketNumber%20%22%22%20-TicketSystem%20%22%22%20%E2%80%93Re%20...%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2B%20CategoryInfo%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3A%20NotSpecified%3A%20(%3A)%20%5BEnable-PrivilegedRoleAssignment%5D%2C%20DataServiceQueryException%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2B%20FullyQualifiedErrorId%20%3A%20Microsoft.OData.Client.DataServiceQueryException%2CMicrosoft.Azure.ActiveDirectory.PIM.PSModule.Cmdlets.EnablePrivilegedRoleAssignment%3C%2FH6%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-269144%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EO365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-271415%22%20slang%3D%22en-US%22%3ERe%3A%20Enable%20Admin%20roles%20in%20O365%20-%20Enable-PrivilegedRoleAssignment%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-271415%22%20slang%3D%22en-US%22%3E%3CP%3EJeroen%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20module%20has%20been%20updated%20on%2010%2F3%2F2018%2C%20I%20would%20check%20to%20see%20if%20you%20have%20the%20latest%20version.%20Here%20is%20a%20link%20to%20the%20gallery%20for%20more%20details%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20title%3D%22Microsoft.Azure.ActiveDirectory.PIM.PSModule%202.0.0.1762%22%20href%3D%22https%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FMicrosoft.Azure.ActiveDirectory.PIM.PSModule%2F2.0.0.1762%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPowerShell%20Gallery%20-%20PIM%20PSModule%20%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-271310%22%20slang%3D%22en-US%22%3ERe%3A%20Enable%20Admin%20roles%20in%20O365%20-%20Enable-PrivilegedRoleAssignment%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-271310%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Matthew%2C%3C%2FP%3E%3CP%3EThanks%20for%20your%20response%2C%20I've%20added%20two%20screenshots.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20command%26nbsp%3B%26nbsp%3B%22Get-PrivilegedRoleAssignment%22%20is%20returning%20the%20available%20Roles%20as%20expected.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-270426%22%20slang%3D%22en-US%22%3ERe%3A%20Enable%20Admin%20roles%20in%20O365%20-%20Enable-PrivilegedRoleAssignment%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-270426%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Jeroen%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETry%20running%20%3CSTRONG%3EGet-PrivilegedRoleAssignment%3C%2FSTRONG%3E%20without%20any%20parameters%20to%20see%20what%20it%20returns.%20Also%20run%20%3CSTRONG%3E%24Error%5B0%5D%20%7C%20Select%20*%3C%2FSTRONG%3E%20to%20see%20more%20detail%20on%20the%20exception.%20It%20almost%20looks%20like%20the%20query%20is%20returning%20null.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-270378%22%20slang%3D%22en-US%22%3ERe%3A%20Enable%20Admin%20roles%20in%20O365%20-%20Enable-PrivilegedRoleAssignment%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-270378%22%20slang%3D%22en-US%22%3E%3CP%3ENo%2C%20were%20still%20having%20this%20issue!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-270377%22%20slang%3D%22en-US%22%3ERe%3A%20Enable%20Admin%20roles%20in%20O365%20-%20Enable-PrivilegedRoleAssignment%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-270377%22%20slang%3D%22en-US%22%3E%3CP%3EHave%20you%20figured%20this%20out%20yet%3F%20I'm%20having%20the%20same%20problem.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional 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
5 Replies
Highlighted

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

Highlighted

No, were still having this issue!

 

Highlighted

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.

Highlighted

Hi Matthew,

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

 

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

Highlighted

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