microsoft365_utility_guid_list_sharder data source.
Overview
The GUID List Sharder data source (microsoft365_utility_guid_list_sharder) is a utility tool that queries Microsoft Graph API to retrieve collections of object IDs (GUIDs) for users, devices, or group members, then intelligently distributes them into configurable “shards” (subsets) for progressive deployment strategies.
What Problem Does This Solve?
When deploying policies, configurations, or security controls across large Microsoft 365 environments, immediate organization-wide rollouts carry significant risk. If a policy misconfiguration or unexpected behavior occurs, it can impact thousands of users or devices simultaneously.Enabling Progressive Rollouts
Enabling Progressive Rollouts
Deploy changes to small pilot groups first (e.g., 10% of users), validate functionality, then gradually expand to broader populations
Reducing Blast Radius
Reducing Blast Radius
Limit the impact of potential issues by controlling which users/devices receive changes at each phase
Facilitating Validation
Facilitating Validation
Allow time to monitor, test, and validate each phase before proceeding to the next
Distributing Pilot Burden
Distributing Pilot Burden
By using unique seed values across different rollouts, the same users won’t always be early adopters. User X might be in the 10% pilot for MFA rollout (seed: “mfa-2024”) but in the 60% final wave for Windows Updates (seed: “windows-2024”), preventing “pilot fatigue”
Multiple Deployment Strategies
Multiple Deployment Strategies
Choose between hash (deterministic assignment), round-robin (equal distribution), or percentage-based (custom-weighted) distribution. All strategies support optional seed for reproducibility
How It Works
Query
Retrieves object IDs from Microsoft Graph endpoints (
/users, /devices, /applications, /servicePrincipals, or /groups/{id}/members) with optional OData filtering to narrow the populationShard
Applies one of four distribution strategies:
- Rendezvous: Highest Random Weight (HRW) algorithm for deterministic assignment
- Round-robin: Circular distribution for guaranteed equal sizes
- Percentage: Custom-weighted distribution (e.g., 10% pilot, 30% broader, 60% full)
- Size: Absolute fixed sizes (e.g., 50 pilot, 200 broader, remainder full)
Prerequisites
- Terraform 1.14.0 or later
- Microsoft 365 provider configured with appropriate credentials
- Required permissions:
User.Read.AllorDirectory.Read.All- For usersDevice.Read.AllorDirectory.Read.All- For devicesApplication.Read.AllorDirectory.Read.All- For applications/service principalsGroup.Read.AllorGroupMember.Read.All- For group members
Choosing the Right Strategy
Use this decision matrix to select the optimal strategy and seed combination for your use case:| Your Need | Strategy | Seed | Why |
|---|---|---|---|
| Same shards everywhere, shard count may change | rendezvous | ✅ Required | HRW algorithm minimizes reassignment when shard count changes |
| Different shards per rollout (avoid pilot fatigue) | rendezvous | ✅ Yes | Different seeds distribute pilot burden across different users |
| Exact equal sizes (e.g., 25% in each of 4 groups) | round-robin | 🟡 Optional | Round-robin guarantees equal sizes (±1). Add seed for reproducibility |
| Custom percentages, one-time split | percentage | ❌ None | Fast, no need for reproducibility |
| Custom percentages, reproducible | percentage | ✅ Yes | Seed ensures same users in same phases across runs |
| Absolute sizes (exactly 50 pilot users, 200 broader) | size | 🟡 Optional | Fixed capacities regardless of total population |
| Capacity testing / A/B testing | round-robin | ✅ Yes | Exact equal sizes + reproducible results |
Sharding Strategies
Strategy Comparison
| Strategy | Distribution Method | Seed | Equal Sizes | Custom Sizes | Best For |
|---|---|---|---|---|---|
rendezvous | Highest Random Weight | ✅ Required | ~Equal | ❌ No | Deterministic assignment with minimal disruption when adding/removing shards |
round-robin | Circular order | 🟡 Optional | ✅ Exact | ❌ No | Guaranteed equal distribution |
percentage | Sequential chunks | 🟡 Optional | ❌ No | ✅ Yes (%) | Custom-weighted phased rollouts |
size | Absolute sizes | 🟡 Optional | ❌ No | ✅ Yes (fixed) | Fixed capacity constraints |
Rendezvous Strategy (Highest Random Weight)
Uses the Highest Random Weight (HRW) algorithm for deterministic assignment. Each GUID-shard pair gets a hash weight, and the GUID goes to the shard with highest weight. Use When:- You need deterministic assignment based on GUID properties
- Want reproducible results across Terraform runs
- May need to add/remove shards later with minimal disruption
- Need to vary which users are in pilot groups across different rollouts (use different seeds)
Round-Robin Strategy
Distributes GUIDs in circular order, one to each shard in sequence. Use When:- You need exact equal distribution
- One-time split (no seed) or reproducible split (with seed)
- Doing statistical sampling or capacity testing
Percentage Strategy (Custom-Weighted)
Distributes GUIDs according to specified percentages. Use When:- Following specific rollout percentages (10% pilot, 30% expansion, 60% full)
- Implementing Windows Update rings with industry-standard distributions
- Need reproducible results with custom-sized shards (use seed)
Size Strategy (Absolute Counts)
Distributes GUIDs according to specified absolute shard sizes. Use When:- Support team can handle exactly N pilot users (e.g., 50 users max)
- Testing infrastructure has fixed capacity limits
- Compliance requires specific pilot sizes
Common Patterns
Pattern 1: MFA Progressive Rollout
Roll out MFA requirements in three phases: pilot, broader pilot, and full deployment.Pattern 2: Windows Update Deployment Rings
Implement industry-standard Windows Update rings with 5% early adopters, 15% IT validation, and 80% broad deployment.Pattern 3: Group Splitting and Resharding
Split an existing large group into multiple smaller groups for more granular policy targeting.Pattern 4: A/B Testing
Distribute users equally across multiple test groups for policy or feature testing.Seed Usage Patterns
Pattern: Unique Seed Per Rollout (Distribute Pilot Burden)
Use When:- Running multiple independent rollouts (MFA, Windows Updates, CA policies, etc.)
- Want to avoid same users always being in pilot groups
- Each rollout should have different distribution of who’s in which phase
Result: User X experiences different phases across rollouts, preventing pilot fatigue.
Anti-Patterns (Avoid These)
Best Practices
Start Small
Start Small
Begin with conservative pilot sizes (5-10%) to minimize impact if issues arise.
Use OData Filters
Use OData Filters
Exclude disabled accounts and filter by relevant attributes to ensure clean populations.
Use Unique Seeds to Distribute Pilot Burden
Use Unique Seeds to Distribute Pilot Burden
Different rollouts should use different seeds to prevent the same users from always being in pilot groups.
Monitor Shard Sizes
Monitor Shard Sizes
Output shard sizes to verify distribution matches expectations.
Use Report-Only Mode
Use Report-Only Mode
Start policies in report-only mode before enforcement.
Troubleshooting
Shard sizes don't match percentages exactly
Shard sizes don't match percentages exactly
Users moving between shards on re-run
Users moving between shards on re-run
Cause: Using
round-robin, percentage, or size strategy without a seed.Solution: Add a seed to make the strategy deterministic:Empty shards or API errors
Empty shards or API errors
Cause: OData filter too restrictive or no results found.Solution: Test your OData filter independently:
Related resources
Microsoft Graph API - Users
List users endpoint documentation
Microsoft Graph API - Devices
List devices endpoint documentation
Batch import
Discover and import existing M365 resources
Workspace design
Learn about workspace design patterns
