Groups
🔹 Groups in Azure (Microsoft Entra ID)¶
A group in Microsoft Entra ID is a collection of users, devices, or service principals used to manage permissions, access control, and policies more efficiently.
✅ Types of Groups¶
-
Security Groups: Used for assigning access to resources like apps, VMs, and files.
- Example: A security group “Developers” grants access to Azure DevOps and GitHub Repos.
Groups help implement Role-Based Access Control (RBAC) by simplifying permission assignments across multiple users. 🚀

📌 Create a Group¶
-
Sign in to Microsoft Entra ID Portal.
-
Go to “Groups” > Click “New Group”.
-
Choose Group Type:
SecurityorMicrosoft 365. -
Enter Name, Description.
-
Assign Owners and Members.
-
Configure Settings & Permissions.
-
Click “Create” – Group is created successfully.
➕ Add User to a Group¶
-
Go to Groups > Select the desired group.
-
Click “Members” > “Add Members”.
-
Search and select the user.
-
Click “Add” – User is added to the group.
➖ Remove User from a Group¶
-
Go to Groups > Select the group.
-
Click “Members” > Locate the user.
-
Click “Remove” > Confirm.
-
User is successfully removed.
🗑️ Delete a Group¶
-
Go to Groups > Select the group.
-
Click “Delete” > Confirm.
-
Group moves to “Deleted Groups”.
-
(Optional) Permanently delete or restore the group.
⚙️ Terraform – Managing Azure Entra ID Groups¶
You can use the azuread provider to manage groups and group membership in Entra ID (Azure AD).
📦 Provider Setup¶
🏗️ Create a Security Group¶
resource "azuread_group" "developers" {
display_name = "Developers"
security_enabled = true
mail_enabled = false
description = "Security group for developer access to Azure DevOps and GitHub"
}
➕ Add Users to the Group¶
resource "azuread_group_member" "add_users" {
group_object_id = azuread_group.developers.id
member_object_id = "<USER_OBJECT_ID>" # Replace with actual User Object ID
}
🔍 To get the
member_object_id, use:
➖ Remove Users from the Group¶
Simply remove the azuread_group_member resource from your code or run:
🗑️ Delete a Group¶
To delete the group, just remove or comment out the azuread_group resource from your code and re-apply:
💡 Optional: Use Variables for Reusability¶
variable "group_name" {
default = "Developers"
}
resource "azuread_group" "example" {
display_name = var.group_name
security_enabled = true
mail_enabled = false
}