---
name: azion-upload-a-digital-certificate
description: >-
  Upload a server certificate, or create a CSR for your certificate authority to sign, and bind the certificate to a domain.
---

# Upload a digital certificate

> Platform versions: this page applies to API v3.x only, not to API v6.x and API v4.x.
> Equivalent page for API v4.x: [Upload a digital certificate](/en/documentation/guides/application-security/tls-and-certificates/digital-certificates.md)
> Release stage: Deprecated.

You can add a certificate that a certificate authority (CA) issued for your domain to [Certificate Manager](/en/documentation/platform/certificate-manager/) and select it on a [domain](/en/documentation/platform/domains/), from Azion Console, the [Azion CLI](/en/documentation/devtools/cli/), or the API. For a certificate that Azion requests from Let's Encrypt and renews, refer to [Request a Let's Encrypt certificate](/en/documentation/guides/application-security/tls-and-certificates/how-to-generate-a-lets-encrypt-certificate/v3/). For the Trusted CA certificate that checks client certificates, refer to [Configure mTLS on a domain](/en/documentation/guides/application-security/tls-and-certificates/associate-an-mtls-certificate/v3/).

A server certificate covers the hostnames a domain serves over HTTPS. You get one in either of two ways: you upload a certificate with its private key, or Certificate Manager creates a certificate signing request (CSR) and keeps the private key while your CA signs the certificate. Either way, you then select the server certificate on each domain that serves those hostnames.

---

## Prerequisites

### Console

- A domain that lists your hostnames in **CNAME**. For the field, refer to [CNAME](/en/documentation/platform/domains/reference/#cname).
- To upload a certificate: the certificate in PEM format and its private key, with no passphrase. RSA 2048 keys and P-256 keys are accepted.
- To create a CSR: a domain your account has permission to use.
- Access to Azion Console. For more information, refer to [How to access Azion Console](/en/documentation/guides/platform/account-and-billing/how-to-access-azion-console/).

### CLI

- A domain that lists your hostnames in **CNAME**. For the field, refer to [CNAME](/en/documentation/platform/domains/reference/#cname).
- To upload a certificate: the certificate in PEM format and its private key, with no passphrase. RSA 2048 keys and P-256 keys are accepted.
- To create a CSR: a domain your account has permission to use.
- The [Azion CLI](/en/documentation/devtools/cli/), authorized with your account. This page matches Azion CLI 4.23.0.

### API

- A domain that lists your hostnames in `cnames`. For the field, refer to [CNAME](/en/documentation/platform/domains/reference/#cname).
- The ID of the certificate in Certificate Manager, from an upload or a CSR in Azion Console or with the Azion CLI.
- A personal token for the `Authorization` header, in the form `Token [TOKEN VALUE]`. To create a token, refer to [Personal tokens](/en/documentation/fundamentals/personal-tokens/).
- `curl` or another HTTP client.

---

## Upload a server certificate

Certificate Manager stores the certificate with its private key, and it never returns the private key afterward. Intermediate certificates are accepted with the certificate.

### Console

To upload the certificate in Azion Console:

1. **Open the Certificate Manager page**

   Access [Azion Console](https://console.azion.com/) > **Certificate Manager**.

2. **Open the Create Digital Certificate page**

3. **Choose the Server Certificate preset**

   Select **Server Certificate**.

4. **Name the certificate**

   In **Name**, enter a name, such as `my-certificate`.

5. **Paste the certificate**

   In **Certificate**, paste the certificate, including its `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----` lines.

6. **Paste the private key**

   In **Private Key**, paste the private key, including its `-----BEGIN` and `-----END` lines.

7. **Create the certificate**

   Select **Create**.

The certificate appears in **Certificate Manager** as a **TLS Certificate**.

### CLI

To upload the certificate with the Azion CLI, pass the certificate file and the private key file:

```bash
azion create digital-certificate --name my-certificate --certificate certificate.pem --private-key private-key.pem
```

The command prints the ID of the new certificate:

```text
Created Digital Certificate with ID <certificate-id>
```

To confirm the upload, list your certificates:

```bash
azion list digital-certificate --details
```

### API

Follow this step in the **Console** or the **CLI** tab.

Send the private key that matches the certificate, in PEM format and without a passphrase.

---

## Create a certificate signing request

A CSR lets your own CA sign the certificate while Certificate Manager generates and keeps the private key. Name the hostnames the domain lists in **CNAME**.

### Console

The presets of the **Create Digital Certificate** page do not include a CSR. Create the CSR with the Azion CLI first.

To copy the request in Azion Console:

1. **Open the Certificate Manager page**

   Access [Azion Console](https://console.azion.com/) > **Certificate Manager**.

2. **Open the CSR entry**

   Select the entry that the CSR created. Its **Edit Digital Certificate** page opens.

3. **Copy the request**

   In **Certificate Signing Request (CSR)**, select **Copy**.

Azion Console shows "Successfully copied!", and the request is ready to submit to your CA.

### CLI

To create the CSR with the Azion CLI, pass the hostnames and the details of your organization. `--alternative-names` takes a comma-separated list, and `--key-algorithm` takes `rsa_2048`, `rsa_4096`, or `ecc_384`:

```bash
azion create csr --name my-csr \
  --common-name example.com \
  --alternative-names "www.example.com" \
  --country US --state California --locality "San Francisco" \
  --organization "Example Corp" --organization-unity IT \
  --email admin@example.com \
  --key-algorithm rsa_2048
```

The command creates a certificate entry that holds the request in its `csr` field. The entry reads `pending` until you add the certificate your CA signs.

To read the request, find the entry's ID with `azion list digital-certificate --details`, then describe the entry:

```bash
azion describe digital-certificate --digital-certificate-id <certificate-id> --format json
```

The `csr` field of the output holds the request, with each line break written as `\n`. Convert those to line feeds before you submit the request to your CA.

### API

Follow this step in the **Console** or the **CLI** tab.

For the meaning of each CSR field, refer to [Certificates](/en/documentation/platform/certificate-manager/certificates/#certificate-signing-requests).

Submit the request to the CA of your choice, such as DigiCert, GlobalSign, or IdenTrust. The CA validates the details in the request and, once it approves them, issues the signed certificate.

---

## Add the signed certificate to the CSR entry

The certificate your CA signs completes the entry that the certificate signing request (CSR) created. Add it in Azion Console, in PEM format, including its `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----` lines.

To add the signed certificate in Azion Console:

1. **Open the Certificate Manager page**

   Access [Azion Console](https://console.azion.com/) > **Certificate Manager**.

2. **Open the CSR entry**

   Select the entry that the CSR created. Its **Edit Digital Certificate** page opens.

3. **Paste the signed certificate**

   In **Certificate**, paste the certificate your CA signed.

4. **Save the entry**

   Select **Save**.

The entry holds the signed certificate, and you can bind it to a domain.

---

## Bind the certificate to the domain

You select the server certificate on each domain. Make sure the certificate covers the hostnames that the domain lists in **CNAME**, or in `cnames` in the API.

### Console

To bind the certificate to a domain in Azion Console:

1. **Open the Domains page**

   Access [Azion Console](https://console.azion.com/) > **Domains**.

2. **Open the domain**

   Select the domain. Its edit form opens.

3. **Select the certificate**

   In **Digital Certificate**, select your certificate.

4. **Save the domain**

   Select **Save**.

Azion Console shows "Your domain has been edited".

### API

To bind the certificate to a domain with the API, send each request with the header `Accept: application/json; version=3`:

1. Send a `GET` request to the domains endpoint:

   ```bash
   curl --request GET \
     --url https://api.azionapi.net/domains \
     --header 'Accept: application/json; version=3' \
     --header 'Authorization: Token [TOKEN VALUE]'
   ```

   The response lists your domains in `results`, each with its `id`.

2. Send a `PATCH` request to the domain, with its `id` in place of `<domain-id>`:

   ```bash
   curl --request PATCH \
     --url https://api.azionapi.net/domains/<domain-id> \
     --header 'Accept: application/json; version=3' \
     --header 'Authorization: Token [TOKEN VALUE]' \
     --header 'Content-Type: application/json' \
     --data '{
     "digital_certificate_id": <certificate-id>
   }'
   ```

The response returns the domain with the certificate ID in `digital_certificate_id`.

### CLI

Follow this step in the **Console** or the **API** tab.

To go back to Azion's own certificate, select *Azion (SAN)* in **Digital Certificate**, or send `null` in `digital_certificate_id`. The change takes several minutes to reach all of Azion's distributed infrastructure. For certificate errors and their fixes, refer to [Troubleshoot Certificate Manager](/en/documentation/platform/certificate-manager/troubleshooting/).

---

## Replace a certificate before it expires

A certificate you upload does not renew itself, and once its `validity` date passes, it no longer protects traffic. To replace it, upload the new certificate as Upload a server certificate describes, then bind it as Bind the certificate to the domain describes. Delete the old entry after the domain serves the new certificate and the change has propagated.

For why to switch while the old certificate is still valid, refer to [Certificate Manager best practices](/en/documentation/platform/certificate-manager/best-practices/).

---

## Next steps

- [Request a Let's Encrypt certificate](/en/documentation/guides/application-security/tls-and-certificates/how-to-generate-a-lets-encrypt-certificate/v3.md): Have Azion request and renew a certificate for your domain instead of uploading one.
- [Configure mTLS on a domain](/en/documentation/guides/application-security/tls-and-certificates/associate-an-mtls-certificate/v3.md): Upload a Trusted CA certificate and require client certificates on the domain.
- [Certificates](/en/documentation/platform/certificate-manager/certificates.md): Look up certificate fields, key algorithms, statuses, and the errors the API returns.
- [Troubleshoot Certificate Manager](/en/documentation/platform/certificate-manager/troubleshooting.md): Find the cause of a certificate error and the fix for it.
