Bird
Raised Fist0
Azurecloud~20 mins

Key Vault creation in Azure - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Key Vault Creation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Architecture
intermediate
2:00remaining
Key Vault Network Access Configuration

You create an Azure Key Vault and want to restrict access to only your company's on-premises network using a firewall rule. Which configuration will correctly restrict access?

ADisable the firewall and rely on Azure Active Directory authentication only.
BEnable the firewall and add the on-premises public IP address range to the Key Vault's allowed IP addresses.
CSet the Key Vault firewall to allow access from all networks and configure access policies to restrict users.
DEnable the firewall and add the on-premises private IP address range to the Key Vault's allowed IP addresses.
Attempts:
2 left
💡 Hint

Think about which IP addresses are visible to Azure services when connecting from on-premises.

❓ service_behavior
intermediate
2:00remaining
Key Vault Access Policy Behavior

You have a Key Vault with multiple access policies. One policy grants a user read access to secrets. Another policy denies all permissions to the same user. What will happen when the user tries to read a secret?

AThe user will have read access because allow policies are cumulative and deny policies do not exist in Key Vault.
BThe user will be denied access because deny policies override allow policies.
CThe user will have no access because conflicting policies cause an error.
DThe user will have read access only if they authenticate with a managed identity.
Attempts:
2 left
💡 Hint

Consider how Azure Key Vault combines multiple access policies.

❓ Configuration
advanced
2:00remaining
ARM Template for Key Vault Creation with Soft Delete

Which ARM template snippet correctly creates an Azure Key Vault with soft delete enabled and a 90-day retention period?

A
{
  "type": "Microsoft.KeyVault/vaults",
  "apiVersion": "2022-07-01",
  "name": "myKeyVault",
  "properties": {
    "enablePurgeProtection": true,
    "softDeleteRetentionInDays": 90
  }
}
B
{
  "type": "Microsoft.KeyVault/vaults",
  "apiVersion": "2022-07-01",
  "name": "myKeyVault",
  "properties": {
    "enableSoftDelete": true
  }
}
C
{
  "type": "Microsoft.KeyVault/vaults",
  "apiVersion": "2022-07-01",
  "name": "myKeyVault",
  "properties": {
    "enableSoftDelete": true,
    "softDeleteRetentionInDays": 90
  }
}
D
{
  "type": "Microsoft.KeyVault/vaults",
  "apiVersion": "2022-07-01",
  "name": "myKeyVault",
  "properties": {
    "enableSoftDelete": false,
    "softDeleteRetentionInDays": 90
  }
}
Attempts:
2 left
💡 Hint

Soft delete must be enabled explicitly and retention days set.

❓ security
advanced
2:00remaining
Key Vault Managed Identity Access

You want an Azure VM to access secrets in a Key Vault without storing credentials in the VM. Which setup achieves this securely?

AUse a shared access signature (SAS) token to authenticate the VM to the Key Vault.
BStore the Key Vault access key as a secret in the VM's local storage and use it to authenticate.
CCreate a user-assigned managed identity and assign it to the VM, then grant it access in the Key Vault access policies.
DAssign a system-assigned managed identity to the VM and grant it access in the Key Vault access policies.
Attempts:
2 left
💡 Hint

Consider how Azure manages identities for resources securely.

🧠 Conceptual
expert
2:00remaining
Key Vault Soft Delete and Purge Protection Behavior

After enabling soft delete and purge protection on a Key Vault, what happens if a user deletes a secret and then attempts to permanently delete (purge) it before the retention period ends?

AThe secret is moved to a soft deleted state and cannot be purged until the retention period expires because purge protection is enabled.
BThe secret is deleted and purged immediately, but the Key Vault itself cannot be deleted.
CThe secret remains accessible and cannot be deleted while purge protection is enabled.
DThe secret is immediately and permanently deleted, bypassing soft delete due to purge protection.
Attempts:
2 left
💡 Hint

Think about how soft delete and purge protection work together to protect data.

Practice

(1/5)
1. What is the primary purpose of an Azure Key Vault?
easy
A. To host virtual machines
B. To manage Azure subscriptions
C. To securely store secrets, keys, and certificates
D. To monitor network traffic

Solution

  1. Step 1: Understand Azure Key Vault's role

    Azure Key Vault is designed to securely store sensitive information like secrets, keys, and certificates.
  2. Step 2: Compare with other Azure services

    Hosting VMs, managing subscriptions, and monitoring traffic are done by other Azure services, not Key Vault.
  3. Final Answer:

    To securely store secrets, keys, and certificates -> Option C
  4. Quick Check:

    Key Vault = Secure storage for secrets [OK]
Hint: Key Vault is for secrets and keys storage only [OK]
Common Mistakes:
  • Confusing Key Vault with VM hosting
  • Thinking Key Vault manages subscriptions
  • Assuming Key Vault monitors network
2. Which Azure CLI command correctly creates a Key Vault named myVault in the resource group myResourceGroup located in eastus?
easy
A. az keyvault create --name myVault --resource-group myResourceGroup --location eastus
B. az keyvault new --vault-name myVault --group myResourceGroup --region eastus
C. az vault create --name myVault --resource-group myResourceGroup --location eastus
D. az keyvault create --vault myVault --resource myResourceGroup --location eastus

Solution

  1. Step 1: Identify correct Azure CLI syntax

    The correct command uses az keyvault create with parameters --name, --resource-group, and --location.
  2. Step 2: Check each option's parameters

    az keyvault create --name myVault --resource-group myResourceGroup --location eastus matches the correct syntax exactly. Options B, C, and D use incorrect commands or parameter names.
  3. Final Answer:

    az keyvault create --name myVault --resource-group myResourceGroup --location eastus -> Option A
  4. Quick Check:

    Correct CLI syntax = az keyvault create --name myVault --resource-group myResourceGroup --location eastus [OK]
Hint: Use 'az keyvault create' with --name and --resource-group [OK]
Common Mistakes:
  • Using 'az keyvault new' instead of 'create'
  • Wrong parameter names like --vault or --group
  • Omitting required parameters
3. Given this Azure CLI command:
az keyvault create --name testVault --resource-group testGroup --location westus --enable-soft-delete false

What will be the state of soft delete on the created Key Vault?
medium
A. Soft delete will be enabled by default
B. Soft delete will be disabled as specified
C. Soft delete will be enabled only if the region supports it
D. Command will fail due to invalid parameter

Solution

  1. Step 1: Check parameter validity

    The parameter --enable-soft-delete is deprecated and cannot be set to false; soft delete is always enabled now.
  2. Step 2: Understand command behavior

    Setting --enable-soft-delete false causes the command to fail because disabling soft delete is not allowed.
  3. Final Answer:

    Command will fail due to invalid parameter -> Option D
  4. Quick Check:

    Soft delete cannot be disabled now = Command will fail due to invalid parameter [OK]
Hint: Soft delete is always enabled; disabling causes error [OK]
Common Mistakes:
  • Assuming soft delete can be turned off
  • Ignoring deprecation of --enable-soft-delete
  • Thinking soft delete depends on region
4. You run this command to create a Key Vault:
az keyvault create --name vault123 --resource-group group123 --location eastus

But you get an error: ResourceGroupNotFound. What is the most likely fix?
medium
A. Change the location to westus
B. Create the resource group group123 before creating the Key Vault
C. Use a different Key Vault name
D. Add --enable-soft-delete true to the command

Solution

  1. Step 1: Understand the error

    ResourceGroupNotFound means the specified resource group does not exist.
  2. Step 2: Fix by creating the resource group

    You must create the resource group group123 first using az group create before creating resources inside it.
  3. Final Answer:

    Create the resource group group123 before creating the Key Vault -> Option B
  4. Quick Check:

    Resource group must exist before Key Vault creation [OK]
Hint: Create resource group first to avoid ResourceGroupNotFound [OK]
Common Mistakes:
  • Trying to change location instead of creating group
  • Changing vault name without checking group
  • Adding unrelated parameters to fix error
5. You want to create an Azure Key Vault with these requirements:
- Name: secureVault
- Resource group: prodGroup
- Location: centralus
- Enable soft delete
- Set access policy to allow user with object ID 1234abcd to get and list secrets

Which Azure CLI command sequence correctly achieves this?
hard
A. az keyvault create --name secureVault --resource-group prodGroup --location centralus && az keyvault set-policy --name secureVault --object-id 1234abcd --secret-permissions get list
B. az keyvault create --name secureVault --resource-group prodGroup --location centralus --enable-soft-delete true --access-policy object-id=1234abcd permissions=secrets:get,list
C. az keyvault create --name secureVault --resource-group prodGroup --location centralus --enable-soft-delete false && az keyvault set-policy --name secureVault --object-id 1234abcd --secret-permissions get list
D. az keyvault create --name secureVault --resource-group prodGroup --location centralus && az keyvault set-policy --name secureVault --object-id 1234abcd --secret-permissions get,list

Solution

  1. Step 1: Create Key Vault with default soft delete enabled

    Soft delete is enabled by default and cannot be disabled, so no need to specify it.
  2. Step 2: Set access policy with correct syntax

    Use az keyvault set-policy with --object-id and --secret-permissions get list to allow the user to get and list secrets.
  3. Step 3: Verify command correctness

    az keyvault create --name secureVault --resource-group prodGroup --location centralus && az keyvault set-policy --name secureVault --object-id 1234abcd --secret-permissions get list uses correct commands and parameters. az keyvault create --name secureVault --resource-group prodGroup --location centralus && az keyvault set-policy --name secureVault --object-id 1234abcd --secret-permissions get,list incorrectly uses comma between permissions. az keyvault create --name secureVault --resource-group prodGroup --location centralus --enable-soft-delete true --access-policy object-id=1234abcd permissions=secrets:get,list uses invalid parameters. az keyvault create --name secureVault --resource-group prodGroup --location centralus --enable-soft-delete false && az keyvault set-policy --name secureVault --object-id 1234abcd --secret-permissions get list tries to disable soft delete, which is invalid.
  4. Final Answer:

    az keyvault create --name secureVault --resource-group prodGroup --location centralus && az keyvault set-policy --name secureVault --object-id 1234abcd --secret-permissions get list -> Option A
  5. Quick Check:

    Create then set-policy with correct permissions = az keyvault create --name secureVault --resource-group prodGroup --location centralus && az keyvault set-policy --name secureVault --object-id 1234abcd --secret-permissions get list [OK]
Hint: Create vault first, then set access policy with correct permissions [OK]
Common Mistakes:
  • Trying to disable soft delete
  • Using wrong parameter names for access policy
  • Combining all settings in one invalid command