Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
satyaban
Contributor III
Contributor III

How to access Qlik Repository Service using certificate based auth from Remote Linux Machine?

Dear Team, Basically I am trying to use Qlik_CLI powershell module to access Qlik Repository Service (QRS) .

Ref Link : https://adamhaydon.com/Qlik-Cli-Windows/

But requirement is I have to Run Qlik-CLI commands Connect-Qlik from Linux/Mac Terminal using certificate generated from Qlik QMC

Ref Link : https://community.qlik.com/t5/Official-Support-Articles/Export-client-certificate-and-root-certifica...

Now I have taken those client.pfx,Server.pfx and root.cer from Qlik Server and paste in mac server inside /certificate folder

Command used : Get-PfxCertificate "/Users/mac_username/Development/powershell/certificate/client.pfx" | Connect-Qlik -computername "QlikHostname" -username "Domain\adminUser" -TrustAllCerts

 

Error Snippet:

Line | 66 | … $result = Invoke-RestMethod @paramInvokeRestMethod @params | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Unable to cast object of type 'System.Security.Cryptography.X509Certificates.X509Certificate' to type | 'System.Security.Cryptography.X509Certificates.X509Certificate2'.

 

Request you please help with process how to Execute Qlik Cli Powershell module from remote machine using certificate while Qlik Repo Service is running inside another windows server .

Labels (3)
1 Solution

Accepted Solutions
Marc
Employee
Employee

As you can see from the Error Message you are getting, the command "Get-PFXCertificate" is casting the certificate as the wrong type "X509Certificate" when it should be importing as a "X509Certificate2" 

you can work around this by declaring the type of the object when importing the certificate.

 

[System.Security.Cryptography.X509Certificates.X509Certificate2]$Cert = Get-PfxCertificate /home/marc/Client/client.pfx

Connect-Qlik -Certificate $Cert -Username 'domain\user' -Computername sense01 -TrustAllCerts

 

Marc_0-1668471929774.png

 

Using your example this would look like this

[System.Security.Cryptography.X509Certificates.X509Certificate2]$ClientCert = Get-PfxCertificate "/Users/mac_username/Development/powershell/certificate/client.pfx"

Connect-Qlik -Certificate $ClientCert -computername "QlikHostname" -username "Domain\adminUser" -TrustAllCerts

 

View solution in original post

1 Reply
Marc
Employee
Employee

As you can see from the Error Message you are getting, the command "Get-PFXCertificate" is casting the certificate as the wrong type "X509Certificate" when it should be importing as a "X509Certificate2" 

you can work around this by declaring the type of the object when importing the certificate.

 

[System.Security.Cryptography.X509Certificates.X509Certificate2]$Cert = Get-PfxCertificate /home/marc/Client/client.pfx

Connect-Qlik -Certificate $Cert -Username 'domain\user' -Computername sense01 -TrustAllCerts

 

Marc_0-1668471929774.png

 

Using your example this would look like this

[System.Security.Cryptography.X509Certificates.X509Certificate2]$ClientCert = Get-PfxCertificate "/Users/mac_username/Development/powershell/certificate/client.pfx"

Connect-Qlik -Certificate $ClientCert -computername "QlikHostname" -username "Domain\adminUser" -TrustAllCerts