Conditional access policies in Azure - Time & Space Complexity
When using conditional access policies, it's important to know how the system handles many users and conditions.
We want to understand how the time to evaluate policies grows as more users or conditions are added.
Analyze the time complexity of evaluating conditional access policies for user sign-in.
// Pseudocode for conditional access evaluation
foreach (policy in policies) {
if (policy.conditions match user) {
apply policy controls;
}
}
This sequence checks each policy against the user sign-in details to decide access controls.
Look at what repeats when evaluating policies.
- Primary operation: Checking each policy's conditions against the user sign-in.
- How many times: Once for each policy in the system.
As the number of policies grows, the system checks more conditions for each sign-in.
| Input Size (n) | Approx. Api Calls/Operations |
|---|---|
| 10 policies | 10 condition checks |
| 100 policies | 100 condition checks |
| 1000 policies | 1000 condition checks |
Pattern observation: The number of checks grows directly with the number of policies.
Time Complexity: O(n)
This means the time to evaluate policies grows in a straight line as more policies are added.
[X] Wrong: "Adding more policies won't affect evaluation time much because they run in parallel."
[OK] Correct: Even if some checks run at the same time, each policy still needs to be checked, so total work grows with the number of policies.
Understanding how conditional access scales helps you design secure and efficient cloud systems that handle many users smoothly.
"What if policies were grouped and evaluated by category instead of individually? How would that change the time complexity?"