<?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 Power BI API - Patch Import Azure SQL DB Datasource with Windows credentials in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-API-Patch-Import-Azure-SQL-DB-Datasource-with-Windows/m-p/394487#M11761</link>
    <description>&lt;P&gt;We are integrating Power BI Embedded within our SAAS application with the need to deploy reports through different environments (Development, System Test, Production) without user intervention. I have successfully been able to import reports, update the datasource on a report dataset to change the server/database (as each of our environments user a different database on the same server) and have also been successful in using the Gateway API to PATCH the credentials using the Basic credential type when using a SQL account that is set up on the database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been unable to do the patch using the Windows credential type. I used the Gateway API call from this doc: &lt;A href="https://msdn.microsoft.com/en-us/library/mt784645.aspx" target="_self"&gt;Patch data source (gateways)&lt;/A&gt;&amp;nbsp;to get the Basic auth working and it states that the Windows credential type should be sent the same way. However, I get the following error back, using fiddler, to the call when using Windows as the credentialType:&lt;/P&gt;&lt;P&gt;{"error":{"code":"DMTS_InvalidCredentialTypeError","pbi.error":{"code":"DMTS_InvalidCredentialTypeError","parameters":{},"details":[],"exceptionCulprit":1}}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code used to patch the datasource:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim jsonDelta As String = "{""credentialDetails"":{""credentials"":""{\""credentialData\"":[{\""name\"":\""username\"",\""value\"":\""{removed}.onmicrosoft.com\""},{\""name\"":\""password\"",\""value\"":\""{removed}""}]}"",""credentialType"":""Windows"",""encryptedConnection"":""Encrypted"",""privacyLevel"":""None"",""encryptionAlgorithm"":""none""}}"

        Dim patchRequestBody As HttpContent = New StringContent(jsonDelta)
        patchRequestBody.Headers.ContentType = New MediaTypeWithQualityHeaderValue("application/json")
        Dim method = New HttpMethod("PATCH")
        Dim requestCred = New HttpRequestMessage(method, restUrlPatchCredentials)
        requestCred.Content = patchRequestBody

        Dim client As HttpClient = New HttpClient()
        client.DefaultRequestHeaders.Add("Accept", "application/json")
        client.DefaultRequestHeaders.Add("Authorization", "Bearer " &amp;amp; accessToken)
        client.SendAsync(requestCred)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I said, I used this same code but credentialType Basic and the UN/PW of a valid SQL user and was able to successfully patch the datasource.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also see the same error when using the Power BI Service and trying to edit the credentials on the Workspace &amp;gt; Settings &amp;gt; Datasets &amp;gt; {DataSet Name} &amp;gt; Data source credentials and selecting Windows as the Authentication method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Windows user I am trying to patch the dataset with is an AAD user and is also part of a group with rights to login to the SQL database I am trying to connect to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone been able to patch an Import mode dataset with Windows credentials through the API? Could this be a permission issue on the Azure SQL DB?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All of the examples and articles I've seen have used the Basic auth type but we would like to leverage existing users in AAD without the need to add SQL users to each database everytime we add a new client.&lt;/P&gt;</description>
    <pubDate>Wed, 11 Apr 2018 20:12:53 GMT</pubDate>
    <dc:creator>lapora1976</dc:creator>
    <dc:date>2018-04-11T20:12:53Z</dc:date>
    <item>
      <title>Power BI API - Patch Import Azure SQL DB Datasource with Windows credentials</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-API-Patch-Import-Azure-SQL-DB-Datasource-with-Windows/m-p/394487#M11761</link>
      <description>&lt;P&gt;We are integrating Power BI Embedded within our SAAS application with the need to deploy reports through different environments (Development, System Test, Production) without user intervention. I have successfully been able to import reports, update the datasource on a report dataset to change the server/database (as each of our environments user a different database on the same server) and have also been successful in using the Gateway API to PATCH the credentials using the Basic credential type when using a SQL account that is set up on the database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been unable to do the patch using the Windows credential type. I used the Gateway API call from this doc: &lt;A href="https://msdn.microsoft.com/en-us/library/mt784645.aspx" target="_self"&gt;Patch data source (gateways)&lt;/A&gt;&amp;nbsp;to get the Basic auth working and it states that the Windows credential type should be sent the same way. However, I get the following error back, using fiddler, to the call when using Windows as the credentialType:&lt;/P&gt;&lt;P&gt;{"error":{"code":"DMTS_InvalidCredentialTypeError","pbi.error":{"code":"DMTS_InvalidCredentialTypeError","parameters":{},"details":[],"exceptionCulprit":1}}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code used to patch the datasource:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim jsonDelta As String = "{""credentialDetails"":{""credentials"":""{\""credentialData\"":[{\""name\"":\""username\"",\""value\"":\""{removed}.onmicrosoft.com\""},{\""name\"":\""password\"",\""value\"":\""{removed}""}]}"",""credentialType"":""Windows"",""encryptedConnection"":""Encrypted"",""privacyLevel"":""None"",""encryptionAlgorithm"":""none""}}"

        Dim patchRequestBody As HttpContent = New StringContent(jsonDelta)
        patchRequestBody.Headers.ContentType = New MediaTypeWithQualityHeaderValue("application/json")
        Dim method = New HttpMethod("PATCH")
        Dim requestCred = New HttpRequestMessage(method, restUrlPatchCredentials)
        requestCred.Content = patchRequestBody

        Dim client As HttpClient = New HttpClient()
        client.DefaultRequestHeaders.Add("Accept", "application/json")
        client.DefaultRequestHeaders.Add("Authorization", "Bearer " &amp;amp; accessToken)
        client.SendAsync(requestCred)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I said, I used this same code but credentialType Basic and the UN/PW of a valid SQL user and was able to successfully patch the datasource.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also see the same error when using the Power BI Service and trying to edit the credentials on the Workspace &amp;gt; Settings &amp;gt; Datasets &amp;gt; {DataSet Name} &amp;gt; Data source credentials and selecting Windows as the Authentication method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Windows user I am trying to patch the dataset with is an AAD user and is also part of a group with rights to login to the SQL database I am trying to connect to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone been able to patch an Import mode dataset with Windows credentials through the API? Could this be a permission issue on the Azure SQL DB?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All of the examples and articles I've seen have used the Basic auth type but we would like to leverage existing users in AAD without the need to add SQL users to each database everytime we add a new client.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 20:12:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-API-Patch-Import-Azure-SQL-DB-Datasource-with-Windows/m-p/394487#M11761</guid>
      <dc:creator>lapora1976</dc:creator>
      <dc:date>2018-04-11T20:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI API - Patch Import Azure SQL DB Datasource with Windows credentials</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-API-Patch-Import-Azure-SQL-DB-Datasource-with-Windows/m-p/394964#M11763</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the issue here should be related to Permissions (credential type) under the Azure SQL Database.&lt;/P&gt;&lt;P&gt;Azure SQL Database only supports &lt;SPAN&gt;two types of authentication:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&lt;STRONG&gt;SQL Authentication&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;&lt;STRONG&gt;Azure Active Directory Authentication,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;and AAD authentication supports&amp;nbsp;the following methods of connecting to a database using Azure AD identities:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Using &lt;STRONG&gt;integrated&lt;/STRONG&gt; Windows authentication&lt;/LI&gt;&lt;LI&gt;Using an Azure AD principal name and a password&lt;/LI&gt;&lt;LI&gt;Using Application token authentication&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;For more details about how to configure the AAD Authentication, please check:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/azure/sql-database/sql-database-control-access" target="_self"&gt;Azure SQL Database access control&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/azure/sql-database/sql-database-aad-authentication" target="_self"&gt;Use Azure Activa Directory Authentication for authentication with SQL Database, Managed instance, or SQL Data Warehouse&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/azure/sql-database/sql-database-aad-authentication-configure" target="_self"&gt;How to configure&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the supported credential type for the Power BI API patch is:&lt;/P&gt;&lt;PRE&gt;"Basic|Windows|Anonymous|OAuth|Key"&lt;/PRE&gt;&lt;P&gt;There is no Azure Active Directory Authentication listed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 09:12:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-API-Patch-Import-Azure-SQL-DB-Datasource-with-Windows/m-p/394964#M11763</guid>
      <dc:creator>v-micsh-msft</dc:creator>
      <dc:date>2018-04-12T09:12:25Z</dc:date>
    </item>
  </channel>
</rss>

