Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I am attempting to use the Zero-Downtime-Capacity-Scale.ps1 script from the Power BI Powershell Samples repository, as described here. I have downloaded the script, obtained the Client ID, logged in to AzureRM, etc. as described in the script. And I am an owner of the resource to be scaled.
I had to change the RedirectUri because the new interface for app registritaions has changed how Redirect Uris are specified, and I got past that error.
Now when I run the script as instructed, it reports ">>> Capacity rivip01 is available and ready for scaling!" and then starts Step1.
It successfully creates the temporary capacity and asks for my login, which I provide. Then it throws an error:
Invoke-RestMethod : The remote server returned an error: (401) Unauthorized. At D:\RIVIP\BI-AdHoc\Refresh\ScaleNode\Zero-Downtime-Capacity-Scale_Opus.ps1:288 char:23 + ... itiesList = Invoke-RestMethod -Method Get -Headers $auth_header -Uri ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand GetCapacityObjectID : Capacity rivip01 object ID was not found! At D:\RIVIP\BI-AdHoc\Refresh\ScaleNode\Zero-Downtime-Capacity-Scale_Opus.ps1:289 char:31 + ... eCapacityObjectId = GetCapacityObjectID $capacitiesList $CapacityName + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,GetCapacityObjectID
The statement causing the error is:
$capacitiesList = Invoke-RestMethod -Method Get -Headers $auth_header -Uri $getCapacityUri
and $getCapacityUri looks correct: https://api.powerbi.com/v1.0/myorg/capacities
Can anyone show me how to run this script to scale the capacity? It does exactly what I need to accomplish, but I have not been able to get it to work yet.
Thanks,
Sam
Update: Since the script created the "temporary capacity" and then crashed before doing anything with it, the temporary capacity gets left out there in Azure with no workspaces assigned to it. So I manually deleted the capcities created during each of my tests.
However, that screwed up my refreshes - both the scheduled refreshes in one workspace, and the refreshes initiated from a PowerShell script in the other workspace began to fail either due to timeouts or due to the refresh taking more than 120 minutes. (Peviously they took just a few minutes.) This is really odd, because reading the code it sure looks like nothing was done yet to the contents of the workspaces.
So I have removed all of the workspaces from the A node capacity and paused the node, and am manually syncing the datasets in shared capacity to make sure the reports and datasets are okay. I'll use a different workspace for testing scaling, so it doesn't impact anyone else.
It looks like this isn't as simple as it sounds.
Any help on getting the authentication correct? Why am I getting an "Unauthorized" error when I am the owner of the resource?
Thanks,
Sam
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
4 | |
4 | |
4 | |
3 |