Microsoft Fabric, taking over orphaned deployment pipelines

Last week, we ran into an issue where deployment pipelines are owned by a person who no longer works for our organisation. This meant we could not access the deployment pipelines owned by this account.

API

The way to recover them is to use API’s. At first, we all thought that using the Fabric API’s would work, but they didn’t. After asking around, we found out that we should use the Power BI API’s.

Now, I’m guessing you’re here because you ran into the same issue. So let me just show you the few lines of code necessary to make sure you own the pipelines again. You can also assign them to service principals or groups if you want to. In this example, I chose to take ownership myself.


$tenantid = '[Your Tenant ID]'
Connect-AzAccount -TenantId $tenantid 
$userToken = (Get-AzAccessToken -ResourceUrl "https://analysis.windows.net/powerbi/api").Token
$regular = ConvertFrom-SecureString $userToken
$userHeaders = @{ 'Authorization' = "Bearer $regular" } 
$pipelines = Invoke-RestMethod -Uri "https://api.powerbi.com/v1.0/myorg/admin/pipelines" -Method Get -Headers $userHeaders
$pipelines.Value
$body = @{
  identifier = "[Your identifier Email]"
  PipelineUserAccessRight = "Admin"
  principalType = "User"
}
foreach ($pipeline in $pipelines.Value)
{
	$id = $pipeline.id
   Invoke-RestMethod -Uri "https://api.powerbi.com/v1.0/myorg/admin/pipelines/$id/users" -Method Post -Headers $userHeaders -body $body
}


And with this code, you have access again.

Link to getting the pipelines
Link to the ownership options

Thanks for reading. I hope this helped!

Leave a comment