akuzhan on 10 Jul 2018 17:38:51
It would be nice to be able to add power bi users to workspaces(groups) in readonly mode. We are only limited to add admin users via api. It is really important to have this feature in order to automate deployments.
- Comments (2)
RE: add group user api - enable adding non-admin users
The API needs to support adding someone as a member or, in the new workspace experience, as a contributor (or viewer when that role becomes available). This should not require an AD group, Office 365 group, or any other kind of group.
RE: add group user api - enable adding non-admin users
Hi,
You can add a user to a Power BI AppWorkspace as a Member user with the Azure Graph API. You add an Azure AD user to an Azure AD group. The Azure AD group will have the same Id as the Power BI AppWorkspace group.
i.e.
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/group_post_members
You can do the same thing with the Azure Graph SDK client for C#,
e.g.
// Find the Azure AD user
string oDataFilter = "mail eq '" + userEmailAddress + "'";
var results = await graphClient.Users.Request () .Filter(oDataFilter).GetAsync () ;
Microsoft.Graph.User user = results.FirstOrDefault () ;
// Add user as a member to AppWorkspace
await graphClient.Groups[appWorkspacePowerBIId].Members.References.Request () .AddAsync(user);