Hi, @Андрей Михалевский
Based on your description, I understand that you want to create a role group to manage devices, and users need to connect remotely.
Creating a role group and assigning rules, as well as adding users, can be broken down into the following steps:
1.Create a Custom Management Role
You can use cmdlet to create the custom role.
New-ManagementRole -Name "Custom-MobileDeviceManagement" -Parent "View-Only Configuration"
You need not to create the role with View-Only Configuration role. The View-Only Configuration role allows administrators to view Exchange configuration settings for all non-recipients in the organization. This does not serve the purpose of a remote connection.
2.Create the Role Group
Then you can use cmdlet to create a new role group and assign a custom administrative role to the group.
New-RoleGroup -Name "MobileDevice Management" -Roles "Custom-MobileDeviceManagement"
3.Add a Member to the Role Group
Finally, add the user to the role group. You can use cmdlet
add-RoleGroupMember -identity "MobileDevice Management" -Member
In addition, if you need to use Power Shell to connect to the server remotely, you can refer to the following articles. Connect to Exchange servers using remote PowerShell | Microsoft Learn
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".