- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PowerShell get-gateways always returns blank value
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sam,
Since there isn't a REST API of gateways for Admin, I think you have gotten the expected result.
Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I faced with same issue. But I not clearly understand what is Power.BI.Global.Admin.
In my case I use service principal. But I could not find method to add SP to gateway admin list.
Could you please suggest how can I use service principal for that?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @SamTrexler,
What information would you like? Is it the information in power-bi/gateways/getdatasources? If so, you can use invoke-powerbirestmethod with the REST API.
Best Regards,
Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @v-jiascu-msft, thanks for the reply.
Yes, I want the data from the link you specified - as well as the information from its parent, the gateways.
I am using Invoke-PowerBIRestMethod successfully to retrieve workspaces, dashboards, dashboard tiles, reports, datasets, dataset gateways, dataset datasources and dataset refreshes. All of these invocations work correctly and return the data on my objects.
However, when I use "Invoke-PowerBIRestMethod -Url 'gateways' -Method Get" it returns an empty value - there are no gateways returned. So of course, that doesn't give me any gatewayids to use to get the datasources.
Funny thing is, when I use Invoke-PowerBIRestMethod where the Url contains "datasets/<datasetid>/gateways" I get the gateway each dataset connects to, and when I specify "datasets/<datasetid>/datasources" I get the datasource for each dataset.
But in this workspace those give me the same gateway on every dataset, and the same datasource on every dataset. What I want is a simple list of distinct gateways and distinct datasources, but those commands don't return anything.
By the way I am logging in as the Power BI Global Admin for the tenant, so all data should be available to me, correct?
Thanks,
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sam,
Since you have known the APIs and the PowerShell tool very well, I would suggest you check your account permission. Even the Global Admin can't access everything. You can log in to the PBI Service to see what you can see. Please refer to the snapshot below. It's easy and clear.
Best Regards,
Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @v-jiascu-msft,
I did as you suggested and ran very simple commands in a new Windows Powershell session. Here are the results. Apparently I can't get the gateways directly? Is there a permisiion I need, or something? Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @SamTrexler,
The cause isn't the permission. You definitely have the permission to get your gateways. I tried the same as yours and I got the expected result.
Can you check if you have any gateways installed? Please refer to the snapshot below.
Best Regards,
Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@v-jiascu-msft, thanks for the reply. It seems like you may be getting me closer. But I'm still not successful.
Here is the list of gateways when I connect to Power BI. and a second screenshot showing the gateway in use in the workspace I'm concerned with.
As I showed in my post on 1/11, when I specify the workspace Id and use "Default.DiscoverGateways, I can retrieve this gateway. But when I simply specify "gateways" as the Url, I get nothing.
By the way, I am the account that owns all of the gateways. But when I am running the powershell script I connect to Power BI as the Power BI global administrator in our tenant.
Why does it work when I "Discover" the gateways for a particular workspace, but not when I ask for the gateways?
Thanks again for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@v-jiascu-msft I think I have it solved. Tell me if this makes sense.
I tested connecting as "Power.BI.Global.Admin" and the "gateways" url returns nothing.
I tested connecting as myself and I get the list of five gateways.
I went to Manage Gateways and added "Power.BI.Global.Admin" as an Administrator of the one gateway I'm interested in right now.
I re-tested as "Power.BI.Global.Admin" and now I get the list of all five gateways.
I also get the list of datasources when I specify -url "gateways\<gatewayid>\datasources".
When I get the list of gateways, I get all five gateways - even though I only added this user as an administrator of one of the gateways.
Is this the right way to go about it - do I need to make the global admin account an administrator on at least one gateway?
And is it expected behavior that this would give me all five of the gateways?
Thanks,
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sam,
I'm glad you can make it work now.
I can't reproduce the same as your descriptions. My result always shows the gateways that the account has or the account has the administrator permission. If you can provide more details, I will test again.
Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It seems to be working correctly now. I don't know why I got all five gateways the first time, pobably a coding error on my part.
At this point I have it pretty well debugged. And I get every gateway in the tenant which has my connection account as an administrator.
Is that expected behavior?
Thanks,
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sam,
Since there isn't a REST API of gateways for Admin, I think you have gotten the expected result.
Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
07-04-2024 10:37 PM | |||
09-18-2024 06:29 AM | |||
08-26-2024 09:19 PM | |||
10-14-2024 03:28 PM | |||
08-08-2024 12:28 PM |
User | Count |
---|---|
11 | |
3 | |
3 | |
2 | |
2 |
User | Count |
---|---|
15 | |
6 | |
5 | |
3 | |
3 |