Qlik-Cli-Windows icon indicating copy to clipboard operation
Qlik-Cli-Windows copied to clipboard

Qlik Cli

Open abdulvajid4525 opened this issue 10 months ago • 8 comments

Hi,

From the prod Qlik sense server, using Qlik CLI can we export the app from the Qlik sense dev server?

Thank you

abdulvajid4525 avatar Apr 04 '24 08:04 abdulvajid4525

Yes, you can use the Connect-Qlik command to connect to the dev server, all subsequent commands are then run against that server. You can then run Export-QlikApp to export the app from the dev server, and if you need to run commands on prod again just use Connect-Qlik to reconnect to prod.

ahaydon avatar Apr 04 '24 08:04 ahaydon

Whether I need to follow these steps before doing it. Without doing this am getting an error cannot connect to remote server.

step1 :-If we use Certificates to connect to Qlik Sense then Qlik Sense client and root authorities certificates must also be installed on the machine running Qlik-Cli. If the machine will connect to multiple Qlik Sense sites, certificates for each site must be installed on the machine. step2 :- If we use Windows authentication, the root authorities certificates must also be installed on the machine running Qlik-Cli and again if we connect to multiple Qlik Sense sites, root authorities certificates for each site must be installed on the machine.

abdulvajid4525 avatar Apr 04 '24 09:04 abdulvajid4525

If you have installed trusted certificates on your Sense servers and configured the certificate thumbprint in the proxy settings then you should be able to connect without SSL/TLS errors. Otherwise, you can use Connect-Qlik -TrustAllCerts -UseDefaultCredentials sense-dev to disable certificate verification and use Windows auth when connecting to the remote server sense-dev.

To use certificates instead of Windows auth you would need to get a QlikClient cert from the dev server and copy it to prod for use with Qlik-Cli.

ahaydon avatar Apr 04 '24 11:04 ahaydon

I need to know whether these are steps which I should follow for connecting from dev to prod using certificate. image

abdulvajid4525 avatar Apr 04 '24 13:04 abdulvajid4525

Yes those steps are necessary to use certificates for connecting from one site to another, since you will have multiple QlikClient certificates installed it is not possible for Qlik-Cli to know which to use so you need to specify it. E.g. Get-Item Cert:\CurrentUser\My\1234 | Connect-Qlik sense-dev -Username INTERNAL\sa_api. This will get the certificate with thumbprint 1234 and pipe it into Connect-Qlik to use for authentication, and connect with specified servername and username.

You can also use a PFX file rather than importing the certificate, e.g. Get-PfxCertificate qs-dev.pfx | Connect-Qlik sense-dev -Username INTERNAL\sa_api

ahaydon avatar Apr 04 '24 13:04 ahaydon

I tried this already. You can also use a PFX file rather than importing the certificate, e.g. Get-PfxCertificate qs-dev.pfx | Connect-Qlik sense-dev -Username INTERNAL\sa_api getting below error

Invoke-RestMethod : Unable to connect to the remote server At C:\Program Files\WindowsPowerShell\Modules\Qlik-Cli\functions\core.ps1:66 char:23

  • ... $result = Invoke-RestMethod @paramInvokeRestMethod @params
  •                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExceptio n
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

abdulvajid4525 avatar Apr 04 '24 17:04 abdulvajid4525

@ahaydon Any inputs on this?

abdulvajid4525 avatar Apr 08 '24 06:04 abdulvajid4525

@abdulvajid4525 check that you can access the port with Test-NetConnection senseserver -Port 4242, ensure to replace senseserver with the server hostname. It should show TcpTestSucceeded : True

Check the PFX file includes a private key with the command Get-PfxCertificate .\qs-dev.pfx | fl *

Try adding the -Verbose flag to Connect-Qlik, this will display more details when connecting and might give some insight into why it's failing.

ahaydon avatar Apr 08 '24 10:04 ahaydon