Applies to: ✅ Warehouse in Microsoft Fabric
This guide walks you through the steps to change the owner of a warehouse item in Microsoft Fabric.
The warehouse item uses the owner's identity when accessing data on OneLake. You can change the warehouse 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.
You can view the current owner of a warehouse item in the Fabric portal. The owner is listed in the workspace listing of items or in the Settings menu of the warehouse item.
The takeover API only works for warehouse items, not the SQL analytics endpoint.
Prerequisites
Before you begin, you need:
- A Fabric workspace with an active capacity or trial capacity.
- A Fabric warehouse item.
- Membership in the Administrator, Member, or Contributor roles on the workspace.
You can change the ownership to yourself (the user currently in context) by selecting the Take Over option directly in the user interface.
Important
The Take Over option currently only supports assigning ownership to the user in context (the currently signed-in user). It is not possible to set a Service Principal Name (SPN) as the owner via the Fabric portal. If you require an SPN to take ownership, use the PowerShell method to change ownership of a warehouse.
- Navigate to your warehouse in the Fabric portal.
- Open the Settings menu.
- Select the Take Over button.
Connect
- 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
- Open Windows PowerShell as an administrator.
- Use Connect-PowerBIServiceAccount to connect to Power BI PowerShell.
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. This is the workspace ID.
- 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. This is the warehouse ID.
- 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 ""
Related content