0
0
Azurecloud~10 mins

Key rotation concepts in Azure - Interactive Code Practice

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

Complete the code to create a new key version for rotation in Azure Key Vault.

Azure
client = KeyClient(vault_url, credential)
new_key = client.create_key("myKey", [1])
Drag options to blanks, or click blank then click option'
AKeyType.RSA
BKeyType.secret
CKeyType.certificate
DKeyType.storage
Attempts:
3 left
💡 Hint
Common Mistakes
Using KeyType.secret instead of KeyType.RSA
Confusing key types with certificates
2fill in blank
medium

Complete the code to retrieve the latest version of a key for rotation.

Azure
key = client.get_key("myKey", [1])
Drag options to blanks, or click blank then click option'
Aversion='newest'
Bversion='latest'
Cversion='current'
Dversion=None
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string like 'latest' instead of None
Confusing version parameter with key name
3fill in blank
hard

Fix the error in the code to schedule key rotation policy correctly.

Azure
rotation_policy = KeyRotationPolicy(lifetime_actions=[[1]])
Drag options to blanks, or click blank then click option'
ALifetimeAction(action='Rotate', trigger=Trigger(time_after_create='P90D'))
BLifetimeAction(action_type='Rotate', trigger=Trigger(time_after_create=90))
CLifetimeAction(action='rotate', trigger=Trigger(time_after_create='P90D'))
DLifetimeAction(action_type='Rotate', trigger=Trigger(time_after_create='90D'))
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'action_type' instead of 'action'
Passing integer instead of ISO 8601 duration string
4fill in blank
hard

Fill both blanks to set a key rotation policy with expiry and rotation triggers.

Azure
policy = KeyRotationPolicy(lifetime_actions=[LifetimeAction(action=[1], trigger=Trigger(time_before_expiry=[2]))])
Drag options to blanks, or click blank then click option'
A'rotate'
B'notify'
C'P30D'
D'30D'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rotate' instead of 'notify' for notification
Using '30D' instead of 'P30D' for duration
5fill in blank
hard

Fill all three blanks to update the key rotation policy with rotation and notification triggers.

Azure
policy = KeyRotationPolicy(lifetime_actions=[
  LifetimeAction(action=[1], trigger=Trigger(time_after_create=[2])),
  LifetimeAction(action=[3], trigger=Trigger(time_before_expiry='P15D'))
])
Drag options to blanks, or click blank then click option'
A'rotate'
B'notify'
C'P90D'
D'P60D'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up action types
Using incorrect duration formats