Skip to content

Commit

Permalink
[KeyVault] Provide Warning Messages for soft delete
Browse files Browse the repository at this point in the history
  • Loading branch information
BethanyZhou committed Aug 17, 2020
1 parent 5f19e78 commit f56793a
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/KeyVault/KeyVault/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Added warning messages for planning to disable soft delete

## Version 2.0.0
* Removed two aliases: `New-AzKeyVaultCertificateAdministratorDetails` and `New-AzKeyVaultCertificateOrganizationDetails`
Expand Down
6 changes: 6 additions & 0 deletions src/KeyVault/KeyVault/Commands/NewAzureKeyVault.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ namespace Microsoft.Azure.Commands.KeyVault
/// <summary>
/// Create a new key vault.
/// </summary>
[GenericBreakingChange("The ability to create new key vaults with soft delete disabled will be deprecated by December 2020. " +
"All key vaults will be required to have soft delete enabled. Please see the following documentation for additional guidance. " +
"https://docs.microsoft.com/azure/key-vault/general/soft-delete-change")]
[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "KeyVault", SupportsShouldProcess = true)]
[OutputType(typeof(PSKeyVault))]
public class NewAzureKeyVault : KeyVaultManagementCmdletBase
Expand Down Expand Up @@ -84,6 +87,9 @@ public class NewAzureKeyVault : KeyVaultManagementCmdletBase
HelpMessage = "If specified, enables secrets to be retrieved from this key vault by Azure Disk Encryption.")]
public SwitchParameter EnabledForDiskEncryption { get; set; }

public const String DisableSoftDeleteChangeDesc = "DisableSoftDelete will be deprecated without being replaced.";

[CmdletParameterBreakingChange("DisableSoftDelete", "3.0.0", ChangeDescription = DisableSoftDeleteChangeDesc)]
[Parameter(Mandatory = false,
HelpMessage = "If specified, 'soft delete' functionality is disabled for this key vault.")]
public SwitchParameter DisableSoftDelete { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions src/KeyVault/KeyVault/Commands/RemoveAzureKeyVault.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@
using Microsoft.Azure.Commands.KeyVault.Properties;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
using System;
using System.Globalization;
using System.Management.Automation;

namespace Microsoft.Azure.Commands.KeyVault
{
[GenericBreakingChange("If you have soft-delete protection enabled on this key vault, you will not be able to reuse this key vault name until the key vault has been purged from the soft deleted state. " +
"Please see the following documentation for additional guidance. https://docs.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview")]
[Cmdlet("Remove", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "KeyVault",SupportsShouldProcess = true,DefaultParameterSetName = RemoveVaultParameterSet)]
[OutputType(typeof(bool))]
public class RemoveAzureKeyVault : KeyVaultManagementCmdletBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@
using Microsoft.Azure.Commands.KeyVault.Models;
using Microsoft.Azure.Commands.KeyVault.Properties;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;

namespace Microsoft.Azure.Commands.KeyVault
{
/// <summary>
/// The Remove-AzKeyVaultCertificate cmdlet deletes a certificate in an Azure Key Vault.
/// </summary>
[GenericBreakingChange("If you have soft-delete protection enabled on this key vault, this certificate will be moved to the soft deleted state. " +
"You will not be able to create a certificate with the same name within this key vault until the certificate has been purged from the soft-deleted state. " +
"Please see the following documentation for additional guidance. https://docs.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview")]
[Cmdlet("Remove", ResourceManager.Common.AzureRMConstants.AzurePrefix + "KeyVaultCertificate",SupportsShouldProcess = true,DefaultParameterSetName = ByVaultNameAndNameParameterSet)]
[OutputType(typeof(PSDeletedKeyVaultCertificate))]
public class RemoveAzureKeyVaultCertificate : KeyVaultCmdletBase
Expand Down
4 changes: 4 additions & 0 deletions src/KeyVault/KeyVault/Commands/RemoveAzureKeyVaultKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
using System.Management.Automation;
using Microsoft.Azure.Commands.KeyVault.Properties;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;

namespace Microsoft.Azure.Commands.KeyVault
{
[GenericBreakingChange("If you have soft - delete protection enabled on this key vault, this key will be moved to the soft deleted state. " +
"You will not be able to create a key with the same name within this key vault until the key has been purged from the soft-deleted state. " +
"Please see the following documentation for additional guidance.https://docs.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview")]
[Cmdlet("Remove", ResourceManager.Common.AzureRMConstants.AzurePrefix + "KeyVaultKey",SupportsShouldProcess = true,DefaultParameterSetName = ByVaultNameParameterSet)]
[OutputType(typeof(PSDeletedKeyVaultKey))]
public class RemoveAzureKeyVaultKey : KeyVaultCmdletBase
Expand Down
4 changes: 4 additions & 0 deletions src/KeyVault/KeyVault/Commands/RemoveAzureKeyVaultSecret.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
using Microsoft.Azure.Commands.KeyVault.Models;
using Microsoft.Azure.Commands.KeyVault.Properties;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
using System.Globalization;
using System.Management.Automation;

namespace Microsoft.Azure.Commands.KeyVault
{
[GenericBreakingChange("If you have soft-delete protection enabled on this key vault, this secret will be moved to the soft deleted state. " +
"You will not be able to create a secret with the same name within this key vault until the secret has been purged from the soft-deleted state. Please see the following documentation for additional guidance. " +
"https://docs.microsoft.com/en-us/azure/key-vault/general/soft-delete-overview")]
[Cmdlet("Remove", ResourceManager.Common.AzureRMConstants.AzurePrefix + "KeyVaultSecret",SupportsShouldProcess = true,DefaultParameterSetName = ByVaultNameParameterSet)]
[OutputType(typeof(PSDeletedKeyVaultSecret))]
public class RemoveAzureKeyVaultSecret : KeyVaultCmdletBase
Expand Down
4 changes: 4 additions & 0 deletions src/KeyVault/KeyVault/Commands/UpdateAzureKeyVault.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Microsoft.Azure.Commands.KeyVault.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -48,7 +49,10 @@ public class UpdateTopLevelResourceCommand : KeyVaultManagementCmdletBase
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = UpdateByResourceIdParameterSet, HelpMessage = "Resource ID of the key vault.")]
[ValidateNotNullOrEmpty]
public string ResourceId { get; set; }

public const String EnableSoftDeleteChangeDesc = "EnableSoftDelete will be deprecated without being replaced.";

[CmdletParameterBreakingChange("EnableSoftDelete", "3.0.0", ChangeDescription = EnableSoftDeleteChangeDesc)]
[Parameter(Mandatory = false, HelpMessage = "Enable the soft-delete functionality for this key vault. Once enabled it cannot be disabled.")]
public SwitchParameter EnableSoftDelete { get; set; }

Expand Down

0 comments on commit f56793a

Please sign in to comment.