due to a company policy, passwords for all accounts have to be changed in a regular interval including service accounts. I got a script for updating the password for the Qlik Sense services, which also updates the data connections of the monitor apps.
Updating the services works well, but when it comes to changing the data connections, I get a HTTP error 400 "invalid request".
The part of the script, which changes the password of the data connections:
Re: Change Dataconnection Password through Qlik-Cli
Yep, there was an added function which handles things.
To do it without the function you're likely missing getting the raw output. Otherwise Qlik-CLI does handing of the dates. Example:
$Data = Get-Content C:\ProgramData\Qlik\Sense\Host.cfg
# Convert the base64 encoded install name for Sense to UTF data
$FQDN = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($($Data)))
Connect-Qlik -Username INTERNAL\sa_api -TrustAllCerts
$Password = 'foo'
# Get the ID of the Data Connection
$RESTapp = Invoke-QlikGet -path "/qrs/dataconnection/full?filter=(name eq 'Temp (qtsel_ltu)')"
# Filter out the ID value for later GET
$RESTappID = $RESTapp.id
# GET the DataConnection JSON
$RESTappDC = Invoke-QlikGet -path /qrs/dataconnection/$RESTappID
# Swap the password out in the JSON
$RESTappDC | Add-Member Password $Password -Force
# Convert to actual JSON
$RESTappDC = $RESTappDC | ConvertTo-Json
# PUT in the new password
Invoke-QlikPut -path https://$($FQDN):4242/qrs/dataconnection/$RESTappID -body $RESTappDC