Hi partner,
Basically, there are two ways.
1. We can use OOTB report to export Excel.
Open Advanced Find, Look for Reports, set condition: Name Equals "User Summary", click Results.
Open the report.
Select the user scope and click Run Report.
You will see the security roles of all users. Then save as Excel.
This report, however, does not show the security roles directly in one column, but rather many columns in which each user corresponds to his or her security role.
So if you want to display security roles directly in one column, you need to use XrmToolBox's "Users, Team and Security Role Report" tool.
2. XrmToolBox's "Users, Team and Security Role Report" tool
This is the download page for XrmToolBox: https://www.xrmtoolbox.com/
After downloading and unzipping it, open XrmToolBox.exe.
Connect to your D365 organization. Install "Users, Team and Security Role Report" in the tool library.
Open the tool and click Load Data, then click Generate Report. It will download two files, one is .csv and one is .xlsx.
Use Notepad to open the .csv file and copy all. Then open the .xlsx file and paste the data in the first worksheet.
The effect is as follows: