Power BI Gateway – How to remove a Gateway Instance from the Gateway Cluster
I recently was troubleshooting a performance issue for a customer where their LiveConnection was slow when connecting to an On-Premise SSAS Tabular server via the On-Premise Data Gateway.
One of the things that I had to do was to remove an existing On-Premise Data Gateway from a cluster, so that I can then move the Gateway onto another server.
NOTE: Even if you uninstall the On-Premise Data Gateway from a server it will still exist in the Cluster Configuration, so I had to ensure that I had it completely removed.
Whilst I was going through the steps I found that it was a bit of a challenge to complete the steps, so this inspired me to complete this blog post below. I do hope that in the future this could be part of the On-Premise Data Gateway.
I completed all the steps below using PowerShell, and whilst PowerShell might appear to be difficult, if you follow the steps below it should be straight forward (Hopefully my blog instructions are easy enough to follow!)
Running PowerShell Scripts
The first thing that I did was to run the PowerShell scripts where I have already installed the On-Premise Data Gateway. This is because the PowerShell scripts are part of the installation.
I opened PowerShell ISE and run it as Administrator
Importing the module
In PowerShell I then use the code below to navigate to the Data Gateway’s Folder
cd 'C:\Program Files\On-premises data gateway'
I then imported the module as shown below.
Import-Module .\OnPremisesDataGatewayHAMgmt.psm1
Logging into the Power BI Service
The next step I had to complete is to log into the Power BI Service, because this then enabled me to get the details which are part of my tenant.
Login-OnPremisesDataGateway -EmailAddress gilbert@mydomain.com
Getting all the Gateway Clusters
Next, I wanted to get a list of all the Gateway Clusters which are within my tenant.
NOTE: In a large organization there might be a lot of Gateway Clusters, so it might be better to export the data into a file if this is the case.
I then ran the following PowerShell script below to show me all the Gateway Clusters.
Get-OnPremisesDataGatewayClusters
And this was the output
Getting the Member Gateways inside a Specific Cluster
What I now recommend doing is to first find all the members of a specific Gateway cluster.
This ensures that not only do I have the current Gateway Cluster ID, but also ensures that I am only getting the members of the gateway where I want to remove a member.
As with my example above I put in the following into PowerShell
Get-OnPremisesDataClusterGateways -ClusterObjectId 9c9697b7-XXXX-XXXX-XXXX-b481de215945
The output was a list of the members that were part of my gateway as shown below.
I could then see above that I had 2 members in my Gateway Cluster.
The one thing that I did note is that the Primary Instance in the Gateway Cluster has the isAchorGateway = True
I wanted to remove the second member in the Gateway, so I made a note of the gatewayObjectId
Removing Member from Gateway Cluster
I then ran the following code in PowerShell below to remove the member from the Gateway Cluster
Remove-OnPremisesDataGateway -ClusterObjectId 9c9697b7-XXXX-XXXX-XXXX-b481de215945 -GatewayObjectID 3ed46c5d-XXXX-XXXX-XXXX-eb13b6c676d
Once the above was completed it came back to the PowerShell prompt.
Confirmation that I had removed the member from the Gateway Cluster
The final step I did was to confirm that I had removed the member from the Gateway Cluster.
I re-ran the PowerShell script which shows the members of the Gateway Cluster
Get-OnPremisesDataClusterGateways -ClusterObjectId 9c9697b7-XXXX-XXXX-XXXX-b481de215945
And now I got the output where only the Primary member in the instance remained
Conclusion
In the steps above I have shown how to remove a member from an instance of an On-Premise Data Gateway Cluster.
What I did then do with my customer was to move the Gateway Cluster over to a new dedicated Virtual machine, and I did this by installing the On-Premise Data Gateway software on a new server, and then migrated the On-Premise Data Gateway to the new dedicated virtual machine.
I always enjoy getting comments and suggestions from my blog posts, so please feel free to comment to suggest something.
Any handy Powershell nugget to get a list of data sources by gateway?
Hi there
You can use this to get all the data sources in an App Workspace
Which could then be nested in something that loops through all the App Workspaces
Admin – Datasets GetDatasourcesAsAdmin
Looks like won’t work on a Window 10 Pro machine because the Login-OnPremisesDataGateway command needs part of Internet Explorer that’s not there:
WARNING: The response content cannot be parsed because the Internet Explorer engine is not available, or Internet
Explorer’s first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again.
WARNING: Get email properties from global service failed, will use default environment.
That seems weird because it works for me?
FYI, I had to actually go to my c:\Program Files\Internet Explorer folder and open IE’s executable. Once IE opened up, I was able to run the login command in PowerShell. It is extremely ridiculous, that an MS tool PowerShell being used to log into an MS product for On-Premises Data Gateway on MS OS Windows 10 requires you to drill down and find their deprecated browser IE in order for the IE engine to start up and login script command to work. Even opening up IE, it says to try MS Edge. So backwards thinking.
Hi there Stephen,
Thanks for letting me know, that is really not intuitive that you had to do that.
Hopefully it gets better over time.
Hi,
I have the same issue when im trying to run “Login-OnPremisesDataGateway” ..
I think maybe i missed some steps cause it still does not work for me.
So run iexplore and then run the login command?
Any suggestions?
Give the run iexplore.exe and then try run the command
What error messages are you getting?
Also ensure that you have got the latest version of the PowerShell cmdlets installed and that they point to the same location?
Instead of the Import-Module I had to use the following command to get to the Gateways “Install-Module -Name OnPremisesDataGatewayHAMgmt”
Thanks for letting us know that the module name had changed.
Good stuff! Thanks for sharing.
Got rid of ghost gateways (introduced after May update).
It seems Powershell is not included in Microsoft’s OPDG installer so Import-Module does not work immediately. Install-Module will start a NuGet interaction to install the module.
That is good to know, thanks for letting me and the other readers know!
What if the Anchor Gateway is what I need to remove? Have it move to another one of the servers
Hi Kyle,
Yeah I think you would need to move over the main gateway and then you can remove it
How does one change the anchor gateway in a cluster?
Hi Jordan,
What I did after this was to then install a new gateway into a cluster and the first one would be the anchor.