Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW

Exporting and importing Security rules using Qlik-Cli

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Andre_Sostizzo
Digital Support
Digital Support

Exporting and importing Security rules using Qlik-Cli

Last Update:

Jun 2, 2021 2:35:51 PM

Updated By:

Andre_Sostizzo

Created date:

Sep 28, 2017 10:16:59 AM

Scenario:

  1. Have Qlik-Cli installed and configured (see How to install Qlik-CLI for Qlik Sense on Windows) for more insight on how to install and configure Qlik-Cli)
  2. Create a PowerShell script using the following code as a base:

! Note that the code is provided as is and will need to be modified to suit specific needs. For assistance, please contact the original creators of Qlik-Cli.

Connect-Qlik -computername "QlikSenseServer.company.com"
# This will export the custom security rules and output them as secrules.json
Get-QlikRule -filter "type eq 'Custom' and category eq 'security'" -full -raw  | ConvertTo-Json  | Out-File secrules.json
# This will import secrules.json into a Sense site
# The ideal use case would be to move the developedsecurity rules from one environment to another, so connecting to another Sense site would likely be needed here
Get-Content -raw .\secrules.json |% {$_ -replace '.*"id":.*','' } | ConvertFrom-Json | Import-QlikObject

Environment:

Qlik Sense Enterprise on Windows , all versions

Labels (2)
Comments
Jio
Contributor III
Contributor III

Hi i try to use the above qlik-cli commands.
The export works well n oproblem, but when i try to import the security rules, i got the error
Invoke-RestMethod : The remote server returned an error: (403) Forbidden.
At C:\Program Files\WindowsPowerShell\Modules\Qlik-Cli\functions\core.ps1:65 char:23
+ ... $result = Invoke-RestMethod @paramInvokeRestMethod @params
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Anyone an idea what the problem is and an idea how i can resolve this?

Sonja_Bauernfeind
Digital Support
Digital Support

Hello @Jio 

As we do not provide direct support for this tool, I would recommend that you contact the Qlik-CLI subject matter experts directly. You can do so here: https://github.com/ahaydon/Qlik-Cli-Windows/issues 

All the best,
Sonja 

Version history
Last update:
‎2021-06-02 02:35 PM
Updated by: