Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

log power bi with scheduled refresh

Hello, we have daily logs for our power bi capability. The refresh on demand appear correctly. We would like to display the scheduled refreshes. For that we use the SetScheduledRefresh command but it doesn't really work. Per day there are less than 5 lines that appear while hundreds of our reports refresh in a scheduled way. Do you have any ideas?

 

Thank you guys

2 REPLIES 2
ibarrau
Super User
Super User

Hi Charly. Have you tried getting the refresh history from the service with the Rest API?
https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/get-refresh-history-in-group

That might help to get that data.

Regards,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Anonymous
Not applicable

hi, we use this script with  "GetRefreshHistory"  but the scheduled refreshes do not go back in the log. see the screen

 

start-transcript -path "D:\Script PowerShell\MyOffice\audit\Power BI\mh.powerbi.auditdaemon\console.log"

#Requires -Modules "SecureCredentials"
#Requires -Modules "SharePointPnPPowerShellOnline"
Set-Location $PSScriptRoot
. .\Get-AuditLog.ps1
#################################### Configuration Section ###################################################
# $credsPath = "./credentials.txt"
$login = "svc_auditlog@b1envenue.onmicrosoft.com"
$password = Get-Content ".\password.txt" | ConvertTo-SecureString -Key (Get-Content ".\aes.key")
$UserCredential = new-object -typename System.Management.Automation.PSCredential -argumentlist $login,$password

#out-file -filepath ".\debug.txt" -inputobject "$login;$password" -append

$now = [DateTime]::Now
$logFolder = "Logs"
$logFile = "./$($logFolder)/Log_$($now.ToShortDateString().Replace('/','_')).txt"
#[DateTime]$start = "08/23/2022 00:00"
#[DateTime]$end = "08/24/2022 00:00"
$start = [DateTime]::Now.Date.AddDays(-1)
$end = [DateTime]::Now.Date
$outputFolder = "Exports"
$outputFile = "./$($outputFolder)/AuditRecords_$($start.ToShortDateString().Replace('/','_'))-$($end.ToShortDateString().Replace('/','_')).csv"
$record = "PowerBIAudit"
$Operations = @(
"AddGroupMembers",
"CreateApp","CreateDashboard","CreateDataflow","CreateDataset","CreateFolder","CreateGroup","CreateReport",
"CreateDatasetFromExternalApplication","TakeOverDataset",
"DownloadReport",
"EditDataset","EditReport","ExportDataflow","ExportReport",
"Importer","InstallApp",
"PublishToWebReport",
"RenameDashboard",
"RefreshDataset",
"SetScheduledRefreshOnDataflow","SetScheduledRefresh","RequestDataflowRefresh",
"ShareDashboard","ShareReport",
"OptInForProTrial",
"UpdateApp",
"ViewDashboard","ViewReport",
"AssignWorkspaceToPipeline", "CancelDataflowRefresh", "CopyDashboard", "CopyReport", "CreateGoal", "CreateGoalValue", "CreateScorecard", "CreateAlmPipeline", "CreateDatasetFromExternalApplication", "CreateReport 1", "CreateTemplateApp", "CreateTemplateApp", "DeleteAlmPipeline", "DeleteDatasetFromExternalApplication", "DeleteDatasetRows", "DeleteGoal", "DeleteGoal", "DeleteNote", "DeleteScorecard", "DeleteTemplateApp", "DeployAlmPipeline", "EditDatasetFromExternalApplication", "PatchGoal", "PatchGoalValue", "PatchNote", "PatchScorecard", "PublishToWebReport 2", "UnassignWorkspaceFromPipeline", "RefreshDatasetFromExternalApplication", "GetGoal", "GetGoalValues", "GetScorecards", "GetGoal", "GetGoalValue", "GetRefreshHistory", "GetScorecard", "GetScorecardByReportId", "ShareDataset", "TookOverDataflow", "UpdateAlmPipelineAccess", "SetConfigurationAlmPipeline", "UpdateWorkspace", "UpdateWorkspaceAccess"
)
$resultSize = 5000 #100 modifié GPR 25/08/2022
$intervalMinutes = 1440
$retryCount = 3
$SharepointSiteUrl = "*****"
$Folder = "Documents partages/00_REALISATION/Datavista/Utilisation/02_Data/Log PBI"
#$UserCredential = Get-SecureCredentials -Path $credsPath
##debug
#out-file -filepath ".\debug.txt" -inputobject "$outputFile;$UserCredential" -append
#################################### End Configuration Section ###################################################

## Create Log & Exports Folder ##
New-Item -Name $logFolder -ItemType Directory -Force > $null
New-Item -Name $outputFolder -ItemType Directory -Force > $null

## Get-AuditLog ##
Remove-Item -Path $outputFile -Force -ErrorAction SilentlyContinue
Get-AuditLog -logFile $logFile -outputFile $outputFile -start $start -end $end -record $record -Operations $Operations -resultSize $resultSize -intervalMinutes $intervalMinutes -retryCount $retryCount -UserCredential $UserCredential

## Upload export file to SP ##
Connect-PnPOnline -Url $SharepointSiteUrl -Credential $UserCredential
Add-PnPFile -Path $outputFile -Folder $Folder
Disconnect-PnPOnline

stop-transcript

 

(I specify that the refresh that appears is a refresh on request)

charlyMH_0-1661846179435.png

 

charlyMH_1-1661846229674.png

 

Thank guys !

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors