Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable-DCEntraIDPIMRole error Get-MgPolicyRoleManagementPolicyAssignment_List: Value cannot be null #41

Open
jonas04anderberg opened this issue Dec 6, 2023 · 1 comment

Comments

@jonas04anderberg
Copy link

Hi! I'm getting this error when I run this command:
Enable-DCEntraIDPIMRole -RolesToActivate 'Exchange Administrator', 'Security Operator', 'Security Administrator', 'Intune Administrator', 'Authentication Administrator', 'Helpdesk Administrator', 'User Administrator', 'Teams Administrator', 'SharePoint Administrator' -Reason '-' -UseMaximumTimeAllowed

Get-MgPolicyRoleManagementPolicyAssignment_List: Value cannot be null. Parameter name: structuredType Status: 400 (BadRequest) ErrorCode: ArgumentNullException Date:
2023-12-06T07:54:33 Headers: Transfer-Encoding : chunked Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000 request-id : 04590c84-6cc9-407f-8b20-9c79013493ab
client-request-id : 56bf5eb8-d369-48e4-af13-65396818a619 x-ms-ags-diagnostic :
{"ServerInfo":{"DataCenter":"Sweden Central","Slice":"E","Ring":"5","ScaleUnit":"002","RoleInstance":"GV3PEPF00000BF8"}} Date
: Wed, 06 Dec 2023 07:54:32 GMT
Enable-DCEntraIDPIMRole: Cannot bind argument to parameter 'UnifiedRoleManagementPolicyId' because it is an empty string.

Does anybody know whats going on?

@jonas04anderberg
Copy link
Author

I did manage to fix this by doing a small modification to the Module. I don't know what have changed in the background as this script did work before. The change I did in the module was changing:

$PolicyAssignment = Get-MgPolicyRoleManagementPolicyAssignment -Filter "scopeId eq '/' and scopeType eq 'DirectoryRole' and roleDefinitionId eq '$($RoleAssignment.RoleDefinitionId)'" -ExpandProperty "policy($expand=rules)" at row 1636

to

$PolicyAssignment = Get-MgPolicyRoleManagementPolicyAssignment -Filter "scopeId eq '/' and scopeType eq 'DirectoryRole' and roleDefinitionId eq '$($RoleAssignment.RoleDefinitionId)'"

In short completely removing the -ExpandProperty parameter.

I will leave this issue opened as there might be a more proper way of fixing this.

@jonas04anderberg jonas04anderberg changed the title Get-MgPolicyRoleManagementPolicyAssignment_List: Value cannot be null Enable-DCEntraIDPIMRole error Get-MgPolicyRoleManagementPolicyAssignment_List: Value cannot be null Dec 11, 2023
jonas04anderberg added a commit to jonas04anderberg/DCToolbox that referenced this issue Dec 11, 2023
Removed -ExpandProperty "policy(`$expand=rules)" so that the script works again. This seems to be solving issue DanielChronlund#41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant