Forum Discussion
PowerShell get-gateways always returns blank value
- 7 years ago
Hi Sam,
Since there isn't a REST API of gateways for Admin, I think you have gotten the expected result.
Best Regards,
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
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
- SamTrexler7 years ago
Helper IV
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,
- v-jiascu-msft7 years ago
Microsoft Employee
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- SamTrexler7 years ago
Helper IV
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.