Assistance Needed with OneDrive and Office 365 Activity PowerShell Scripts

Ameer 11 Reputation points
2024-11-25T08:33:02.72+00:00

Dear All,

I am using the scripts below to retrieve OneDrive and Office 365 activity details for my tenant. However, in the "User Principal Name" field, I am getting an ID instead of the email address. This issue started recently prior to that, it was working fine and showing the email addresses as expected.

I run these scripts daily and generate a Power BI report based on the output.

Invoke-GraphApiRequest -uri "https://graph.microsoft.com/v1.0/reports/getOneDriveActivityUserDetail(date=$yesterdaydate" -FileName "OneDrive\ODUserDailyActivity\OneDriveUserDailyActivity" -Verbose:$VerbosePreference

 

Invoke-GraphApiRequest -uri "https://graph.microsoft.com/v1.0/reports/getOneDriveUsageAccountDetail(date=$yesterdaydate" -FileName "OneDrive\ODUsageDailyReport\OneDriveUsageDailyReport" -Verbose:$VerbosePreference

Here is an example of the output I’m receiving:

 

Report Refresh Date,User Principal Name,Is Deleted,Deleted Date,Last Activity Date,Viewed Or Edited File Count,Synced File Count,Shared Internally File Count,Shared Externally File Count,Assigned Products,Report Period 2024-11-22,830E1CDE8B16F21C80B207D213852737,False,,2024-11-22,1,0,0,0,MICROSOFT COPILOT STUDIO VIRAL TRIAL+MICROSOFT 365 E5+MICROSOFT COPILOT STUDIO USER LICENSE+MICROSOFT POWER AUTOMATE FREE+MICROSOFT INTUNE SUITE+MICROSOFT FABRIC (FREE)+MICROSOFT DEFENDER VULNERABILITY MANAGEMENT ADD-ON+DYNAMICS 365 CUSTOMER VOICE TRIAL+PLANNER AND PROJECT PLAN 3+POWER APPS PREMIUM+MICROSOFT POWER APPS FOR DEVELOPER,1

This is just one example, but I am seeing similar results for most of these scripts.

Could you please help me resolve this issue?

Thank you in advance!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,849 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
1,275 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,605 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,754 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rajat Vashistha-MSFT 265 Reputation points Microsoft Vendor
    2025-01-07T10:10:51.13+00:00

    Hi Ameer,

    Thanks for reaching out to Microsoft!

    At Microsoft, we’re committed to both data-driven insights and user privacy. As part of that commitment, this change was made to pseudonymize user-level information by default.

    However, if your organization’s privacy practices allow, Global administrators can revert this change for their tenant and display identifiable user information. This can be done in the Microsoft 365 admin center by going to Settings > Org Settings > Services and selecting Reports. Under Choose how to show user information, uncheck the statement In all reports, display de-identified names for users, groups, and sites, and then save your changes. 

    Additionally, this can also be achieved using the Graph API. If the "displayConcealedNames" property is set to true, all reports will conceal user information such as usernames, groups, and sites.

    User's image

    For more details, you may refer to the following documentation

    https://learn.microsoft.com/en-us/graph/api/adminreportsettings-update?view=graph-rest-beta&tabs=http

    https://learn.microsoft.com/en-us/microsoft-365/admin/activity-reports/activity-reports?view=o365-worldwide&WT.mc_id=365AdminCSH_inproduct#show-user-details-in-the-reports

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.