Fabric Warehouse Ownership Takeover

As part of your project you have created and developed a Fabric Warehouse and now it is time to transfer the ownership of it away from your account to a production Service Principal Name or someone else in the organisation to maintain. There’s no simple method in the GUI so how do you do it?

You use the Takeover API.

Let’s go through the process step-by-step but beware, there is one caveat, you MUST have Admin, Member or Contributor access to the workspace that contains the warehouse in question.

Let’s get started.

Below you can see the example warehouse which has kindly been created by, and is therefore owned by, my colleague Majid.



First, click on the Warehouse in the browser so we can see its URL which will be formatted like this:

https://app.powerbi.com/groups/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/datawarehouses/ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ/dataView?experience=data-warehouse

Now, open Powershell and install the Power BI Management Module with the following commands:

>> Install-Module -Name MicrosoftPowerBIMgmt
>> Import-Module MicrosoftPowerBIMgmt

This will give the following prompt:

Agree to install it and wait for the confirmation, then connect using your account (remember, this needs to be an admin, contributor or member of the workspace in question). To do this run the following command:

>> Connect-PowerBIServiceAccount

This may trigger a login screen asking for username, password and MFA if configured, enter these to continue.

Now declare a few variables in the Powershell window by using the following commands (where XXX… and ZZZ… are the GUIDS from the warehouse URL in the first step)

>> $workspaceID = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
>> $warehouseID = 'ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ'
>> $url = '/groups/' + $workspaceID + '/datawarehouses/' + $warehouseid + '/takeover'

Now finally run the command to transfer the ownership to yourself:

>> Invoke-PowerBIRestMethod -Url $url -Method Post -Body ""

Et voila! I’m now the owner.



Something to bear in mind is that currently this method only works for Fabric Warehouses, not the SQL analytics endpoint, and transferring other Fabric artefacts such as Lakehouses can only be done by raising a support ticket with Microsoft. Hopefully this will change going forward.

Tags: , , ,