Azure active directory assign roles to users within groups - azure

I am making an application where users can join multiple azure groups. This works fine. But a user should be able to have a role only within that specific group. So a user can have different roles in different groups.
Does anyone know how I can assign roles that only exist within a group?
and then get the role for a user within a specific group via the graph api?

To Assign the role to a user please "Add directory role member"to assign a particular role in a group.
For different types of roles that you can assign to a user please refer "Azure AD built-in roles"
Hope this helps.

Related

access to enterprise application (EA) in Azure

what is a significance of "Users and groups" under EA?
adding a person will give same access to person as that EA?
adding a SP will do what? added SP will not have same access as EA?
Just creating the identity (User type or Service Principal) you will not give any role.
After you create the user, you can assign any role that you require to give to the identity.
Assign Azure AD
Sign in to the Azure AD admin center.
Select Azure Active Directory > Roles and administrators to see the list of all available roles.
Select a role to see its assignments.
To help you find the role you need, use Add filters to filter the roles.
Select Add assignments and then select the users you want to assign to this role.
If you see something different from the following picture, you might have PIM enabled. See the next section.
Select Add to assign the role.
Source: https://learn.microsoft.com/en-us/azure/active-directory/roles/manage-roles-portal
To Grant a user access to Azure resources you can follow this tutorial https://learn.microsoft.com/en-us/azure/role-based-access-control/quickstart-assign-role-user-portal
Hopes this Helps!
The users and groups tab specifies who can access the application. This is based on the assumption that the app is 'closed' in the properties tab.

Restrict Users from adding to groups manually in Azure

I need to restrict the users from adding to the groups manually in Azure, any help on this issue?
Thanks #Rahul Shukla for your suggestion .
Restrict Users from adding to groups
Give the user with reader or contributor permission to the user .
if you add that user the reader permission they will then be able to read any resource in the subscription, but not modify anything.
For more details refer this document: https://learn.microsoft.com/en-us/azure/role-based-access-control/role-assignments-portal?tabs=current
2)Prevent admin to add the users to group
Create review process in places where if any user gets added in the group admin will get notification for the same and based on admin approval only it will gets added.
Azure Active Directory (Azure AD) access reviews enable organizations to efficiently manage group memberships, access to enterprise applications, and role assignments. User's access can be reviewed on a regular basis to make sure only the right people have continued access
For more details refer this document: https://learn.microsoft.com/en-us/azure/active-directory/governance/access-reviews-overview

Is It possible to restrict the user to display the builtInRoles in roles drop down when assigning a role to new user?

We have requirement where we need to create a role xxxx and assign to a user A. This user A can create a user but should assign only custom role xxxx to his users.
I Have created a custom role xxxx and in permissions I have excluded the Microsoft.Authorization/roleAssignment (read, write and delete). This stop the user assigning the roles compltely, But my requirement is user A can assign only custom role to the user (Hide Buil in roles in the drop down)
Thank you.
I guess that you can do this kind of logic into an azure policy ( roles will be showed into the drop down , but when you finalize the operation will get an error ) .
A similar thread Azure custom role: authorize role assignment for a specific set of roles

How to Add users to different group in Azure AD B2C during Registration

Is it possible to add users to different groups based on the url they are coming from. All users to be added under the same Azure B2C directory but under different group during registration.
Example:
www.admin.com - User should go to "Admin" group.
www.user.com - User should go to "Users" group.
Thanks :)
You could use azure ad dynamic user group to do that, when you create a dynamic group with rules, the system evaluates all rules in a directory to see if the change would trigger any group adds or removes. If a user satisfies a rule on a group, they are added as a member of that group.
Reference - Dynamic membership rules for groups in Azure Active Directory
In your case, create the dynamic user group Admin, to add the users to the Admin group, you just need to add the rule like (user.userPrincipalName -match ".*admin.com*."), another one is the same logic.
After the system updated the group completely, it will appear like below.

Sitecore security - combining roles

Is there a way to combine access rights for a Sitecore item?
For example, I have a page that I would like to lock down to users who are a member of two different roles rather than just just one, and a user who has just one of the roles should be denied access.
I know you can have roles within roles but wondering if there was a simpler way to achieve this?
I'm using Sitecore 7.2.
If you are trying to check this in code, you can easily do so using
var user = AuthenticationManager.GetActiveUser();
return user.IsInRole("Role1") && user.IsInRole("Role2") ? "Granted":"Denied";
But if you are trying to achieve this in Sitecore Security on an item, then an AND of those 2 roles will be assigned. Ex: If I allow access to an item in Role1 but deny in Role2, the user with Roles 1 and 2 will have his/her access denied.
The simplest way to approach this is to define a new role with appropriate access rights and assign the relevant users to it, either manually or by script. That keeps your access rights transparent. You could code your way around the issue, but you could end up creating an admin nightmare, where it's near to impossible to see which roles and users have access to which items. E.g. what would you expect to see in the Access Viewer when looking at one of the roles, or at a user with one or both of the roles? There's a big difference between assigning access rights programmatically and evaluating them programmatically.
One way that you could achieve it via the Security Editor is by utilising Sitecore's Roles in Roles functionality.
Essentially you will want to create a New Role in the Role Manager that will contain the two roles, Role A and Role B. Select your New Role in the Role Manager and click Member Of button. In the modal click Add and select the two roles this New Role needs to contain.
In the Security Editor select the New Role and assign the read, write, create etc permissions to the required Items.
Now when users access those Items they must have Role A and Role B before given access - they will not need the New Role assigned to their account.
If you have a large number of roles to manage and combinations of those it will be very time consuming to manually create those combinations.

Resources