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.
Hello Guys
I tried uploading paginated reports by powershell but I haven't find the right command to do it, I've used the following lines to upload datasets and reports but it doesnt work for uploading paginated reports.
$datasetsFilenames = Get-ChildItem "C:\Users\jose\Repos\PBI Reports\PaginatedReports\"
$clientsecret="xxxxxxx" | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList XXXXXXX, $clientSecret
Connect-PowerBIServiceAccount -ServicePrincipal -Credential $credential -TenantId XXXXXXX
foreach ($item in $datasetsFilenames) {
try {
#Call Powerbi APi for Create a Report
$Get = New-PowerBIReport -Path $item.FullName -WorkspaceId XXXXXXX
Write-Host $Get
}
catch [Exception] {
$ErrorMessage = $_.Exception.Message
Write-Host "The DataSets could not be uploaded. The error message was $ErrorMessage"`n -ForegroundColor Red
}
}
I've used the previous code to upload datasets and reports through the command " New-PowerBIReport -Path $item.FullName -WorkspaceId XXXXXXX" but I wasn't be able to do it for all my paginated reports.
Does anybody know it?
Regards.
If anything else fails you can always use the Invoke-RestMethod calls
$uri = “https://api.powerbi.com/v1.0/myorg/groups/{groupId}/imports?datasetDisplayName={datasetDisplayName}”
# issue the upload request
$FileUpload = Invoke-RestMethod -Uri $uri –Headers $authHeader –Method POST -body $body
etc.
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 |
---|---|
12 | |
2 | |
2 | |
1 | |
1 |