Hello EnterpriseArchitect,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
Problem
I understand that you would like to restrict users from modifying Network Security Group (NSG) rules, Virtual Network (VNET), or firewall rules in Azure, and to ensure only members of the "Network-Team" group can make these changes.
Solution
To restrict users from modifying Network Security Group (NSG) rules, Virtual Network (VNET), or firewall rules in Azure, and to ensure only members of the "Network-Team" group can make these changes, you can implement Role-Based Access Control (RBAC) and Azure Policy.
- Firstly, you will need to create the "Network-Team" Group in Azure AD if you have not. To do this: in Azure Portal > Azure Active Directory > Groups > New Group. Create a group named "Network-Team" and add the appropriate members.
- Assign Roles to "Network-Team" Group from Azure Portal > Subscriptions > Select your subscription > Access control (IAM). Then, add role assignment such as:
- Role: Network Contributor (or a custom role with the necessary permissions)
- Assign Access to: Azure AD user, group, or service principal
- Select: "Network-Team" group. This role will allow members of the "Network-Team" to manage NSGs, VNETs, and firewall rules.
- Ensure that no other users or groups have roles like "Network Contributor" or similar permissions at the subscription, resource group, or resource level, except where necessary.
- Now at this point, you will need to enforce the policy and prevent users, you can use Azure Policy to control network configurations.
- Azure Portal > Policy > Definitions > + Policy Definition.
- Select your subscription or management group.
- Name: Restrict Network Modifications.
- Policy to restrict modifications to network resources by unauthorized users.
- Category: Networking.
- Policy Rule: Use JSON policy definitions to restrict modifications to network resources like NSGs, VNETs, and firewall rules.
{
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/networkSecurityGroups"
},
{
"not": {
"field": "Microsoft.Network/networkSecurityGroups/securityRules[*].sourceAddressPrefix",
"equals": "Internet"
}
}
]
},
"then": {
"effect": "deny"
}
}
Assign the Policy, by select appropriate Scope of your subscription or resource group level. Also, excluded Principals. like adding the "Network-Team" group to exclude them from the policy.
Accept Answer
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.
Best Regards,
Sina Salam