So, I had been trying to build a dashboard and publish from, let's call it, PC#1. The dashboard being developed has SQL instance .\SQL2012, databasename "Test". Dashboard is built, tested, and we publish.
Of course, the web published version can't see PC#1\SQL2012, catalog "Test", and it gives me an error, saying the gateway doesn't have that path. Couldn't figure out any way to 're-key' the dashboard to the gateway.
But if I go to PC#2 (gateway), instance SQL2016, catalog "Production", and put Power BI desktop there, and publish from there, it gives me the option to add PC#2\SQL2016, catalog "Production" to the gateway server, and everything works.
But that means I have to do all of my dashboard development, testing, and publishing from my production database server??? That seems kind of crazy. What am I missing?
Solved! Go to Solution.
So here's basically how the gateways work, and why mine didn't work.
You develop in desktop by first connecting to a server, in my case on a different machine, on a different network, but reachable by an IP/port, e.g, 220.127.116.11,9999, database name, and SQL credentials.
When I tried to publish to a web server also hosting a gateway, PBI would give the gateway those credentials (18.104.22.168,9999, DB, and SQL credentials). however, due to the firewall port forwarding, the gateway couldn't connect locally to that SQL database.
BUT, when I used another machine as the gateway (foreign to the SQL server), where that connection string could work, when publishing, PBI sends the credentials to the gateway, gateway says, "sure, I can connect to that", and pop! Worked easily.
(I had also explicitly added those credentials in apps.powerbi.com as part of my debugging to make a new data source on that gateway, so that may be a necessary prerequisite).
I hope this helps somebody in the future.
The connection information used in your "Edit Queries" of your dataset must refer to the exact same path as what your gateway is going to use.
A common issue that arises when a person developes a solution on the same machine that hosts the data source is that often your stated Data Source path uses a local path address rather than an address that would be used by another machine.
For example, if you had a file on your hard drive, you might use the connection string "C:\Folder\File" where as an outside machine would use "\\Server\Folder\File"
My expectation is that you are having a similar issue with your SQL instance. In your case, i'd be expecting your "Servername" field may current contain something like "Localhost" rather than "ServerAB123"
Right, that's the exact problem, as far as I see it- that the development tool makes a literal connection string, and when the gateway runs on a different machine, the published page can't be converted to use the new data source. It seems to require that the desktop/dev environment run on the same machine as the gateway and SQL server.
To be clear, I want to develop dashboards for implementation using gateways on the customer premises (e.g., I'm not even on the network of the final gateway, so even using a UNC path to \\server\resource isn't helpful... ). It seems there should be some way to 're-key' the data source connection string after creating the dashboard, rather than it being hard-coded into the dashboard in Step One.
You don't have to run Power BI Desktop, Power BI gateway and SQL Server on a same machine. Just take the following points into consideration.
1. Make sure that you are able to access SQL Server database from the machines that installing Power BI Desktop and Power BI gateway. You can use SQL Server Management Studio to test the connection.
2. Ensure that the server name and database name you provide in Power BI Desktop and Power BI gateway are exact same, for more details, see https://docs.microsoft.com/en-us/power-bi/service-gateway-enterprise-manage-sql.
3. After adding SQL Server data source within Power BI gateway, you can modify the server name and database name in Power BI Desktop to match via Edit Queries->Data Source Settings-> Change data source option.
That still involves the customer exposing their SQL Server on the internet for Step 1 to be successful. Most IT folks are going to give live birth to a cow when I ask them to do that.
Since most IT environments have the server name as the machine name (e.g., "DELL89234\SQL2012"), Step 2 requires that I temporarily change my development machine name to match their server. That shouldn't be necessary either.
That being said, I did try this which SHOULD work, but doesn't (why?):
1. Publish and get error about gateway
2. Click link to "open PBIX on powerbi"
3. Open Datasets, select Dataset Settings for that published item.
4. Expand Gateway connection, see message "Not Configured Correctly"
5. Click right arrow, see connection string from old machine.
6. Click "Add to Gateway"
7. I am given the opportunity to put in new credentials for the gateway. Looks good so far. Put in good crednetials for gateway (same database, same data, I just backed up from dev machine and restored to gateway machine).
8. It accepts it but.. nothing happens.
9. Select Dataset->(Dataset name)->Refresh Now. Indicator on far right just spins and spins and spins.
10. Try to refresh the report... nothing. Tried re-opening the report. Nothing.
It's just stuck. It LOOKS like I was able to change the data source. It just doesn't work.
I tried to use your third step (Change Data Source) in desktop, that didn't seem to change it for the dashboard I was developing, but I went through the steps anyway, hoping it would add it to list for a new dashboard I could add. (Is that the intent? That we could use the gateway for a data connection to develop against?)
When I started a new dashboard, I was able to go to Get Data->Power BI Data Sets, and see a dataset from the failed publish (per the last post). I selected it and got the error below. It kept popping up the error no matter how many times I hit "cancel", so I had to hard kill the Power BI Desktop app process. So, that doesn't appear to be the right way either.
Feedback Type: Frown (Error) Error Message:
An error occurred while loading the model for the item or data source ''. Verify that the connection information is correct and that you have permissions to access the data source.
Does your dataset only contain SQL Server data source? Could you please share the data source settings in your PBIX file? Only when you add all the data sources within gateway, and the connection strings of the data sources are same in gateway and Power BI Desktop, you are able to use gateway to refresh the dataset.
In addition, do you connect to Power BI Service dataset in Power BI Desktop? Do you have appropriate permission on this dataset?
Lydia, thanks for responding. Yes, a SQL Server is the only kind of data source. When I started developing the dashboard, I connected to the local database, and then when I published it somewhat automatically found the gateway on the same machine I had set up. But if I develop on that machine (call it Machine A) with a copy (Copy A) of the database, I can't find a way to change the connection to an identical schema database (Copy B on Machine B). I went through the steps mentioned above, which would seem the way to do it, but it didn't work.
With respect to the data settings in the PBIX file, the data source settings in Power BI desktop (the 'development' environment) still show the local SQL server. The options just seem to be to set to another local machine- I tried putting in the IP address of a foreign SQL server that had port 1433 exposed (e.g., I can log in with 'sa' via SSMS), and it went to a second page asking for credentials, but when I put in the sa credentials, it said it couldn't log in (even though SSMS worked). Note that machine didn't have a gateway installed, I was just trying to go direct to its SQL server for design just like my local.
At first, it just said it couldn't log in, then when I tried again, it suggested to confirm it's set up for remote connections (it is).
Is there a special way to specify a known gateway when starting with "Get Data" in Dekstop?
Wait, I think I got it:
1. Get data
2. Enter database server IP and database name
3. Get to 2nd screen, SELECT "DATATBASE" ON LEFT SIDE, then put in sa or database credentials (this is what I missed! It was still on "Windows" on the left side.
4. Accept warning about encryption.
5. Connected! Woot woot!
Now the next step is to install gateway on that server, develop, publish, and see if it finds the gateway. Sounds like I'm on the right path?
But if there's a good way to connect to an existing gateway from desktop for the initial design phase, that would be even better.
Well, now I'm complete puzzled. I tried to duplicate my success to another machine, and no luck:
1. Set up firewall port to open port 9933 to SQL on Machine C.
2. Install on-premises (not personal) gateway on machine C, linked to my account, connect to that SQL instance with sa
3. On Machine A, test SSMS connection to Machine C on port 9933, success.
4. Open Power BI Desktop, log in with same account, connect to Machine C on port 9933
5. I can see my tables and data, all is good.
6. Build primitive test dashboard (one panel)
7. Publish.... this is usually where the system "automatically" finds the gateway... can't find gateway. ("publishing successful.. we were unable to find a gateway."
8. Went to Power BI (web interface), Manage Gateways, saw the the gateway didn't have any data sources assigned to it.
9. Set the SQL instance, database name, and sa credentials again. Set the public. Reported that connection was successful.
10. Saved Power BI Desktop as new name, tried to republish.
11. Same error as before.
How the system finds gateways is confusing and still a mystery to me.