Prevent access to Production resources using Azure Custom RBAC - azure

I have one subscription which contains all Dev, Test, and Prod resources. I have created a custom RBAC role that grants access to limited azure resources. However, I want to restrict access to Production resources. Can I limit this using the wild card permissions? Are there other ways to grant access to all resources except Production resources?

I Tried to reproduce the same in my environment to Prevent access to production resources using Azure Custom RBAC
I have created 3 Resource Groups like below
Production Environment
Testing Environment
Development Environment
Created RBAC rule like below
Azure Portal>Subscription>Access control (IAM)>Add>custom role>Assignable scopes (Select Required RGS)
Assign RBAC Role Assignment to Required Users/Groups.
**Azure Portal>Subscription>Access control (IAM)>Role assignments>Add>Add Role Assignments (Select Custom Role) **
Finally Assign the RBAC role to only Production Resource Group like below.
Azure Portal>Resource Group>(Select your Production RG)>Access control (IAM)>Role assignments>Add>Add Role Assignment>RBAC- Custom Policy (Select RBAC Role)

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.

Not able to create AKS with role assignment write for subnet and ACR registry in Azure Cloud

I am trying to create Azure Kubernetes Service (AKS) with earlier created virtual network (VN) and container registry (ACR).
I am facing below errors.
My user id does not have sufficient permissions to perform this action. Only with basic network settings and no ACR binding, I can create AKS cluster.
Which role, at Active Directory (AD) level and at subscription level, should my user id be having to create this AKS service?
You don't need any permissions on Azure AD level for this to work, but you need Microsoft.Authorization/roleAssignments/write permissions on the adequate scopes to be able to assign permissions. A built-in role of Owner grants that. Otherwise - create a custom role and assign that to your user.

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