Blob containers and access levels in Azure - Time & Space Complexity
We want to understand how the time to set or check access levels on blob containers changes as the number of containers grows.
How does the number of containers affect the operations needed to manage access?
Analyze the time complexity of the following operation sequence.
// Loop through a list of blob containers
foreach (var container in containers) {
// Set the public access level for each container
container.SetAccessPolicy(PublicAccessType.Blob);
}
This code sets the access level for each blob container in a list to allow public read access to blobs.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: Setting access level on each blob container via API call.
- How many times: Once per container in the list.
Each container requires one API call to set its access level, so the total calls grow directly with the number of containers.
| Input Size (n) | Approx. Api Calls/Operations |
|---|---|
| 10 | 10 |
| 100 | 100 |
| 1000 | 1000 |
Pattern observation: The number of operations increases linearly as the number of containers increases.
Time Complexity: O(n)
This means the time to set access levels grows directly in proportion to the number of blob containers.
[X] Wrong: "Setting access levels on multiple containers is a single operation regardless of count."
[OK] Correct: Each container requires its own API call, so the total time grows with the number of containers.
Understanding how operations scale with resource count helps you design efficient cloud management scripts and shows you think about real-world system behavior.
"What if we batch set access levels for multiple containers in one API call? How would the time complexity change?"
Practice
private mean?Solution
Step 1: Understand the meaning of
Private means no public access; only authorized users can access blobs.privateaccess levelStep 2: Compare with other access levels
Unlikebloborcontainerlevels, private restricts all public read or list operations.Final Answer:
Only the owner can read or list blobs in the container. -> Option CQuick Check:
Private access = owner-only access [OK]
- Confusing private with blob-level public read
- Thinking private allows public listing
- Assuming private deletes container automatically
Solution
Step 1: Identify the access level for public read of blobs only
Theblobaccess level allows public read of blobs but not container listing.Step 2: Match the Azure CLI command syntax
The command uses--public-access blobto set this level correctly.Final Answer:
az storage container set-permission --name mycontainer --public-access blob -> Option BQuick Check:
Blob access = public read blobs only [OK]
- Using 'container' instead of 'blob' for public read
- Using 'private' which disables public access
- Using 'none' which is invalid in Azure CLI
container, what will happen if an anonymous user tries to list blobs in the container?Solution
Step 1: Understand the
This level allows anonymous users to list blobs and read blob content.containeraccess levelStep 2: Analyze anonymous user permissions
Anonymous users can list blobs and read blobs but cannot modify or delete.Final Answer:
The user can list blobs and read blob content anonymously. -> Option AQuick Check:
Container access = public list and read [OK]
- Confusing container with blob access level
- Assuming anonymous users cannot list blobs
- Thinking container blocks anonymous requests
blob but anonymous users report they cannot list blobs. What is the most likely cause?Solution
Step 1: Recall what
Blob access allows anonymous read of blobs but not listing blobs in the container.blobaccess level permitsStep 2: Evaluate other options for likelihood
Incorrect container name or disabled account would cause different errors; encryption does not block listing.Final Answer:
Blob access level does not allow listing blobs publicly. -> Option DQuick Check:
Blob access = no public listing [OK]
- Expecting blob access to allow listing
- Blaming encryption for listing issues
- Ignoring container name correctness
Solution
Step 1: Identify the requirement for public read without listing
You want users to read files but not see all file names.Step 2: Match access level to requirement
blobaccess allows public read of blobs but prevents listing container contents.Step 3: Exclude other options
privateblocks public read;containerallows listing;publicis not a valid access level.Final Answer:
Set access level toblobto allow public read of blobs but block listing. -> Option AQuick Check:
Blob access = public read, no listing [OK]
- Choosing container access which allows listing
- Using private which blocks public read
- Thinking 'public' is a valid access level
Ready to prove it?
Pass the test and this pattern moves unknown
