---
name: azion-request-a-let-s-encrypt-certificate
description: >-
  Request a Let's Encrypt certificate for the hostnames of a domain, prepare the challenge records, and check the issuance status.
---

# Request a Let's Encrypt 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: [Request a Let's Encrypt certificate](/en/documentation/guides/application-security/tls-and-certificates/how-to-generate-a-lets-encrypt-certificate.md)
> Release stage: Deprecated.

You can request a Let's Encrypt™ certificate for the hostnames of a [domain](/en/documentation/platform/domains/) from Azion Console or the [Azion CLI](/en/documentation/devtools/cli/). To use a certificate you obtained from another certificate authority instead, refer to [Upload a digital certificate](/en/documentation/guides/application-security/tls-and-certificates/digital-certificates/v3/).

HTTPS on your own hostname needs a server certificate that covers it. With a Let's Encrypt certificate, [Certificate Manager](/en/documentation/platform/certificate-manager/) does the certificate work for you. Azion requests the certificate from Let's Encrypt, completes the challenge that proves you control each hostname, and renews the certificate before it expires. Some older clients cannot validate the chain of a Let's Encrypt certificate. For which clients, refer to [Certificate chain](/en/documentation/platform/certificate-manager/certificates/#certificate-chain).

---

## Prerequisites

### Console

- An application for the domain to serve.
- A domain your account has permission to use, registered in the Domain Name System (DNS).
- Access to the DNS records of the domain, at your DNS provider or in [Edge DNS](/en/documentation/platform/edge-dns/).
- 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 in **CNAME** every hostname the certificate must cover. For the field, refer to [CNAME](/en/documentation/platform/domains/reference/#cname).
- A domain your account has permission to use, registered in the Domain Name System (DNS).
- Access to the DNS records of the domain, at your DNS provider or in [Edge DNS](/en/documentation/platform/edge-dns/).
- The [Azion CLI](/en/documentation/devtools/cli/), authorized with your account. This page matches Azion CLI 4.23.0.

### API

- A domain that lists in `cnames` every hostname the certificate must cover. For the field, refer to [CNAME](/en/documentation/platform/domains/reference/#cname).
- A certificate requested with the Azion CLI, to bind to the domain.
- 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.

---

## Prepare the DNS records for the challenge

Let's Encrypt issues the certificate only after it validates every hostname on the request. A certificate requested from a domain is issued through the **DNS-01** challenge, and the provider that holds the zone decides which DNS record must exist before you send the request:

| With the zone in Edge DNS                                          | With the zone at another provider                 |
| ------------------------------------------------------------------ | ------------------------------------------------- |
| No record. Azion writes the `_acme-challenge` record into the zone | One `_acme-challenge` `CNAME` record per hostname |

With a zone at another DNS provider, create the `_acme-challenge` record of each hostname at that provider before you send the request:

| Name                                                                       | Type    | Value                                                                                  |
| -------------------------------------------------------------------------- | ------- | -------------------------------------------------------------------------------------- |
| `_acme-challenge.<your-domain>`, such as `_acme-challenge.www.example.com` | `CNAME` | `<your-domain>.letsencrypt.azion.com`, such as `www.example.com.letsencrypt.azion.com` |

With the zone in Edge DNS, Azion writes the record into the zone and the challenge completes with no action from you. For how the challenge validates a hostname, refer to [Domain validation](/en/documentation/platform/certificate-manager/issuance-and-renewal/#domain-validation). For records and zones in Edge DNS, refer to [Edge DNS guides and tutorials](/en/documentation/platform/edge-dns/guides/).

Keep the `_acme-challenge` record for as long as a domain uses the certificate. Azion renews the certificate 30 days before it expires by running the challenge again, and a deleted record makes the renewal fail.

---

## Request the certificate

A Let's Encrypt request names the main hostname as the common name and, optionally, other hostnames as alternative names. Every name must belong to a domain your account has permission to use.

### Console

In Azion Console, you request the certificate from the domain, which takes the hostnames from its **CNAME**. To request the certificate from a domain in Azion Console:

1. **Open Domains**

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

2. **Start a domain**

   Select **+ Domain**, or select an existing domain to edit it.

3. **Name the domain**

   Enter a name. The name identifies the entry on the account and is not a hostname.

4. **Select the application**

   In **Applications**, select the application the domain serves.

5. **List the hostnames to certify**

   In **CNAME**, add the fully qualified hostnames the certificate covers. For example: `www.example.org`.

6. **Choose Let's Encrypt**

   In **Digital Certificate**, select the **Let's Encrypt** option.

7. **Save the domain**

   Select **Save**.

The certificate is issued through the **DNS-01** challenge. A hostname whose zone is in [Edge DNS](/en/documentation/platform/edge-dns/) is validated without further work. For a zone at another provider, create the `_acme-challenge` `CNAME` record the challenge needs. The section Prepare the DNS records for the challenge describes that record.

### CLI

To request the certificate with the Azion CLI, run `azion create digital-certificate` with the `lets_encrypt` authority. Set `--challenge` to `dns`, and list any other hostnames in `--alternative-names`, separated by commas:

```bash
azion create digital-certificate \
  --name <certificate-name> \
  --authority lets_encrypt \
  --challenge dns \
  --common-name <your-domain> \
  --alternative-names <other-hostname>
```

The optional `--key-algorithm` flag takes `rsa_2048`, `rsa_4096`, or `ecc_384`. Azion accepts the request and schedules the issuance, and the new certificate is listed in Certificate Manager with the status `pending`.

To find the ID of the new certificate, list the certificates of the account:

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

The output lists each certificate with its `ID`, `NAME`, `STATUS`, `TYPE`, and `MANAGED` columns. A Let's Encrypt certificate has the type `edge_certificate`, and `MANAGED` reads `true`.

A name on the request that your account has no permission for is refused. The Azion CLI prints the refusal as:

```text
Error: Failed to request the Digital Certificate: ["This account cannot use certain common or alternative names because it does not have permission for their domain names."]. Check your settings and try again. If the error persists, contact Azion support
```

For the causes and fixes, refer to [Troubleshoot Certificate Manager](/en/documentation/platform/certificate-manager/troubleshooting/).

### API

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

---

## Bind the certificate to the domain

A certificate you requested with the Azion CLI protects HTTPS traffic only once a domain names it. You select the 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.

The change takes several minutes to reach all of Azion's distributed infrastructure.

---

## Check the issuance status

Azion makes the first attempt to issue the certificate up to 5 minutes after the request. The `status` field of the certificate shows where the issuance stands.

### Console

To check the status in Azion Console:

1. **Open the Certificate Manager page**

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

2. **Find the certificate**

   Find the certificate in the list, with the type **TLS Certificate**.

A `pending` certificate shows a warning icon, and a `failed` one shows an error icon, with the reason as its explanation. A certificate whose validity date has passed carries the tag **Expired**.

### CLI

To check the status with the Azion CLI, describe the certificate:

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

For a Let's Encrypt certificate, `managed` is `true`, `authority` is `lets_encrypt`, and `challenge` is `dns`. Read `status`, and while it is `failed`, read the reason in `status_detail`.

### API

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

The certificate moves from `pending` to `challenge_verification` while the challenge awaits validation, and leaves `challenge_verification` once Let's Encrypt issues it. When validation fails, it reads `failed`, and `status_detail` names the hostname to check, such as `An error has occurred while issuing the requested certificate. Please verify the following domains CNAME: www.example.com`.

A failed attempt is retried on a schedule, so a record you correct later can still end in an automatic issuance. For the retry schedule, refer to [Issuance time and retries](/en/documentation/platform/certificate-manager/issuance-and-renewal/#issuance-time-and-retries). For a certificate that stays `pending` or turns `failed`, refer to [Troubleshoot Certificate Manager](/en/documentation/platform/certificate-manager/troubleshooting/).

---

## Next steps

- [Issuance and renewal](/en/documentation/platform/certificate-manager/issuance-and-renewal.md): Follow a certificate through its statuses, the retry schedule, and automatic renewal.
- [Domain settings](/en/documentation/platform/domains/reference.md#digital-certificate): Look up the Digital Certificate field of a domain and the hostnames it covers.
- [Upload a digital certificate](/en/documentation/guides/application-security/tls-and-certificates/digital-certificates/v3.md): Serve HTTPS on your hostname with a certificate you bring.
- [Troubleshoot Certificate Manager](/en/documentation/platform/certificate-manager/troubleshooting.md): Find why a certificate is refused, stays pending, or fails to renew.
