Azure RBAC and Azure IAM - azure

A user should be able to read a resource group. Not allowing the user to create/delete a resource group.
i. I have created a custom role using json script with the following permissions:
Actions: Microsoft.Resources/subscriptions/resourceGroups/read
NotActions: Microsoft.Resources/subscriptions/resourceGroups/write,
Microsoft.Resources/subscriptions/resourceGroups/delete
ii. Added it using PowerShell cmdlet New-AzureRMRoleDefinition.
But when I assigned this custom role to a user in IAM, user is still able to create/delete a resource group.
Note: I have used RBAC and IAM services of Azure

Go to resource group blade >> IAM >> Add (at the top of the blade).
Select contributor. Select User. you are done.

Related

Azure IAM - Custom Role

Trying to figure out if it is possible to have a custom IAM role where it has contributor to the resources but not the ability to create resources. We need a solution besides automating the IAM roles on a resource, I'd rather just give that role on the resource group and not let the developers be able to create new resources. Maybe I do it with Azure Policy but a role would be better since it's easier to automate.
According to Documentation it says,
By default we use the "Contributor" role that is included into Azure. All subscription resources are accessible to users with the Contributor role.
If you wish to limit the Controller access permissions, you can do so by creating a custom role with a set of permissions required by the Controller
Thanks #JohnC according to SO-thread it says,
Azure supports custom RBAC roles, you can create a custom role with the Microsoft.Resources resource provider operation.
When you are creating the custom role check whether the below azure permission is not included in that custom role as this permission gives the user the right to create a resource group.
If this permission is not included in the custom role then that user will not be able to create a resource group, hence any azure resource will not be deployed.
Microsoft.Resources/subscriptions/resourceGroups/write
References:
Create or update Azure custom roles using the Azure portal - Azure RBAC | Microsoft Docs

Can't access resource group in Azure, while having Contributor role for it

I've been given access to a resource group in Azure, but still get 401 page while trying to access it or any resource in that resource group. I have role assigned to me only in a resource group, not subscription (maybe this can be the reason?)
Type of my user: Guest
Role for a resource group: Contributor
Contributor role gives full access, except ability to assign roles to other users.
Also, according to docs
Guests can be added to administrator roles, which grant them full read
and write permissions
What can be the problem?
This is the page I get when trying to access resource group or any of it resource:
Azure Resource Manager sometimes caches configurations and data to improve performance. When you assign roles or remove role assignments, it can take up to 30 minutes for changes to take effect. If you are using the Azure portal, Azure PowerShell, or Azure CLI, you can force a refresh of your role assignment changes by signing out and signing in. If you are making role assignment changes with REST API calls, you can force a refresh by refreshing your access token.
Source: Troubleshoot Azure RBAC - Role assignment changes are not being detected
Another option would be to visit the preview portal. Since this is a different website, you will get a new token which reflects the latest state.

How to force user to access via pim in Azure

While creating access package or group, How can I force uses to get access (for any resources) via PIM in Azure?
While creating the group there is a option called "Azure AD roles can
be assigned to the group". What is this all about? If I say "Yes", its
showing up the "Roles".
I'm bit confused about the additional settings. Is this the setting to do this?
I don't know about access packages or access groups. But for my PIM setup I have Azure AD groups where users are added. And once they get access to the group they become eligible for requesting roles through PIM.
I have then a role in PIM, I make it eligible, and assign it to the group.
Users can open PIM, go to My Roles, and then activate the role.
Activating the role gives them permissions for one hour to access resources in a resource group. (This is all depending on what settings you put on the role in PIM). Outside of PIM they have no permissions whatsoever, so if they need access to resources they must request it via PIM.
PIM
Azure Resource
Change the default filter on Resource Type from Subscription to Resource Group or Resource if you want to assign permissions on smaller scopes
Do the things.

Error: No user assignments exist error in azure

From Azure portal, I'm trying to do "Assign the Service Desk Virtual Machine Contributor permissions"
I have created user:
Created a VM:
Searching by Name:
However, the search says no user assignment exists.
What am I doing wrong/missing? Any suggestion please? Thanks
As #Rockstar has mentioned in comments section, If the user is a part Service Desk Group then in IAM blade the user won't be visible but if you check the user's azure role assignment then you will find the role which was assigned to the group has been inherited by the user as well.
If the user is not a part of the group then you have to directly assign the Role in IAM blade for the user itself to make it visible in the Portal IAM Blade.
I tested in my environment like this:
1.Created a user and added him to the service desk group
2.Assigned virtual machine contributor role to the group
3.And then I go to the User>>azure role assignment and I see that role is assigned to the user as well as it is a part of the group
4.And assigned another user(not part of service desk group) to the role and I can see it in the portal

Enable the ability to create resource groups

I would like to give members of a specific role the ability to create resource groups. Can this be achieved without giving users the co-owner role at the subscription level?
You can grant them contributor rights on the specific Azure subscription, they don't have to be co-owner. This is the least-privilege built-in role available that allows you to create resource groups.
However, you could also create a custom role with only one action:
Microsoft.Resources/subscriptions/resourceGroups/write
Read more here: Custom roles for Azure resources

Resources