Get the group
SPGroup group = web.SiteGroups["GROUP_NAME"];
Create a role assignment
SPRoleAssignment newRoleAssignment = new SPRoleAssignment(group);
Add the role definition (Full Control, Read, Contribute, …) to the role assignment
newRoleAssignment.RoleDefinitionBindings.Add(web.RoleDefinitions["Full Control"]);
And add the role assignment to the web
web.RoleAssignments.Add(newRoleAssignment);

![[FIX] BizTalk Server 2010, 2013, 2013 R2 & 2016 errors “Class not registered (WinMgmt)” or “Access denied”](https://blogit.create.pt/wp-content/uploads/2018/07/access-black-and-white-blur-270514-218x150.jpg)
















