Edit

Share via


Set-AzKeyVaultCertificatePolicy

Creates or updates the policy for a certificate in a key vault.

Syntax

ExpandedRenewPercentage (Default)

Set-AzKeyVaultCertificatePolicy
    [-VaultName] <String>
    [-Name] <String>
    [-RenewAtPercentageLifetime <Int32>]
    [-SecretContentType <String>]
    [-ReuseKeyOnRenewal <Boolean>]
    [-Disabled]
    [-SubjectName <String>]
    [-DnsName <System.Collections.Generic.List`1[System.String]>]
    [-KeyUsage <System.Collections.Generic.List`1[System.Security.Cryptography.X509Certificates.X509KeyUsageFlags]>]
    [-Ekus <System.Collections.Generic.List`1[System.String]>]
    [-ValidityInMonths <Int32>]
    [-IssuerName <String>]
    [-CertificateType <String>]
    [-EmailAtNumberOfDaysBeforeExpiry <Int32>]
    [-EmailAtPercentageLifetime <Int32>]
    [-KeyType <String>]
    [-KeySize <Int32>]
    [-KeyNotExportable]
    [-CertificateTransparency <Boolean>]
    [-PassThru]
    [-Curve <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByValue

Set-AzKeyVaultCertificatePolicy
    [-VaultName] <String>
    [-Name] <String>
    [-InputObject] <PSKeyVaultCertificatePolicy>
    [-EmailAtNumberOfDaysBeforeExpiry <Int32>]
    [-EmailAtPercentageLifetime <Int32>]
    [-KeyType <String>]
    [-KeySize <Int32>]
    [-CertificateTransparency <Boolean>]
    [-PassThru]
    [-Curve <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ExpandedRenewNumber

Set-AzKeyVaultCertificatePolicy
    [-VaultName] <String>
    [-Name] <String>
    -RenewAtNumberOfDaysBeforeExpiry <Int32>
    [-SecretContentType <String>]
    [-ReuseKeyOnRenewal <Boolean>]
    [-Disabled]
    [-SubjectName <String>]
    [-DnsName <System.Collections.Generic.List`1[System.String]>]
    [-KeyUsage <System.Collections.Generic.List`1[System.Security.Cryptography.X509Certificates.X509KeyUsageFlags]>]
    [-Ekus <System.Collections.Generic.List`1[System.String]>]
    [-ValidityInMonths <Int32>]
    [-IssuerName <String>]
    [-CertificateType <String>]
    [-EmailAtNumberOfDaysBeforeExpiry <Int32>]
    [-EmailAtPercentageLifetime <Int32>]
    [-KeyType <String>]
    [-KeySize <Int32>]
    [-KeyNotExportable]
    [-CertificateTransparency <Boolean>]
    [-PassThru]
    [-Curve <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Set-AzKeyVaultCertificatePolicy cmdlet creates or updates the policy for a certificate in a key vault.

Examples

Example 1: Set a certificate policy

Set-AzKeyVaultCertificatePolicy -VaultName "ContosoKV01" -Name "TestCert01" -SecretContentType "application/x-pkcs12" -SubjectName "CN=contoso.com" -IssuerName "Self" -ValidityInMonths 6 -ReuseKeyOnRenewal $True -PassThru
SecretContentType               : application/x-pkcs12
Kty                             :
KeySize                         : 2048
Curve                           :
Exportable                      :
ReuseKeyOnRenewal               : True
SubjectName                     : CN=contoso.com
DnsNames                        :
KeyUsage                        :
Ekus                            :
ValidityInMonths                : 6
IssuerName                      : Self
CertificateType                 :
RenewAtNumberOfDaysBeforeExpiry :
RenewAtPercentageLifetime       :
EmailAtNumberOfDaysBeforeExpiry :
EmailAtPercentageLifetime       :
CertificateTransparency         :
Enabled                         : True
Created                         :
Updated                         :

This command sets the policy for the TestCert01 certificate in the ContosoKV01 key vault.

Parameters

-CertificateTransparency

Indicates whether certificate transparency is enabled for this certificate/issuer; if not specified, the default is 'true'. -IssuerName needs to be specified when setting this property.

Parameter properties

Type:

Nullable<T>[Boolean]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CertificateType

Specifies the type of certificate to the issuer.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedRenewPercentage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ExpandedRenewNumber
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Curve

Specifies the elliptic curve name of the key of the certificate. The acceptable values for this parameter are:

  • P-256
  • P-384
  • P-521
  • P-256K
  • SECP256K1

Parameter properties

Type:String
Default value:None
Accepted values:P-256, P-384, P-521, P-256K, SECP256K1
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Disabled

Indicates that the certificate policy is disabled.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedRenewPercentage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ExpandedRenewNumber
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DnsName

Specifies the subject name of the certificate.

Parameter properties

Type:

List<T>[String]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:DnsNames

Parameter sets

ExpandedRenewPercentage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ExpandedRenewNumber
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Ekus

Specifies the enhanced key usages (EKUs) in the certificate.

Parameter properties

Type:

List<T>[String]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedRenewPercentage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ExpandedRenewNumber
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EmailAtNumberOfDaysBeforeExpiry

Specifies the number of days before expiration when automatic renewal should start.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-EmailAtPercentageLifetime

Specifies the percentage of the lifetime after which the automatic process for the notification begins.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

Specifies the certificate policy.

Parameter properties

Type:PSKeyVaultCertificatePolicy
Default value:None
Supports wildcards:False
DontShow:False
Aliases:CertificatePolicy

Parameter sets

ByValue
Position:2
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-IssuerName

Specifies the name of the issuer for this certificate.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedRenewPercentage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ExpandedRenewNumber
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-KeyNotExportable

Indicates that the key is not exportable.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedRenewPercentage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ExpandedRenewNumber
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-KeySize

Specifies the key size of the certificate. The acceptable values for this parameter are:

  • 2048
  • 3072
  • 4096
  • 256
  • 384
  • 521

Parameter properties

Type:Int32
Default value:2048
Accepted values:2048, 3072, 4096, 256, 384, 521
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-KeyType

Specifies the key type of the key that backs the certificate. The acceptable values for this parameter are:

  • RSA
  • RSA-HSM
  • EC
  • EC-HSM

Parameter properties

Type:String
Default value:RSA
Accepted values:RSA, RSA-HSM, EC, EC-HSM
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-KeyUsage

Specifies the key usages in the certificate.

Parameter properties

Type:

List<T>[X509KeyUsageFlags]

Default value:None
Accepted values:None, EncipherOnly, CrlSign, KeyCertSign, KeyAgreement, DataEncipherment, KeyEncipherment, NonRepudiation, DigitalSignature, DecipherOnly
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedRenewPercentage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ExpandedRenewNumber
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the name of the certificate.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:CertificateName

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PassThru

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RenewAtNumberOfDaysBeforeExpiry

Specifies the number of days before expiry after which the automatic process for certificate renewal begins.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedRenewNumber
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RenewAtPercentageLifetime

Specifies the percentage of the lifetime after which the automatic process for certificate renewal begins.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedRenewPercentage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ReuseKeyOnRenewal

Indicates that the certificate reuse the key during renewal.

Parameter properties

Type:

Nullable<T>[Boolean]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedRenewPercentage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ExpandedRenewNumber
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SecretContentType

Specifies the content type of the new key vault secret. The acceptable values for this parameter are:

  • application/x-pkcs12
  • application/x-pem-file

Parameter properties

Type:String
Default value:None
Accepted values:application/x-pkcs12, application/x-pem-file
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedRenewPercentage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ExpandedRenewNumber
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SubjectName

Specifies the subject name of the certificate.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedRenewPercentage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ExpandedRenewNumber
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ValidityInMonths

Specifies the number of months the certificate is valid.

Parameter properties

Type:

Nullable<T>[Int32]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ExpandedRenewPercentage
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ExpandedRenewNumber
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VaultName

Specifies the name of a key vault.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

PSKeyVaultCertificatePolicy

Outputs

PSKeyVaultCertificatePolicy