Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Spartan27215
Partner - Creator
Partner - Creator

How to bulk add users when using Azure AD Idp

Out SaaS tenant uses Azure AD integration, when we 1st got started and to get the model and application(s) built we only needed a few users so we we through the typical, login routine to make the user known to Qlik and then went in and assigned the user resources and permissions. However now that we are wanting to open this up to MANY users I need some other way (like a way to import) to bring add these users in bulk and be able to assign them to their respected managed space(s) with the appropriate permissions. 

Has something like this been developed?

Labels (2)
2 Solutions

Accepted Solutions
NadiaB
Support
Support

Hi @Spartan27215 

You can call the endpoints with .net it just won't be with the SDK, that applies for Engine only as confirmed with our team. 

 

The endpoints are found here: 

https://qlik.dev/apis/rest/users#%23%2Fentries%2Fusers-post

 

The API Key can be obtained as documented here:

Generating an API key from the hub

 

 

It's being a while since I developed something in .net so I'm placing a very basic sample, it seems that there is a popular library for Rest API's implementation called RestSharp, I did a quick test and it worked for me you probably can start from there and make a more scalable solution or at least have a reference of what parameters need to be provided:

 

using RestSharp;

var resource = "api/v1/users";
var barearkey = "Bearer <yourAPIKEY>";
var tenant = "https://<yourtenant>.us.qlikcloud.com/";

var body = @"{""name"":""John Smith 4"",""email"":""john.smith4@corp.example"",""status"":""invited"",""picture"":""https://corp.example/docs/jsmith.png"",""subject"":""1234asdasa6786"",""tenantId"":""<your tenant ID>""}";

var client = new RestClient(tenant);

var request = new RestRequest(resource, Method.Post);
request.AddHeader("Authorization", barearkey);
request.AddHeader("Content-Type", "application/json");

request.AddParameter("application/json", body, ParameterType.RequestBody);
RestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

You can add more attributes for the user, I just did a quick test but you can also add roles if needed. 

 

Hope it helps!

Don't forget to mark as "Solution Accepted" the comment that resolves the question/issue. #ngm

View solution in original post

Spartan27215
Partner - Creator
Partner - Creator
Author

Here is what I got to work not using anything other than the C#.NET built-in HTTP Client and Response objects. Note I fashoned the response uing a Json to C# converter using the response sample at <Users | Qlik Developer Portal>

HttpClient Client = new();
Client.BaseAddress = new Uri(sAPIURL);
Client.DefaultRequestHeaders.Clear();
Client.DefaultRequestHeaders.Add("Authorization", "Bearer " + sAPIKey);
//Client.Content.Add("Content-Type", "application/json");

sCommand = "users";
HttpResponseMessage Response = Client.GetAsync(sCommand).Result;

// Check for Success
if (Response.IsSuccessStatusCode)
{
        QlickRestClasses.QlikUserList QUsers;
        QUsers = Response.Content.ReadFromJsonAsync<QlickRestClasses.QlikUserList>().Result;
}

View solution in original post

20 Replies
Qlik_Eric_Thomas

Adding multiple users at a time preemptively could be accomplished using the Create User API:  https://qlik.dev/apis/rest/users#%23%2Fentries%2Fv1%2Fusers-post

The better option would probably be to utilize Groups/Security Groups in your Managed Spaces so that as long as your new users are part of the correct Group in Azure AD, they will have Managed Spaces permissions when they log in and begin interacting with the platform: 
https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Spaces/sharing-content-w... 

Sr. Technical Support Engineer with Qlik Support
Help users find answers! Don't forget to mark a solution that worked for you!
Spartan27215
Partner - Creator
Partner - Creator
Author

I would love to use an API but the developer toolkit is only for Python and some other language i do not speak. I cannot find any .NET examples. Since I am using Qlik Cloud, the Group Option is not available. 

Qlik_Eric_Thomas

Qlik_Eric_Thomas_0-1672418978601.png

As long as your group claim is configured correctly for your Azure IDP and this setting is checked, Groups from Azure will be associated with your users.

You can check these with the following endpoint in your browser:
https://<your-tenant-here >/api/v1/groups

This will show what groups your user is part of.

Sr. Technical Support Engineer with Qlik Support
Help users find answers! Don't forget to mark a solution that worked for you!
Qlik_Eric_Thomas

And here i've added one of my Azure AD groups to my Managed Space:

Qlik_Eric_Thomas_0-1672419540558.png

 

Sr. Technical Support Engineer with Qlik Support
Help users find answers! Don't forget to mark a solution that worked for you!
Spartan27215
Partner - Creator
Partner - Creator
Author

Ate there any .net examples for using the API. I want to add Qlick User management to our current user management platform.

Qlik_Eric_Thomas

I would still suggest utilizing groups within Qlik Cloud, but if you want to go down .NET/API route, you may want to check out Qlik CLI: https://qlik.dev/libraries-and-tools/qlik-cli

Sr. Technical Support Engineer with Qlik Support
Help users find answers! Don't forget to mark a solution that worked for you!
Spartan27215
Partner - Creator
Partner - Creator
Author

Using groups or not, I would still like some samples for using .NET (Not ASP .NET) either in C# or VB.

Spartan27215
Partner - Creator
Partner - Creator
Author

how does a command line interface help me with my .NET winforms appilcation? Is it written in c# using .NET