Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mikelleen
Contributor II
Contributor II

Qlik-Cli for Windows PowerShell, (403) Forbidden error

Please post this to the appropriate forum, if this is not the correct forum:
I am a relatively new QlikSense user and I am trying to automate our Qlik deployments utilizing PowerShell.

I have been struggling to connect to my Qlik QMC via Qlik-Cli for Windows PowerShell. https://github.com/ahaydon/Qlik-CLI-Windows

Has anyone even gotten this PowerShell CLI commandlet module to work????
I am having issues with Qlik-CLI noted below but would like to know if anyone has gotten this to work at all. Except of course the developer.

I am experienced with PowerShell and have followed the various instructions for exporting certificates from my Qlik Sense Central, and importing them to my personal certificate store.

I am able to see the Qlik certificate imported from my Qlik Sense Central server in PoawerShell:

Get-ChildItem cert:CurrentUser\My | Where-Object { $_.FriendlyName -eq 'QlikClient' } 

On the above command, the certificate for 'QlikClient' is there and valid.

However when connecting using the Connect-Qlik method, I continue to get this error:
Get-ChildItem : The remote server returned an error: (403) Forbidden.
At line:1 char:1
+ Get-ChildItem cert:CurrentUser\My | Where-Object { $_.FriendlyName -e ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I am also seeing the following error:

Invoke-RestMethod : The remote server returned an error: (403) Forbidden.
At C:\Program Files\WindowsPowerShell\Modules\Qlik-Cli\1.21.1\functions\core.ps1:66 char:23
+ ... $result = Invoke-RestMethod @paramInvokeRestMethod @params
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

 

 

Labels (1)
2 Solutions

Accepted Solutions
Levi_Turner
Employee
Employee

Certainly. I didn't see you call out the actual connect statement, that'd be helpful. There's a section in the Wiki on establishing a connection, which I'd suggest if you have not scanned through it.

Without the connect statement it's hard to debug, but it looks like you are able to connect (403 means the server accepted the auth attempt but you were not permitted to make the request). That can be due to the certificate not being from the Qlik Sense site that you are attempting to connect to. I quite like the Get-PfxCertificate command called out in the Wiki as it allows you to do a fresh export from Qlik Sense Enterprise Client Managed to ensure the certificate is good to go.

If you wanted to use something entirely independent of Qlik-Cli-Windows, then this PowerShell script will use pure PowerShell to help isolate the problem: https://github.com/levi-turner/QlikSenseScripts/blob/master/qs-generic/qs-qrs-generic-GET.ps1

 

View solution in original post

mikelleen
Contributor II
Contributor II
Author

I did get the connection to work finally. I used the -verbatim option during connecting and that helped uncover a permissions issue.

View solution in original post

2 Replies
Levi_Turner
Employee
Employee

Certainly. I didn't see you call out the actual connect statement, that'd be helpful. There's a section in the Wiki on establishing a connection, which I'd suggest if you have not scanned through it.

Without the connect statement it's hard to debug, but it looks like you are able to connect (403 means the server accepted the auth attempt but you were not permitted to make the request). That can be due to the certificate not being from the Qlik Sense site that you are attempting to connect to. I quite like the Get-PfxCertificate command called out in the Wiki as it allows you to do a fresh export from Qlik Sense Enterprise Client Managed to ensure the certificate is good to go.

If you wanted to use something entirely independent of Qlik-Cli-Windows, then this PowerShell script will use pure PowerShell to help isolate the problem: https://github.com/levi-turner/QlikSenseScripts/blob/master/qs-generic/qs-qrs-generic-GET.ps1

 

mikelleen
Contributor II
Contributor II
Author

I did get the connection to work finally. I used the -verbatim option during connecting and that helped uncover a permissions issue.