Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
$activities = Get-PowerBIActivityEvent -StartDateTime '2021-04-08T07:00:00:000' -EndDateTime '2021-04-08T10:59:59:999' | ConvertFrom-Json
Error message:
Get-PowerBIActivityEvent : String was not recognized as a valid DateTime.
At line:1 char:15
+ ... ctivities = Get-PowerBIActivityEvent -StartDateTime '2021-04-08T07:00 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (2021-04-08T07:00:00:000:String) [Get-PowerBIActivityEvent], FormatException
+ FullyQualifiedErrorId : StartDateTime is not a valid DateTime.,Microsoft.PowerBI.Commands.Admin.GetPowerBIActivityEvent
My Attempts to resolve:
1)
$activities = Get-PowerBIActivityEvent -StartDateTime '2021-04-08T07:00:00:000' -EndDateTime '2021-04-08T10:59:59:999' | ConvertFrom-Json | Out-File -FilePath C:\MyAuditLog
2) $activities = Get-PowerBIActivityEvent -StartDateTime '2021-04-08T07:00:00+0000' -EndDateTime '2021-04-08T10:59:59+0000' | ConvertFrom-Json | Out-File -FilePath E:\AuditLogs
Both attempts produce write errors and and the same 'Bad request'
Please can anyone help?
Solved! Go to Solution.
Hi @chiamaka ,
This datetime format is not supported, please try the code below.
Get-PowerBIActivityEvent (MicrosoftPowerBIMgmt.Admin) | Microsoft Docs
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Got it working now - I used below:
#Install-Module -Name MicrosoftPowerBIMgmt -Force
$StartDateToExtract = '2021-04-08T00:00:00'
$EndDateToExtract = '2021-04-08T23:59:59'
$activities = Get-PowerBIActivityEvent -StartDateTime $StartDateToExtract -EndDateTime $EndDateToExtract |ConvertFrom-JSON
#$activities.count
$activities | Select Id, RecordType, CreationTime, Operation, OrganisationId, UserType, Workload, UserId, ClientIP, userAgent, Activity,
ItemName, WorkspaceName, DatasetName, ReportName,
CapacityId, CapacityName, WorkspaceId, AppName, ObjectId, DatasetId, ReportId, IsSuccess,
ReportType, RequestId, ActivityId, AppReportId, DistributionMethod, ConsumptionMethod | Export-Csv -Path $activityLogOutput -NoTypeInformation
Hi @chiamaka ,
This datetime format is not supported, please try the code below.
Get-PowerBIActivityEvent (MicrosoftPowerBIMgmt.Admin) | Microsoft Docs
Best regards,
Lionel Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
13 | |
2 | |
2 | |
1 | |
1 |
User | Count |
---|---|
20 | |
3 | |
2 | |
2 | |
2 |