Create Certificate - Create Certificate

Creates a new certificate.
If this is the first version, the certificate resource is created. This operation requires the certificates/create permission.

POST {vaultBaseUrl}/certificates/{certificate-name}/create?api-version=7.0

URI Parameters

Name In Required Type Description
vaultBaseUrl
path True
  • string

The vault name, for example https://myvault.vault.azure.net.

certificate-name
path True
  • string

The name of the certificate.

Regex pattern: ^[0-9a-zA-Z-]+$

api-version
query True
  • string

Client API version.

Request Body

Name Type Description
attributes

The attributes of the certificate (optional).

policy

The management policy for the certificate.

tags
  • object

Application specific metadata in the form of key-value pairs.

Responses

Name Type Description
202 Accepted

Created certificate bundle.

Other Status Codes

Key Vault error response describing why the operation failed.

Examples

CreateCertificate

Sample Request

POST {vaultBaseUrl}/certificates/selfSignedCert01/create?api-version=7.0
{
  "policy": {
    "key_props": {
      "exportable": true,
      "kty": "RSA",
      "key_size": 2048,
      "reuse_key": false
    },
    "secret_props": {
      "contentType": "application/x-pkcs12"
    },
    "x509_props": {
      "subject": "CN=*.microsoft.com",
      "sans": {
        "dns_names": [
          "onedrive.microsoft.com",
          "xbox.microsoft.com"
        ]
      }
    },
    "issuer": {
      "name": "Self"
    }
  }
}

Sample Response

{
  "id": "https://testvault1021.vault.azure.net/certificates/selfSignedCert01/pending",
  "issuer": {
    "name": "Self"
  },
  "csr": "MIIC4zCCAcsCAQAwGjEYMBYGA1UEAwwPKi5taWNyb3NvZnQuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqe8aINnShK+wQC8QU7fwsviQc9+yiOnqU3adXA6qNjn21HTdRBa7cyQIk1STxHIBLTT/GaEJwqsUi6UvZaPEHokOWsr1bP9M7xOPTicBcRyMrr6bOxsmGczYtu1z2TzzXDD7q7IEignE7/LowGEaIADCIU9iuWk7TiJ+1Q/VLh/B3xPsgVjY+n7zEQ53gBiDHSl7XfELfwmslOQ28TVNogUyXsxHcVxQQYJeI7HqqY448LeleK69Ld86lkBixLEm1pD7HSbEx3WI2lyUQAGR6hD3YFaiIWVpQeEyI7p1jmtQlnfZdEL4q9wdlEEcwd3h3PAZpEBhCixahF54fci3pwIDAQABoIGDMIGABgkqhkiG9w0BCQ4xczBxMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwNQYDVR0RBC4wLIIWb25lZHJpdmUubWljcm9zb2Z0LmNvbYISeGJveC5taWNyb3NvZnQuY29tMAkGA1UdEwQCMAAwDQYJKoZIhvcNAQELBQADggEBACiLeghirF+yCuYGVUPDB3wKQJn2iLY1za9ncxCehIVqOkFK09AphzoxF6Yid90AKCaa/dT/Ohm7oTyVQ+YcZnT00LUNFVG48AOE8YDiw9tjAG9OORsAz80xnv2qaLw2TCVIQ6NjrI83LqAm1GJ8rAnpdD/ZTuWM7TvSO5g/jm/Q0oSuKpMgj3YxpwgB9Ac6YEfVzOnm76OkUcpvR5MS4BoTfRv4thdSnU+uwqxM+HtdSVTbHQeC2U/hM1cyzDMpl1rZRklmiEOoPUeDasEIBVTJhAxR8xAeKJJD7Wzj4mJPw4UMvF8zQZzW8EKYvB1hkVYY+HQ85L+XcXd8lco7hU4=",
  "cancellation_requested": false,
  "status": "inProgress",
  "status_details": "Pending certificate created. Certificate request is in progress. This may take some time based on the issuer provider. Please check again later.",
  "request_id": "6faacd568ab049a2803861e8dd3ae21f"
}

Definitions

Action

The action that will be executed.

ActionType

The type of the action.

CertificateAttributes

The certificate management attributes.

CertificateCreateParameters

The certificate create parameters.

CertificateOperation

A certificate operation is returned in case of asynchronous requests.

CertificatePolicy

Management policy for a certificate.

DeletionRecoveryLevel

Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' the key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the retention interval.

Error

The key vault server error.

IssuerParameters

Parameters for the issuer of the X509 component of a certificate.

JsonWebKeyCurveName

Elliptic curve name. For valid values, see JsonWebKeyCurveName.

JsonWebKeyType

JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40.

KeyProperties

Properties of the key pair backing a certificate.

KeyVaultError

The key vault error exception.

LifetimeAction

Action and its trigger that will be performed by Key Vault over the lifetime of a certificate.

SecretProperties

Properties of the key backing a certificate.

SubjectAlternativeNames

The subject alternate names of a X509 object.

Trigger

A condition to be satisfied for an action to be executed.

X509CertificateProperties

Properties of the X509 component of a certificate.

Action

The action that will be executed.

Name Type Description
action_type

The type of the action.

ActionType

The type of the action.

Name Type Description
AutoRenew
  • string
EmailContacts
  • string

CertificateAttributes

The certificate management attributes.

Name Type Description
created
  • integer

Creation time in UTC.

enabled
  • boolean

Determines whether the object is enabled.

exp
  • integer

Expiry date in UTC.

nbf
  • integer

Not before date in UTC.

recoveryLevel

Reflects the deletion recovery level currently in effect for certificates in the current vault. If it contains 'Purgeable', the certificate can be permanently deleted by a privileged user; otherwise, only the system can purge the certificate, at the end of the retention interval.

updated
  • integer

Last updated time in UTC.

CertificateCreateParameters

The certificate create parameters.

Name Type Description
attributes

The attributes of the certificate (optional).

policy

The management policy for the certificate.

tags
  • object

Application specific metadata in the form of key-value pairs.

CertificateOperation

A certificate operation is returned in case of asynchronous requests.

Name Type Description
cancellation_requested
  • boolean

Indicates if cancellation was requested on the certificate operation.

csr
  • string

The certificate signing request (CSR) that is being used in the certificate operation.

error

Error encountered, if any, during the certificate operation.

id
  • string

The certificate id.

issuer

Parameters for the issuer of the X509 component of a certificate.

request_id
  • string

Identifier for the certificate operation.

status
  • string

Status of the certificate operation.

status_details
  • string

The status details of the certificate operation.

target
  • string

Location which contains the result of the certificate operation.

CertificatePolicy

Management policy for a certificate.

Name Type Description
attributes

The certificate attributes.

id
  • string

The certificate id.

issuer

Parameters for the issuer of the X509 component of a certificate.

key_props

Properties of the key backing a certificate.

lifetime_actions

Actions that will be performed by Key Vault over the lifetime of a certificate.

secret_props

Properties of the secret backing a certificate.

x509_props

Properties of the X509 component of a certificate.

DeletionRecoveryLevel

Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' the key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the retention interval.

Name Type Description
Purgeable
  • string
Recoverable
  • string
Recoverable+ProtectedSubscription
  • string
Recoverable+Purgeable
  • string

Error

The key vault server error.

Name Type Description
code
  • string

The error code.

innererror

The key vault server error.

message
  • string

The error message.

IssuerParameters

Parameters for the issuer of the X509 component of a certificate.

Name Type Description
cert_transparency
  • boolean

Indicates if the certificates generated under this policy should be published to certificate transparency logs.

cty
  • string

Type of certificate to be requested from the issuer provider.

name
  • string

Name of the referenced issuer object or reserved names; for example, 'Self' or 'Unknown'.

JsonWebKeyCurveName

Elliptic curve name. For valid values, see JsonWebKeyCurveName.

Name Type Description
P-256
  • string

The NIST P-256 elliptic curve, AKA SECG curve SECP256R1.

P-256K
  • string

The SECG SECP256K1 elliptic curve.

P-384
  • string

The NIST P-384 elliptic curve, AKA SECG curve SECP384R1.

P-521
  • string

The NIST P-521 elliptic curve, AKA SECG curve SECP521R1.

JsonWebKeyType

JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40.

Name Type Description
EC
  • string

Elliptic Curve.

EC-HSM
  • string

Elliptic Curve with a private key which is not exportable from the HSM.

RSA
  • string

RSA (https://tools.ietf.org/html/rfc3447)

RSA-HSM
  • string

RSA with a private key which is not exportable from the HSM.

oct
  • string

Octet sequence (used to represent symmetric keys)

KeyProperties

Properties of the key pair backing a certificate.

Name Type Description
crv

Elliptic curve name. For valid values, see JsonWebKeyCurveName.

exportable
  • boolean

Indicates if the private key can be exported.

key_size
  • integer

The key size in bits. For example: 2048, 3072, or 4096 for RSA.

kty

The type of key pair to be used for the certificate.

reuse_key
  • boolean

Indicates if the same key pair will be used on certificate renewal.

KeyVaultError

The key vault error exception.

Name Type Description
error

The key vault server error.

LifetimeAction

Action and its trigger that will be performed by Key Vault over the lifetime of a certificate.

Name Type Description
action

The action that will be executed.

trigger

The condition that will execute the action.

SecretProperties

Properties of the key backing a certificate.

Name Type Description
contentType
  • string

The media type (MIME type).

SubjectAlternativeNames

The subject alternate names of a X509 object.

Name Type Description
dns_names
  • string[]

Domain names.

emails
  • string[]

Email addresses.

upns
  • string[]

User principal names.

Trigger

A condition to be satisfied for an action to be executed.

Name Type Description
days_before_expiry
  • integer

Days before expiry to attempt renewal. Value should be between 1 and validity_in_months multiplied by 27. If validity_in_months is 36, then value should be between 1 and 972 (36 * 27).

lifetime_percentage
  • integer

Percentage of lifetime at which to trigger. Value should be between 1 and 99.

X509CertificateProperties

Properties of the X509 component of a certificate.

Name Type Description
ekus
  • string[]

The enhanced key usage.

key_usage
  • string[]

List of key usages.

sans

The subject alternative names.

subject
  • string

The subject name. Should be a valid X509 distinguished Name.

validity_months
  • integer

The duration that the certificate is valid in months.