Solved! Go to Solution.
Since there isn't a REST API of gateways for Admin, I think you have gotten the expected result.
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?
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.
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,
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.
@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.
@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?
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.
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?