Change ownership of Fabric Warehouse
Applies to: ✅ Warehouse in Microsoft Fabric
The Warehouse item uses the owner's identity when accessing data on OneLake. To change the owner of these items, currently the solution method is to use an API call as described in this article.
This guide walks you through the steps to change your Warehouse owner to your Organizational account. The takeover APIs for each allow you to change this owner's identity to an SPN or other organization account (Microsoft Entra ID). For more information, see Microsoft Entra authentication as an alternative to SQL authentication in Microsoft Fabric.
The takeover API only works for Warehouse, not the SQL analytics endpoint.
Prerequisites
Before you begin, you need:
A Fabric workspace with an active capacity or trial capacity.
A Fabric warehouse on a Lakehouse.
Either be a member of the Administrator, Member, or Contributor roles on the workspace.
Install and import the Power BI PowerShell module, if not installed already. Open Windows PowerShell as an administrator in an internet-connected workstation and execute the following command:
Install-Module -Name MicrosoftPowerBIMgmt Import-Module MicrosoftPowerBIMgmt
Connect
- Open Windows PowerShell as an administrator.
- Connect to your Power BI Service:
Connect-PowerBIServiceAccount
Take ownership of Warehouse
- Navigate to the Warehouse item you want to change the owner in the workspace. Open the SQL Editor.
- Copy the URL from your browser and place a text editor for use later on.
- Copy the first GUID from the URL, for example,
11aaa111-a11a-1111-1aaa-aa111111aaa
. Don't include the/
characters. Store this in a text editor for use soon. - Copy the second GUID from the URL, for example,
11aaa111-a11a-1111-1aaa-aa111111aaa
. Don't include the/
characters. Store this in a text editor for use soon. - In the following script, replace
workspaceID
with the first GUID you copied. Run the following command.$workspaceID = 'workspaceID'
- In the following script, replace
warehouseID
with the second GUID you copied. Run the following command.$warehouseid = 'warehouseID'
- Run the following command:
$url = 'groups/' + $workspaceID + '/datawarehouses/' + $warehouseid + '/takeover'
- Run the following command:
Invoke-PowerBIRestMethod -Url $url -Method Post -Body ""
- Owner of the warehouse item has now changed.
Full script
# Install the Power BI PowerShell module if not already installed
Install-Module -Name MicrosoftPowerBIMgmt
# Import the Power BI PowerShell module
Import-Module MicrosoftPowerBIMgmt
# Fill the parameters
$workspaceID = 'workspaceID'
$warehouseid = 'warehouseID'
# Connect to the Power BI service
Connect-PowerBIServiceAccount
#Invoke warehouse takeover
$url = 'groups/' + $workspaceID + '/datawarehouses/' + $warehouseid + '/takeover'
Invoke-PowerBIRestMethod -Url $url -Method Post -Body ""