Complete the code to create a new key version for rotation in Azure Key Vault.
client = KeyClient(vault_url, credential) new_key = client.create_key("myKey", [1])
To create a new key version for rotation, you specify the key type as RSA in Azure Key Vault.
Complete the code to retrieve the latest version of a key for rotation.
key = client.get_key("myKey", [1])
Passing None as the version retrieves the latest version of the key in Azure Key Vault.
Fix the error in the code to schedule key rotation policy correctly.
rotation_policy = KeyRotationPolicy(lifetime_actions=[[1]])The correct parameter name is action and the time format must be ISO 8601 duration like 'P90D'.
Fill both blanks to set a key rotation policy with expiry and rotation triggers.
policy = KeyRotationPolicy(lifetime_actions=[LifetimeAction(action=[1], trigger=Trigger(time_before_expiry=[2]))])
To notify before expiry, use action='notify' and time_before_expiry='P30D' (ISO 8601 format).
Fill all three blanks to update the key rotation policy with rotation and notification triggers.
policy = KeyRotationPolicy(lifetime_actions=[ LifetimeAction(action=[1], trigger=Trigger(time_after_create=[2])), LifetimeAction(action=[3], trigger=Trigger(time_before_expiry='P15D')) ])
The rotation action uses 'rotate' with a 90-day trigger, and notification uses 'notify' 15 days before expiry.