<?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 Update Password in DataConnections automatically in Management &amp; Governance</title>
    <link>https://community.qlik.com/t5/Management-Governance/Update-Password-in-DataConnections-automatically/m-p/104503#M1689</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good morning Qlik-Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when adding a Data Connection in Qlik Sense you can use User + Password credentials to validate your access to f.e. a database. We have a customer where this login changes regularly. At the moment we have to change the Data Connection every time the account. To handle such things fully automatically I wanted to change the Login-Credentials in the Repository Database of Qlik Sense. So I checked the DataConnection-Table and found:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="DataConnecitons_1.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/212902_DataConnecitons_1.png" style="height: 286px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I tried replacing Username and PasswordString. The problem here is that the password is stored encrypted and I have no clue how it's encrypted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15363009353188138 jive_text_macro" jivemacro_uid="_15363009353188138" modifiedtitle="true"&gt;
&lt;P&gt;Update "DataConnections"&lt;/P&gt;
&lt;P&gt;SET "Username" = 'username', "PasswordString" = 'unencryptedtext'&lt;/P&gt;
&lt;P&gt;where &amp;lt;somecondition&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How is the password encrypted in the repository database? How does Qlik Sense edit the password, when I change the credentials inside the Data Connection in Qlik Sense?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best greetings.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Sep 2018 06:19:59 GMT</pubDate>
    <dc:creator>chrislemm</dc:creator>
    <dc:date>2018-09-07T06:19:59Z</dc:date>
    <item>
      <title>Update Password in DataConnections automatically</title>
      <link>https://community.qlik.com/t5/Management-Governance/Update-Password-in-DataConnections-automatically/m-p/104503#M1689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good morning Qlik-Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when adding a Data Connection in Qlik Sense you can use User + Password credentials to validate your access to f.e. a database. We have a customer where this login changes regularly. At the moment we have to change the Data Connection every time the account. To handle such things fully automatically I wanted to change the Login-Credentials in the Repository Database of Qlik Sense. So I checked the DataConnection-Table and found:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="DataConnecitons_1.png" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/212902_DataConnecitons_1.png" style="height: 286px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I tried replacing Username and PasswordString. The problem here is that the password is stored encrypted and I have no clue how it's encrypted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15363009353188138 jive_text_macro" jivemacro_uid="_15363009353188138" modifiedtitle="true"&gt;
&lt;P&gt;Update "DataConnections"&lt;/P&gt;
&lt;P&gt;SET "Username" = 'username', "PasswordString" = 'unencryptedtext'&lt;/P&gt;
&lt;P&gt;where &amp;lt;somecondition&amp;gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How is the password encrypted in the repository database? How does Qlik Sense edit the password, when I change the credentials inside the Data Connection in Qlik Sense?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best greetings.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2018 06:19:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Update-Password-in-DataConnections-automatically/m-p/104503#M1689</guid>
      <dc:creator>chrislemm</dc:creator>
      <dc:date>2018-09-07T06:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Update Password in DataConnections automatically</title>
      <link>https://community.qlik.com/t5/Management-Governance/Update-Password-in-DataConnections-automatically/m-p/104504#M1690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Christopher,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Going through the database layer isn't going to be supported, documented, or recommended. The values there are AES256 encrypted with a salt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The recommended approach will be to go through the QRS API. Example code taken from &lt;A href="https://github.com/levi-turner/QlikSenseScripts/blob/master/qlik_sense_pwd_change.ps1" title="https://github.com/levi-turner/QlikSenseScripts/blob/master/qlik_sense_pwd_change.ps1"&gt;https://github.com/levi-turner/QlikSenseScripts/blob/master/qlik_sense_pwd_change.ps1&lt;/A&gt; with comments for clarity:&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15363284114672709 jive_text_macro" jivemacro_uid="_15363284114672709"&gt;
&lt;P&gt;# Prompt for password&lt;/P&gt;
&lt;P&gt;$Password = Read-Host -Prompt 'Input the&amp;nbsp; new password'&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Store the Base64 Encoded package in the Host.cfg for connection&lt;/P&gt;
&lt;P&gt;$Data = Get-Content C:\ProgramData\Qlik\Sense\Host.cfg&lt;/P&gt;
&lt;P&gt;# Convert the base64 encoded install name for Sense to UTF data&lt;/P&gt;
&lt;P&gt;$FQDN = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($($Data)))&lt;/P&gt;
&lt;P&gt;# Connect to Qlik Sense using an internal account (sa_api)&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Connect-Qlik -ComputerName &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://$($FQDN):4242" rel="nofollow" target="_blank"&gt;https://$($FQDN):4242&lt;/A&gt;&lt;SPAN&gt; -Username INTERNAL\sa_api&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Expose all elements of the JSON response&lt;/P&gt;
&lt;P&gt;$rawoutput=$true&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Get the DataConnection JSON for a particular data connection&lt;/P&gt;
&lt;P&gt;$RESTapp = Invoke-QlikGet -path "/qrs/dataconnection/full?filter=(name eq 'monitor_apps_REST_app')"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Filter out the ID value for later GET&lt;/P&gt;
&lt;P&gt;$RESTappID = $RESTapp.id&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# GET the DataConnection JSON&lt;/P&gt;
&lt;P&gt;$RESTappDC = Invoke-QlikGet -path /qrs/dataconnection/$RESTappID&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Swap the password out in the JSON&lt;/P&gt;
&lt;P&gt;$RESTappDC | Add-Member Password $Password -Force&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Convert to actual JSON&lt;/P&gt;
&lt;P&gt;$RESTappDC = $RESTappDC | ConvertTo-Json&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# PUT in the new password&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Invoke-QlikPut -path &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://$($FQDN):4242/qrs/dataconnection/$RESTappID" rel="nofollow" target="_blank"&gt;https://$($FQDN):4242/qrs/dataconnection/$RESTappID&lt;/A&gt;&lt;SPAN&gt; -body $RESTappDC&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is leveraging Qlik-Cli (&lt;A href="https://github.com/ahaydon/Qlik-Cli/" title="https://github.com/ahaydon/Qlik-Cli/"&gt;https://github.com/ahaydon/Qlik-Cli/&lt;/A&gt;) but can be adapted to any scripting or programming language.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The key element here is that we are passing the client certificate and connecting as an INTERNAL account.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopes that helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2018 13:56:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Update-Password-in-DataConnections-automatically/m-p/104504#M1690</guid>
      <dc:creator>Levi_Turner</dc:creator>
      <dc:date>2018-09-07T13:56:32Z</dc:date>
    </item>
  </channel>
</rss>

