Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KeyVault] - Fix key rotation sample #18100

Merged
merged 1 commit into from
Oct 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions sdk/keyvault/keyvault-keys/samples-dev/keyRotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,30 @@ export async function main(): Promise<void> {
const key = await client.createKey(keyName, "EC");
console.log("created key", key);

// Set the key's automated rotation policy to rotate 30 days before the key expires.
// Set the key's automated rotation policy to rotate the key 30 days after the key is created.
const policy = await client.updateKeyRotationPolicy(key.name, {
lifetimeActions: [
{
action: "Rotate",
timeBeforeExpiry: "P30D"
timeAfterCreate: "P30D"
}
],
expiresIn: "P90D"
]
});
console.log("created policy", policy);

// Get the key's current rotation policy
const currentPolicy = await client.getKeyRotationPolicy(key.name);
console.log("fetched policy", currentPolicy);

// Update the key's automated rotation policy to notify 30 days after the key was created
// Update the key's automated rotation policy to notify 30 days before the key expires.
const updatedPolicy = await client.updateKeyRotationPolicy(key.name, {
lifetimeActions: [
{
action: "Notify",
timeAfterCreate: "P30D"
timeBeforeExpiry: "P30D"
}
]
],
expiresIn: "P90D"
});
console.log("updated policy", updatedPolicy);

Expand Down