ahaydon / Qlik-Cli-Windows

Qlik-Cli for Windows
https://adamhaydon.uk/Qlik-Cli-Windows/
GNU General Public License v2.0
110 stars 51 forks source link

Qlik Cli #218

Open abdulvajid4525 opened 6 months ago

abdulvajid4525 commented 6 months ago

Hi,

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

Thank you

ahaydon commented 6 months ago

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.

abdulvajid4525 commented 6 months ago

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.

ahaydon commented 6 months ago

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.

abdulvajid4525 commented 6 months ago

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

image
ahaydon commented 6 months ago

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

abdulvajid4525 commented 6 months ago

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

abdulvajid4525 commented 6 months ago

@ahaydon Any inputs on this?

ahaydon commented 6 months ago

@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.