Tuesday 6 December 2022

How to Install the Power BI On-Premises Data Gateway to Windows Server Core, aka Windows Server without the Desktop Experience

The On-premises data gateway is not supported on Windows Server Core, and although it's worked well for me, it's unsupported and Premier Support may not be able to assist. This guide is intended for people who need to deploy a data gateway but are in the unfortunate situation of having installed the Server Core operating system.

It is possible to install the On-premises data gateway to Server Core via PowerShell scripts (the Add Gateway command), however it isn't currently possible to restore a gateway or add it to an existing cluster using the modules. 

The configuration tool appears to be the only way to do this, but the login process errors when attempting to sign-in to the configuration app for the On-premises data gateway. 

To successfully install and configure an On-premises data gateway on Windows Server Core (tested on Windows Server Core 2016 and 2022) follow the below steps.

1. Install Microsoft .Net 4.8 Runtime and Microsoft .NET 4.8.1 Runtime (both using the /q command line switch for quiet install, use taskmgr to see installation activity for the TiWorker processes. The .NET 4.8.1 installer does a server reboot). 

2. Install Microsoft Edge Enterprise x64 using the standard 64-bit MSI installer

3. Install the On-premises data gateway using the standard installer here. Using Windows Server 2016 it installed without issues, with Windows Server 2022 I needed to use the "-quiet" command line switch.

4. In command line, cd to "C:\Program Files\On-premises data gateway" and run EnterpriseGatewayConfigurator.exe - it should open as usual.

 


5. Enter the email to register the data gateway against and select Sign in options, then Sign in with my default browser.

Do not select Sign in yet, otherwise the below screen will appear stating Class not registered

 


This is caused by Server Core not having the default protocol handler for the https protocol, at least I wasn't able to get this to function. The login process tries to call the https://login.microsoftonline.com/... address directly from the command prompt, giving the above error.

6. Copy Procmon64.exe (Process Monitor from SysInternals / Microsoft) to the folder "C:\Program Files\On-premises data gateway" and rename it to cmd.exe

7. Start Process Monitor, for example by running C:\Program Files\On-premises data gateway\cmd.exe (so it starts logging activity).

8. Add a Filter in Process Monitor where Process Name is EnterpriseGatewayConfigurator.exe 

 


Note that the next few steps should be followed quickly afterwards, as Process Monitor is a heavy logging tool and leaving it running is likely to bring a server down.

9. Click Sign in on the On-premises data gateway configurator. It will try to launch the above cmd process using the cmd.exe found in it's local folder (actually Process Monitor) and give the error.

An error dialog will appear with the message with text Process Monitor: Invalid argument: /c. Do not close this. 

 

The configuration app is still active and spinning in the background, waiting for a successful login. The following steps workaround the login issues, and provide the login token to allow the Configuration Manager to successfully login.

10. Switch to the copy of Process Monitor started in step 7 that is logging activity.

11. Search for "login.microsoftonline" and find the "Process Create" row for our dummy cmd.exe. Double-click this row.

 


12. Copy the Command line: value from the dialog that appears, and paste this into a text editor. 

13. Remove the text before the "https://" ("C:\Program Files\On-premises data gateway\cmd.exe" /c start" ) and replace "^&" with "&" to remove the "^" carets.

This should give you a URL similar to the below, but where the xxxx's have actual guids.

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?scope=https%3A%2F%2Fanalysis.windows.net%2Fpowerbi%2Fapi%2Fuser_impersonation+openid+profile+offline_access&response_type=code&client_id=xxxxxxxxxxxx&redirect_uri=http%3A%2F%2Flocalhost%3A49930&client-request-id=xxxxxxxxxxxxxxxxxx&x-client-SKU=MSAL.Desktop&x-client-Ver=4.46.0.0&x-client-CPU=x64&x-client-OS=Windows+Server+2022+Standard+Evaluation&prompt=select_account&code_challenge=xxxxxxxxxxxxx&code_challenge_method=S256&state=xxxxxxxxxxxxx&client_info=1

14. Close the active Process Monitor we copied this text from. Do not close the error message from step 9.

15. Paste and navigate to this URL in a web browser on any computer, and complete the login using the Microsoft account you intend to register the gateway against.

16. After signing in you will be greeted with an error page at a URL with a start similar to "https://localhost:xxxx/?code=..." - this is expected, copy this address.

17. On your Windows Server Core server, open Edge (by default this installs to C:\Program files (x86)\Microsoft\Edge\Application\msedge.exe), and paste and navigate to the URL.

You should be greeted with a page saying "Authentication complete. You can return to the application. Feel free to close this browser tab.". 



 

Close the browser, and return to the On-premises data gateway configurator. It should be successfully logged in. Continue to manage the gateway.

 


You will need to follow these steps to login every time you want to login to the gateway configurator, however this is not required for version updates or uninstalling the gateway components on a Server Core system.