Bulk creates 50 Microsoft Entra ID security groups CSV file via the Microsoft Graph API.
- Python 3.11+
- Azure App Registration with application permissions (admin consented):
Group.ReadWrite.AllUser.Read.All
1. Create and activate a virtual environment (recommended):
python3 -m venv .venv
source .venv/bin/activate2. Install dependencies:
pip install -r requirements.txt3. Set environment variables (hardcoded for activity):
export AZURE_TENANT_ID="your-tenant-id"
export AZURE_CLIENT_ID="your-client-id"
export AZURE_CLIENT_SECRET="your-client-secret"1. Dry run first (always):
Set DRY_RUN = True in the script (default), then:
python create_entra_groups.py2. Live run:
Set DRY_RUN = False, then run:
python create_entra_groups.pyCSV file must have the following columns:
| Column | Description |
|---|---|
group_name |
Display group name |
description |
Description of the group |
mail_nickname |
Alphanumeric only, unique in tenant |
group_type |
Security |
assignable_to_role |
true or false |
owner_upn |
Must already exist in the tenant |
members_upns |
Semicolon-separated, must already exist in tenant |
| File | Description |
|---|---|
provisioning.log |
Full results log |
audit_log.json |
Group results — status, group ID, owner/member outcomes |
⚠️ Invalid rows are logged and skipped but they don't stop the script run- ♻️ Groups that already exist in Entra ID are skipped
- 🔁 Any partial failures are recorded in
audit_log.json, safe to rerun
Filter audit_log.json for status=success to get group IDs, then:
az ad group delete --group <group-id>