pnp/PnP

Get-PnPUnifiedAuditLog Exception

ngazou opened this issue · 0 comments

Hello,
I have an issue , when I am trying to retrieve the audit log from sharepoint by using Get-PnPUnifiedAuditLog

PowerShell code :

$SiteUrl = "https://MyTenant-admin.sharepoint.com"

$cnx = Connect-PnPOnlineWithDelegatedApp -SiteUrl $SiteUrl # connect with AAD app registration

$startDate = (Get-Date).AddDays(-1)
$endDate = (Get-Date)

$log = Get-PnPUnifiedAuditLog -StartTime $startDate -EndTime $endDate -ContentType SharePoint

Disconnect-PnPOnline

Exception

Get-PnPUnifiedAuditLog : Une exception de type 'PnP.PowerShell.Commands.Model.Teams.GraphException' a été levée.
Au caractère C:\transfert\script\KPMG.GEDLOOP.BackUpper\Main.PS1:19 : 8
+ $log = Get-PnPUnifiedAuditLog -StartTime $startDate -EndTime $endDate ...
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-PnPUnifiedAuditLog], GraphException
    + FullyQualifiedErrorId : PnP.PowerShell.Commands.Model.Teams.GraphException,PnP.PowerShell.Commands.ManagementApi.GetUnifiedAuditLog

image

AAD App Registration permissions

image

Used version of the PnP-PowerShell Cmdlets
PnP PowerShell for SharePoint Online

I need your help please.