0
0
Azurecloud~10 mins

Why secrets management matters in Azure - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to retrieve a secret from Azure Key Vault.

Azure
secret = client.get_secret([1])
Drag options to blanks, or click blank then click option'
AgetSecret
BmySecret
C"mySecret"
DsecretName
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the secret name without quotes causes an error.
Using a wrong method name instead of get_secret.
2fill in blank
medium

Complete the code to create a Key Vault client with default Azure credentials.

Azure
client = SecretClient(vault_url=[1], credential=DefaultAzureCredential())
Drag options to blanks, or click blank then click option'
A"https://myvault.vault.azure.net/"
Bhttps://vault.azure.net/myvault
Cvault_url
Dmyvault
Attempts:
3 left
💡 Hint
Common Mistakes
Using only the vault name without the full URL.
Incorrect URL format missing https or domain.
3fill in blank
hard

Fix the error in the code to securely store a secret in Azure Key Vault.

Azure
client.set_secret([1], "mySecretValue")
Drag options to blanks, or click blank then click option'
A"mySecret"
BsecretValue
CmySecretValue
DsetSecret
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping secret name and value arguments.
Passing secret name without quotes.
4fill in blank
hard

Fill both blanks to check if a secret exists and print its value.

Azure
try:
    secret = client.get_secret([1])
    print(secret.[2])
except ResourceNotFoundError:
    print("Secret not found")
Drag options to blanks, or click blank then click option'
A"mySecret"
Bvalue
Cname
Dsecret
Attempts:
3 left
💡 Hint
Common Mistakes
Using the secret name without quotes.
Trying to print the secret object directly instead of its value.
5fill in blank
hard

Fill all three blanks to create a secret, retrieve it, and print its value.

Azure
client.set_secret([1], [2])
retrieved = client.get_secret([3])
print(retrieved.value)
Drag options to blanks, or click blank then click option'
A"appSecret"
B"s3cr3tValue"
D"wrongSecret"
Attempts:
3 left
💡 Hint
Common Mistakes
Using different secret names for set and get.
Not using quotes around secret names or values.