<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: BindToGateway Powershell REST API POST failing - Need Help in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/852851#M21503</link>
    <description>&lt;P&gt;I have found the reasons why this wasnt working so thought I would list them here for future users. To get this to work there are a few things to be aware of:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. If the datasource is not assigned to a gateway you need to not include the datasource ID values (you wont actually be able to get these ID values if it is unassigned). I assume the ability to specify the data source id values is only relevent when the dataset is already assigned to a gateway, but I dont know if you can use two separate gateways for one dataset with two datasources.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Service principals cant be set to administrators of gateways, so you cant use them&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Users must be set as administrators of gateways&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4. The user must be assigned as a user of the data source defined on the gateway (different from being a gateway admin)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With all this set up properly it works like a charm &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Nov 2019 09:10:28 GMT</pubDate>
    <dc:creator>dom99</dc:creator>
    <dc:date>2019-11-21T09:10:28Z</dc:date>
    <item>
      <title>BindToGateway Powershell REST API POST failing - Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/847527#M21418</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I am struggling to get the BindToGateway REST API call to work in powershell&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/bindtogatewayingroup" target="_blank" rel="noopener"&gt;https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/bindtogatewayingroup&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my code for doing the API call&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Invoke-PowerBiRestMethod -Url "groups/$($workspaceid)/datasets/$($datasetid)/Default.BindToGateway" -Method POST -Body $jsonPostBody&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The workspace and dataset varibales are correct, and the Body is in the format:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
"datasourceObjectIds": [
"dc2f2dac-e5e2-4v37-af76-2a0bc10f1bs5",
"3bfe5d33-ag7d-4d24-b0b5-e2b96eb01cf5"
] ,
"gatewayObjectId": "1f85e798-5852-4fdd-ab01-33cc14b6e934"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;When I run this as a user who is an administrator on the gateway I get the error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Response status code does not indicate success: 404 (Not Found).

StackTrace : at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.&amp;lt;INVOKERESTMETHOD&amp;gt;d__31.MoveNext()
Exception : System.Net.Http.HttpRequestException
InvocationInfo : {Invoke-PowerBIRestMethod}
Line : Invoke-PowerBiRestMethod -Url $url -Method POST -Body $jsonPostBody
Position : At line:1 char:1
+ Invoke-PowerBiRestMethod -Url $url -Method POST -Body $jsonPostBody
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When I run it as a service principal with all deletgated API permissions and an admin on the workspace and dataset owner I get the following error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Message: Response status code does not indicate success: 400 (Bad Request).

StackTrace : at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.&amp;lt;INVOKERESTMETHOD&amp;gt;d__31.MoveNext()
Exception : System.Net.Http.HttpRequestException
InvocationInfo : {Invoke-PowerBIRestMethod}
Line : Invoke-PowerBiRestMethod -Url $url -Method POST -Body $jsonPostBody
Position : At line:1 char:1
+ Invoke-PowerBiRestMethod -Url $url -Method POST -Body $jsonPostBody
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;So one gives me a 400 and the other a 404 error with no further usfull info which I can see.&lt;BR /&gt;&lt;BR /&gt;Can anyone offer any suggestions?&amp;amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Dominic&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 14:44:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/847527#M21418</guid>
      <dc:creator>dom99</dc:creator>
      <dc:date>2020-09-15T14:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: BindToGateway Powershell REST API POST failing - Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/848225#M21437</link>
      <description>Anyone able to get this API working at all?</description>
      <pubDate>Sun, 17 Nov 2019 16:58:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/848225#M21437</guid>
      <dc:creator>dom99</dc:creator>
      <dc:date>2019-11-17T16:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: BindToGateway Powershell REST API POST failing - Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/852851#M21503</link>
      <description>&lt;P&gt;I have found the reasons why this wasnt working so thought I would list them here for future users. To get this to work there are a few things to be aware of:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. If the datasource is not assigned to a gateway you need to not include the datasource ID values (you wont actually be able to get these ID values if it is unassigned). I assume the ability to specify the data source id values is only relevent when the dataset is already assigned to a gateway, but I dont know if you can use two separate gateways for one dataset with two datasources.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Service principals cant be set to administrators of gateways, so you cant use them&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Users must be set as administrators of gateways&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4. The user must be assigned as a user of the data source defined on the gateway (different from being a gateway admin)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With all this set up properly it works like a charm &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 09:10:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/852851#M21503</guid>
      <dc:creator>dom99</dc:creator>
      <dc:date>2019-11-21T09:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: BindToGateway Powershell REST API POST failing - Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/1005492#M22928</link>
      <description>&lt;P&gt;Dom99... I am also facing with the same issue.&lt;/P&gt;&lt;P&gt;Are you saying that with a Service principal we cannot achive this?&lt;/P&gt;&lt;P&gt;if it can be achieved can you provide more details.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 19:22:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/1005492#M22928</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-02T19:22:41Z</dc:date>
    </item>
    <item>
      <title>eN: BindToGateway Powershell REST API POST failing - Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/1327083#M25465</link>
      <description>&lt;P&gt;Is someone able to pick the DSN attached to the gateway via an API or Powershell?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 14:11:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/1327083#M25465</guid>
      <dc:creator>ilav</dc:creator>
      <dc:date>2020-08-27T14:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: BindToGateway Powershell REST API POST failing - Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/1372294#M25716</link>
      <description>&lt;P&gt;&amp;nbsp;How did you manage to bind gateway with service principal?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 14:23:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/1372294#M25716</guid>
      <dc:creator>RakeshSinghr</dc:creator>
      <dc:date>2020-09-15T14:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: BindToGateway Powershell REST API POST failing - Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/1372361#M25717</link>
      <description>&lt;P&gt;I didnt, it wasnt possible for reasons listed in the solution.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I'm aware it is still not possible, if you want to do this you will need to bind it as a user with a pro license who is an administrator of the gateway, and point number 4 listed in the solution&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 14:46:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/1372361#M25717</guid>
      <dc:creator>dom99</dc:creator>
      <dc:date>2020-09-15T14:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: BindToGateway Powershell REST API POST failing - Need Help</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/1372518#M25720</link>
      <description>&lt;P&gt;Its quite shocking to know such simple operation is not yet possible. Did you manage to raise a ticket with microsoft to be told this is not currently possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1)&amp;nbsp;Have you been able to add App id to gateway datasource users -&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/rest/api/power-bi/gateways/adddatasourceuser" target="_blank" rel="noopener"&gt;https://docs.microsoft.com/en-us/rest/api/power-bi/gateways/adddatasourceuser&lt;/A&gt;&amp;nbsp;- there's an example with app id. Perhaps once&amp;nbsp; Added binding might work?&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/MicrosoftDocs/powerbi-docs/issues/1198" target="_blank" rel="noopener"&gt;https://github.com/MicrosoftDocs/powerbi-docs/issues/1198&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) I guess its still not possible to add app id as an admin to gateway?&lt;/P&gt;&lt;P&gt;I'm able to&amp;nbsp;&lt;SPAN&gt;Connect-DataGatewayServiceAccount&amp;nbsp;-ApplicationId&amp;nbsp;$ApplicationId&amp;nbsp;-ClientSecret&amp;nbsp;$securePassword&amp;nbsp;&amp;nbsp;-Tenant&amp;nbsp;$Tenantid&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but after this step non of the gateway commandlets return anything. Ex:&amp;nbsp;Get-DataGatewayCluster&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;any success with that?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Using a user account with pro license for automated deployment is not ideal&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 15:19:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/BindToGateway-Powershell-REST-API-POST-failing-Need-Help/m-p/1372518#M25720</guid>
      <dc:creator>RakeshSinghr</dc:creator>
      <dc:date>2020-09-15T15:19:36Z</dc:date>
    </item>
  </channel>
</rss>

