Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
pavanpatha
Contributor III
Contributor III

Delete admin role

Hi,

 

I would like to delete all admin roles of a user using the QLIK CLI command instead of doing on QMC. i tried below but isnt working. its retaining the old roles. I am able to update the roles though, but unable to remove all of them.

Connect-Qlik

$user=Get-QlikUser -filter "userid eq 'abc'" -full
$str=@()
Update-QlikUser -id $user.id -roles $str

 

Thanks,

Pavan

1 Reply
Damien_Villaret
Support
Support

Hello,

I am not sure what would be the exact syntax for Qlik-Cli (which is just an abstraction layer on top of the Repository API by the way) but if you were to do it directly with the Repository API, then here is the syntax:

$body = '{
  "userDirectory":"DOMAIN",
  "userId":"user1a",
  "removedExternally":"false",
  "blacklisted":"false",
  "modifiedDate":"2021-02-12T14:00:36.157Z",
  "roles":[]
}'
$hdrs = @{}
$hdrs.Add("X-Qlik-xrfkey","12345678qwertyui")
   $hdrs.Add("X-Qlik-User","UserDirectory=INTERNAL;UserId=sa_repository")
   $cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}
$url = "https://qlikserver1.domain.local:4242/qrs/user/1cfb66b1-0fbc-4aa4-9cca-fb7450a6a83d?xrfkey=12345678qwertyui"
Invoke-RestMethod -Uri $url -Method Put -Headers $hdrs -ContentType 'application/json' -Certificate $cert -Body $body

  

If the issue is solved please mark the answer with Accept as Solution.