Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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 .
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
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
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
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