官术网_书友最值得收藏!

Ensuring user account permissions

Let's check whether the account has the necessary permissions using the following PowerShell cmdlet:

Get-MsolUserRole

This cmdlet gets all the administrator roles that the specified user belongs to. It will also return the roles that the user is a member of through security group membership.

The cmdlet accepts the following three parameters. ObjectId and UserPrincipalName are the required parameters, and we need to pass/provide at least one of them:

  • [-ObjectId <Guid>]: Specifies the unique ID of the user to retrieve roles for.
  • [-TenantId <Guid>]: Specifies the unique ID of the tenant on which the operation is to be performed. The default value is the tenant of the current user. This parameter applies only to partner users.
  • [-UserPrincipalName <String>]: Specifies the UserPrincipalName of the user to retrieve roles for.

The following cmdlet will display the administrative role for a user:

Get-MsolUserRole -UserPrincipalName "pgbhoyar@pgbhoyar.onmicrosoft.com"

The following screenshot shows the output for the preceding command:

Here, the Company Administrator is the same as global administrator.

To grant additional accounts admin roles, we can use the following PowerShell cmdlet:

Add-MsolRoleMember

To get the available administrative roles, we can use the following PowerShell cmdlet:

Get-MsolRole

The following screenshot shows the output for the preceding command:

If we need to grant the user global administrator/company administrator role, we can use the following PowerShell cmdlet:

Add-MsolRoleMember -RoleName "Company Administrator"
-RoleMemberEmailAddress "prashant-admin@pgbhoyar.onmicrosoft.com"

To verify that the user has the admin role now, we can use the PowerShell Get-MsolUserRole cmdlet mentioned earlier.

主站蜘蛛池模板: 斗六市| 民丰县| 阳城县| 高安市| 铜梁县| 仁布县| 和平县| 社旗县| 阿拉善盟| 大同县| 昌宁县| 瑞昌市| 杨浦区| 岐山县| 五河县| 天津市| 纳雍县| 鄂伦春自治旗| 呼玛县| 岳阳县| 普洱| 东城区| 城口县| 清原| 恩平市| 阿克苏市| 巢湖市| 余庆县| 综艺| 南丰县| 红原县| 张北县| 鲁山县| 合山市| 东乡县| 罗甸县| 治多县| 许昌县| 潢川县| 句容市| 额济纳旗|