public override void ExecuteCmdlet() { if (ShouldProcess(string.Empty, Properties.Resources.CreateCertificatePolicy)) { var policy = new PSKeyVaultCertificatePolicy( DnsName, (KeyUsage == null || !KeyUsage.Any()) ? null : KeyUsage.Select(keyUsage => keyUsage.ToString()).ToList <string>(), Ekus, !Disabled.IsPresent, IssuerName, CertificateType, RenewAtNumberOfDaysBeforeExpiry, RenewAtPercentageLifetime, EmailAtNumberOfDaysBeforeExpiry, EmailAtPercentageLifetime, ReuseKeyOnRenewal.IsPresent, SecretContentType, SubjectName, ValidityInMonths, KeyType, KeySize, Curve, KeyNotExportable.IsPresent ? !KeyNotExportable.IsPresent : (bool?)null, CertificateTransparency ?? (bool?)null); this.WriteObject(policy); } }
public override void ExecuteCmdlet() { if (ShouldProcess(Name, Properties.Resources.SetCertificatePolicy)) { PSKeyVaultCertificatePolicy policy = new PSKeyVaultCertificatePolicy(); switch (ParameterSetName) { case ExpandedRenewNumberParameterSet: case ExpandedRenewPercentageParameterSet: policy = new PSKeyVaultCertificatePolicy( DnsName, (KeyUsage == null || !KeyUsage.Any()) ? null : KeyUsage.Select(keyUsage => keyUsage.ToString()).ToList <string>(), Ekus, !Disabled.IsPresent, IssuerName, CertificateType, RenewAtNumberOfDaysBeforeExpiry, RenewAtPercentageLifetime, EmailAtNumberOfDaysBeforeExpiry, EmailAtPercentageLifetime, ReuseKeyOnRenewal, SecretContentType, SubjectName, ValidityInMonths, KeyType, KeySize, Curve, KeyNotExportable.IsPresent ? !KeyNotExportable.IsPresent : (bool?)null, CertificateTransparency ?? (bool?)null); break; case ByValueParameterSet: InputObject.Validate(); policy = InputObject; break; } var resultantPolicy = DataServiceClient.UpdateCertificatePolicy(VaultName, Name, policy.ToCertificatePolicy()); if (PassThru.IsPresent) { this.WriteObject(resultantPolicy); } } }