-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
Azure PS TeamKeyVaultTrackingWe will track status and follow internallyWe will track status and follow internallybugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.customer-reported
Description
Description
I am trying to remove the auto renewal from some of our certificates. If I try the below:
$KV = get-azkeyvault -VaultName <KVName>
$cert = $KV | Get-AzKeyVaultCertificate -Name "RBTest"
$cert | Set-AzKeyVaultCertificatePolicy -RenewAtNumberOfDaysBeforeExpiry $null -RenewAtPercentageLifetime $null
I get an error saying The argument is null, empty, or an element of the argument collection contains a null value.
If I try pulling down the current policy and setting it, as below, I get a request for the curve parameter, but then I get an error saying "Set-AzKeyVaultCertificatePolicy : Curve cannot be specified with RSA key type." if I try setting it
$KV = get-azkeyvault -VaultName <KVName>
$cert = $KV | Get-AzKeyVaultCertificate -Name "RBTest"
$policy = $cert | Get-AzKeyVaultCertificatePolicy
$policy.RenewAtNumberOfDaysBeforeExpiry = $null
$policy.RenewAtPercentageLifetime = $null
$policy.curve = "P-521"
$policy | Set-AzKeyVaultCertificatePolicy -VaultName $cert.Vaultname -Name $cert.Name
Issue script & Debug output
$KV = get-azkeyvault -VaultName <KVName>
$cert = $KV | Get-AzKeyVaultCertificate -Name "RBTest"
$policy = $cert | Get-AzKeyVaultCertificatePolicy
$policy.RenewAtNumberOfDaysBeforeExpiry = $null
$policy.RenewAtPercentageLifetime = $null
$policy.curve = "P-521"
$policy | Set-AzKeyVaultCertificatePolicy -VaultName $cert.Vaultname -Name $cert.Name
$cert | Set-AzKeyVaultCertificatePolicy -RenewAtNumberOfDaysBeforeExpiry $null -RenewAtPercentageLifetime $nullEnvironment data
PS C:\Users\RobBatley> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.22621.3880
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.3880
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1Module versions
get-module az.keyvault
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 6.0.1 Az.KeyVault {Add-AzKeyVaultCertificate, Add-AzKeyVaultCertificateContact, Add-AzKeyVaultKey, Add-AzKeyVaultManagedStorageAccount...}Error output
Message : Curve cannot be specified with RSA key type.
StackTrace : at Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificatePolicy.ValidateKeyTypeAndCurve(String keyType, String curve)
at Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificatePolicy.ValidateInternal(IList`1 dnsNames, IList`1 ekus, Nullable`1 renewAtNumberOfDaysBeforeExpiry, Nullable`1 renewAtPercentageLifetime, Nullable`1
emailAtNumberOfDaysBeforeExpiry, Nullable`1 emailAtPercentageLifetime, String subjectName, String keyType, Int32 keySize, String curve)
at Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificatePolicy.Validate()
at Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificatePolicy.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception : System.ArgumentException
InvocationInfo : {Set-AzKeyVaultCertificatePolicy}
Line : $policy | Set-AzKeyVaultCertificatePolicy -VaultName $cert.Vaultname -Name $cert.Name
Position : At line:12 char:11
+ $policy | Set-AzKeyVaultCertificatePolicy -VaultName $cert.Vaultname ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 18
Message : Cannot validate argument on parameter 'RenewAtNumberOfDaysBeforeExpiry'. The argument is null, empty, or an element of the argument collection contains a null value. Supply a collection that does not contain any null values and then try
the command again.
StackTrace : at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
at System.Management.Automation.CmdletParameterBinderController.BindParameter(CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
at System.Management.Automation.CmdletParameterBinderController.BindParameter(UInt32 parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
at System.Management.Automation.CmdletParameterBinderController.BindParameters(UInt32 parameterSets, Collection`1 arguments)
at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection`1 arguments)
at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1 arguments)
at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues)
at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][] commandRedirections, FunctionContext
funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Exception : System.Management.Automation.ParameterBindingValidationException
InvocationInfo : {Set-AzKeyVaultCertificatePolicy}
Line : $cert | Set-AzKeyVaultCertificatePolicy -RenewAtNumberOfDaysBeforeExpiry $null
Position : At line:1 char:74
+ ... et-AzKeyVaultCertificatePolicy -RenewAtNumberOfDaysBeforeExpiry $null
+ ~~~~~
HistoryId : 8Metadata
Metadata
Assignees
Labels
Azure PS TeamKeyVaultTrackingWe will track status and follow internallyWe will track status and follow internallybugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.customer-reported