0
0
Azurecloud~5 mins

Key Vault creation in Azure - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: Key Vault creation
O(n)
Understanding Time Complexity

When creating a Key Vault in Azure, it's important to understand how the time to complete the creation grows as you add more resources or configurations.

We want to know how the number of operations changes as we create more Key Vaults or add more settings.

Scenario Under Consideration

Analyze the time complexity of the following operation sequence.


// Create a Key Vault with basic settings
az keyvault create \
  --name MyKeyVault \
  --resource-group MyResourceGroup \
  --location eastus

// Add access policies
az keyvault set-policy \
  --name MyKeyVault \
  --object-id 00000000-0000-0000-0000-000000000000 \
  --secret-permissions get list
    

This sequence creates one Key Vault and sets one access policy on it.

Identify Repeating Operations

Identify the API calls, resource provisioning, data transfers that repeat.

  • Primary operation: Creating a Key Vault resource (az keyvault create)
  • Secondary operation: Setting access policies (az keyvault set-policy)
  • How many times: Each Key Vault creation is one operation; each access policy added is one operation per policy.
How Execution Grows With Input

As you create more Key Vaults, the number of create operations grows directly with the number of vaults.

Also, adding more access policies means more set-policy calls, growing with the number of policies.

Input Size (n)Approx. Api Calls/Operations
10 Key Vaults, 1 policy each10 create + 10 set-policy = 20
100 Key Vaults, 5 policies each100 create + 500 set-policy = 600
1000 Key Vaults, 10 policies each1000 create + 10,000 set-policy = 11,000

Pattern observation: The total operations grow proportionally with the number of vaults and policies.

Final Time Complexity

Time Complexity: O(n)

This means the time to create Key Vaults and set policies grows linearly with the number of vaults and policies.

Common Mistake

[X] Wrong: "Creating multiple Key Vaults at once takes the same time as creating one."

[OK] Correct: Each Key Vault creation is a separate operation that takes time, so more vaults mean more total time.

Interview Connect

Understanding how resource creation scales helps you design efficient cloud deployments and answer questions about automation and scaling in interviews.

Self-Check

"What if we batch multiple access policies in a single API call? How would the time complexity change?"