Azure AD tenants and directories - Time & Space Complexity
When working with Azure AD tenants and directories, it's important to understand how operations scale as you add more users or groups.
We want to know how the time to complete tasks grows when the directory size increases.
Analyze the time complexity of listing all users in an Azure AD tenant.
// Using Azure CLI to list users in a tenant
az ad user list --all
// Or using Microsoft Graph API to get users
GET https://graph.microsoft.com/v1.0/users
This operation fetches all user objects from the Azure AD directory.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: API call to fetch user objects from Azure AD.
- How many times: Once per page of results; multiple calls if many users.
As the number of users grows, the number of API calls and data transferred grows roughly in proportion.
| Input Size (n) | Approx. API Calls/Operations |
|---|---|
| 10 | 1 call |
| 100 | 1-2 calls |
| 1000 | 10 calls |
Pattern observation: More users mean more calls and data, growing roughly linearly.
Time Complexity: O(n)
This means the time to list all users grows directly with the number of users in the directory.
[X] Wrong: "Listing users takes the same time no matter how many users exist."
[OK] Correct: More users mean more data to fetch and more API calls, so time grows with user count.
Understanding how directory operations scale helps you design efficient cloud solutions and handle large user bases confidently.
"What if we filtered users by a property instead of listing all? How would the time complexity change?"