Forum Discussion
How to remove the Power BI gateway using PowerShell or REST API
Hi team
We are trying to delete Power BI gateway by using PowerShell module or REST API.
We tried to use DataGateway PowerShell module to get the gateway first and remove it using the comdlets below.
============================
============================
It works well with my Azure accounts without any issue.
However, if we use the service principal, even if the service principal has the admin access to the PowerBI gateway,
the cmdlet is still not able to get the gateway or remove it. And I am getting unauthoried error.
Is that because the Power BI powershell moduel does not support Service Principal authencation?
Is there anyway we could automate this process?
Thanks!
14 Replies
- lbendlinSuper User
Why would you want to automate that operation? You don't want to mess with a gateway configuration unless absolutely necessary. Removing a gateway cluster member should be done judiciously (and can be done via the admin center UI too).
- tousinnRegular Visitor
Hi lbendlin
This is a buiness requirement. We have one gateway for each customer and we would like to remove it once the customer is offboarded.
Yes, we noticed that the PowerShell cmdlet is able to remove the members
But we would like to remove the gateway itself as well, otherwise we will have heaps of gatway without being used anymore.
- lbendlinSuper User
If you must - there is a choreography to it.
1. List all gateways and all cluster members
2. Identify the anchor member
3. for each gateway, remove the members that are NOT the anchor
4. remove the anchor member.
Hint: The gatewayObjectId of the anchor member is the clusterObjectID
Note: This only removes the meta data on the Power BI Service. It does not do anything to your VMs.