microsoftgraph / microsoftgraph/msgraph-sdk-powershell
Get-MgBetaReportMicrosoft365CopilotUsageUserDetail Generates CSV with duplicate column
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 898
- Forks
- 230
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 31
Description
Describe the bug
Apart from not generating any useful informatiion at all, the Get-MgBetaReportMicrosoft365CopilotUsageUserDetail cmdlet includes two columns called copilotChatLastActivityDate:"". When data is retrieved (which I assume the cmdlet will one day), the resulting output cannot be loaded by the Import-CSV function because of the duplicate column (which also has a horrible name).
Expected behavior
I expect the cmdlet to return useful data in a form that means you don't need to edit the CSV file before it can be imported.
How to reproduce
Get-MgBetaReportMicrosoft365CopilotUsageUserDetail -Period 'D180' -OutFile c:\temp\Copilot.CSV
$Data = Import-CSV c:\temp\Copilot.CSV
Import-Csv: The member "copilotChatLastActivityDate:""" is already present.
SDK Version
V2.26
Latest version known to work for scenario above?
Never
Known Workarounds
Use the Graph API request
Debug output
Get-MgBetaReportMicrosoft365CopilotUsageUserDetail -Period 'D180' -OutFile c:\temp\Copilot3.csv -debug
DEBUG: [CmdletBeginProcessing]: - Get-MgBetaReportMicrosoft365CopilotUsageUserDetail begin processing with parameterSet 'Get'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [AccessReview.Read.All, Agreement.Read.All, Analytics.Read, APIConnectors.Read.All, Application.Read.All, Application.ReadWrite.All, AppRoleAssignment.ReadWrite.All, AuditLog.Read.All, AuditLogsQuery.Read.All, BackupRestore-Control.Read.All, Calendars.Read, Calendars.ReadWrite, Channel.ReadBasic.All, ChannelMessage.Read.All, ChannelMessage.ReadWrite, ChannelMessage.Send, ChannelSettings.Read.All, ChannelSettings.ReadWrite.All, Chat.Create, Chat.ManageDeletion.All, Chat.ReadWrite, Community.ReadWrite.All, Contacts.ReadWrite, CopilotSettings-LimitedMode.ReadWrite, CrossTenantUserProfileSharing.Read, CrossTenantUserProfileSharing.Read.All, DelegatedPermissionGrant.ReadWrite.All, DeviceManagementManagedDevices.Read.All, Directory.AccessAsUser.All, Directory.Read.All, Directory.ReadWrite.All, DirectoryRecommendations.Read.All, Domain.Read.All, eDiscovery.Read.All, email, EntitlementManagement.Read.All, Files.Read, Files.Read.All, Group.Read.All, Group.ReadWrite.All, GroupMember.Read.All, GroupMember.ReadWrite.All, IdentityProvider.Read.All, IdentityProvider.ReadWrite.All, IdentityRiskEvent.Read.All, IdentityRiskyUser.Read.All, IdentityRiskyUser.ReadWrite.All, IdentityUserFlow.Read.All, InformationProtectionPolicy.Read, Mail.Read, Mail.ReadWrite, Mail.Send, Mail.Send.Shared, MailboxSettings.ReadWrite, Notes.Create, OnlineMeetingArtifact.Read.All, OnlineMeetings.Read, OnPremDirectorySynchronization.ReadWrite.All, openid, Organization.Read.All, PeopleSettings.Read.All, PeopleSettings.ReadWrite.All, Place.Read.All, Policy.Read.All, Policy.Read.ConditionalAccess, Policy.Read.PermissionGrant, Policy.ReadWrite.ApplicationConfiguration, Policy.ReadWrite.AuthenticationMethod, Policy.ReadWrite.ConditionalAccess, POP.AccessAsUser.All, Presence.Read.All, PrivilegedAccess.Read.AzureAD, PrivilegedAccess.Read.AzureResources, profile, RecordsManagement.Read.All, Reports.Read.All, ReportSettings.ReadWrite.All, RoleAssignmentSchedule.Read.Directory, RoleAssignmentSchedule.ReadWrite.Directory, RoleEligibilitySchedule.Read.Directory, RoleEligibilitySchedule.ReadWrite.Directory, RoleEligibilitySchedule.Remove.Directory, RoleManagement.Read.All, RoleManagement.Read.Directory, RoleManagement.ReadWrite.Directory, SecurityActions.ReadWrite.All, SecurityEvents.Read.All, SecurityEvents.ReadWrite.All, ServiceHealth.Read.All, ServiceMessage.Read.All, SharePointTenantSettings.Read.All, SharePointTenantSettings.ReadWrite.All, Sites.FullControl.All, Sites.Manage.All, Sites.Read.All, Sites.ReadWrite.All, Tasks.Read, Tasks.ReadWrite, Team.ReadBasic.All, TeamMember.Read.All, TeamSettings.Read.All, TeamsTab.Read.All, TeamworkTag.ReadWrite, User.EnableDisableAccount.All, User.Read, User.Read.All, User.ReadBasic.All, User.ReadWrite, User.ReadWrite.All, UserActivity.ReadWrite.CreatedByApp, UserAuthenticationMethod.Read.All, UserAuthenticationMethod.ReadWrite.All, User-ConvertToInternal.ReadWrite.All, VirtualEvent.Read, WindowsUpdates.Read.All].
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://graph.microsoft.com/beta/reports/microsoft.graph.getMicrosoft365CopilotUsageUserDetail(period='D180')
Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; en-IE),PowerShell/7.5.0
SdkVersion : graph-powershell-beta/2.26.0
client-request-id : 972ddd4e-7425-4805-b346-c77070ba9f92
Accept-Encoding : gzip,deflate,br
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Cache-Control : no-store, no-cache, max-age=0, s-maxage=0, private
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 63cddaf5-4f05-4cc5-9061-d1e16a7a26c8
client-request-id : 972ddd4e-7425-4805-b346-c77070ba9f92
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"North Europe","Slice":"E","Ring":"4","ScaleUnit":"007","RoleInstance":"DU6PEPF000165C1"}}
Date : Fri, 21 Feb 2025 10:49:18 GMT
Body:
{
"value": [
{
"reportRefreshDate": "2025-02-17",
"userPrincipalName": "Sean.Landy@office365itpros.com",
"displayName": "Sean Landy",
"lastActivityDate": "2024-12-19",
"copilotChatLastActivityDate": "",
"microsoftTeamsCopilotLastActivityDate": "2024-12-19",
"wordCopilotLastActivityDate": "",
"excelCopilotLastActivityDate": "",
"powerPointCopilotLastActivityDate": "",
"outlookCopilotLastActivityDate": "",
"oneNoteCopilotLastActivityDate": "",
"loopCopilotLastActivityDate": "",
"copilotActivityUserDetailsByPeriod": [
{
"reportPeriod": 180
}
]
},
Configuration
No response
Other information
Notice that the debug output shows that data is downloaded but it never shows up in the output CSV
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Get-MgBetaReportMicrosoft365CopilotUsageUserDetail and reproduce the D180 request shown in the issue, comparing the Graph response with the generated CSV. Trace why the copilotChatLastActivityDate field is duplicated or malformed and verify that the downloaded data appears once per column and can be loaded by Import-Csv without editing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100