π DigiCert ACME Certificate Automation with LEGO: Enroll, Renew, Reissue & Duplicate Using Persistent DNS + Azure Key Vault
Enterprise implementation guide using LEGO v5.3.1, DigiCert ACME, Persistent DNS validation, Linux, Managed Identity and Azure Key Vault.
⏱️ Estimated reading time: 19 minutes
This article uses *.example.com as a security-sanitized example. Never publish real EAB HMAC values, API keys, private keys, PFX passwords, Azure tokens or internal identifiers.
π Before You Start — Terms You Should Know
If you are new to certificate automation, these terms will make the rest of the article much easier to follow.
| Term | Simple meaning |
|---|---|
| CA | Certificate Authority. In this design, DigiCert is the public CA that issues the certificate. |
| ACME | Automatic Certificate Management Environment — a standard protocol used to automate certificate lifecycle operations. |
| LEGO | An open-source ACME client. LEGO talks to DigiCert using the ACME protocol. |
| ACME Directory | The DigiCert CertCentral configuration/endpoint that defines which product, organization, domains and permissions the ACME client can use. |
| EAB KID | External Account Binding identifier used to associate the ACME client with the DigiCert ACME account. |
| EAB HMAC | Secret used together with the EAB KID. Treat it like a password and store it securely. |
| CSR | Certificate Signing Request containing the certificate subject and requested DNS names. |
| DCV | Domain Control Validation — proof that the requester is authorized to obtain a certificate for the domain. |
| Persistent DNS | DigiCert domain validation using a persistent TXT record that can be reused while the validation remains valid. |
| SAN | Subject Alternative Name — DNS names included in the certificate. |
| Order ID | The identifier of an existing DigiCert certificate order. It is used for explicit renew, reissue and duplicate operations. |
| PFX | A package that can contain the certificate, private key and certificate chain for deployment. |
| Azure Key Vault | Azure service used here to securely store ACME secrets and the issued certificate. |
π Simple End-to-End Flow
This is the high-level flow before we go into the detailed architecture.
Index
- DigiCert ACME Lifecycle Actions and Order ID Rule
- End-to-End Architecture
- DigiCert Service User and Approval Delegation
- Persistent DNS Domain Validation
- Create ACME Directory in DigiCert CertCentral
- DigiCert API Key
- Azure Key Vault and Secrets
- Managed Identity and RBAC
- Prepare Linux
- Directory Layout
- Lifecycle Pre-checks
- Create Private Key and CSR
- Verify CSR and Key Match
- Load Secrets and Build Action URL
- Prepare LEGO Account State
- Run LEGO with Selected Action
- Expected Successful Behavior
- Validate Issued Certificate
- Create PFX and Import to Key Vault
- Export PFX for Deployment
- Cleanup and Security Controls
- Production Checklist
- Official References
π 1. DigiCert ACME Lifecycle Actions and Order ID Rule
DigiCert CertCentral supports four important lifecycle actions for third-party ACME clients: enroll, renew, reissue, and duplicate.
reissue — not issue — when replacing a certificate under an existing order.| Action | Order ID required? | Simple meaning | Example |
|---|---|---|---|
| Enroll | No | Create a brand-new DigiCert certificate order. | You need a new *.example.com certificate and there is no existing order to target. |
| Renew | Yes for an explicit targeted action | Renew the certificate coverage on an existing order. | The existing certificate/order is reaching its renewal lifecycle. |
| Reissue | Yes for an explicit targeted action | Issue a replacement certificate under an existing order. | You need a new certificate/private key while keeping the same commercial order. |
| Duplicate | Yes | Issue another certificate from an existing order. | The same order needs an additional certificate instance and the certificate profile allows duplicates. |
⚠️ What Happens to the Existing Certificate After Each Action?
This is important during production migration because issuing a new certificate does not always mean the certificate already installed on the server immediately becomes invalid.
| Action | What happens to the existing certificate? | Operational meaning |
|---|---|---|
| Enroll | A new, independent DigiCert order and certificate are created. Existing certificates are not automatically replaced or revoked by the new enrollment. | You can deploy the new certificate separately. Old certificates continue according to their own validity/revocation status. |
| Renew | The renewal issues a new certificate with new validity. The certificate already deployed does not become invalid merely because the new certificate was issued; it normally remains usable until its own expiration unless it is separately revoked. | This gives an overlap window to deploy and validate the renewed certificate before the older certificate expires. |
| Reissue | A new version of the certificate is issued on the same order. The previous certificate can remain valid, but some reissue changes can trigger revocation. DigiCert specifically warns that changing or removing SANs can cause the original certificate and related duplicates/reissues to be revoked within 72 hours. | Do not assume an unlimited overlap window after a reissue. Check DigiCert Certificate History / revocation warnings and deploy the replacement quickly when SAN changes are involved. |
| Duplicate | A separate certificate is issued from the existing order. DigiCert documents duplicate certificates as a way to obtain another certificate without revoking the original. | Original and duplicate certificates can coexist. Each certificate has its own serial number and deployment location. |
π Complete DigiCert ACME URL Examples
action and orderId are omitted, CertCentral can auto-detect a matching ACME-issued order and apply its default lifecycle action. If no matching order is found, the request is treated as a new enrollment. For predictable automation, this guide recommends using an explicit action when you know the intended lifecycle operation.π️ 2. End-to-End Architecture
The architecture separates identities: DigiCert certificate automation uses the Service User + ACME EAB credentials, while Azure access uses the Linux VM Managed Identity.
| Communication | Authentication / identity used |
|---|---|
| Linux VM → Azure Key Vault | Azure System-Assigned Managed Identity |
| LEGO → DigiCert ACME | EAB KID + EAB HMAC |
| DigiCert automation ownership | DigiCert Service User |
| Optional DigiCert API pre-checks | DigiCert Services API key |
π€ 3. DigiCert Service User and Order Approval Delegation
Create a dedicated non-human DigiCert Service User. Select the same Service User as the ACME Directory user/owner. Where required, Order Approval Delegation should be approved.
π 4. Persistent DNS Domain Validation
The DNS team creates the DigiCert Persistent DNS validation TXT record in the authoritative zone. LEGO should not create, update or delete DNS records during the certificate operation.
π Normal DNS Challenge vs Persistent DNS
| Normal DNS-01 automation | Persistent DNS design used here |
|---|---|
| ACME client creates a temporary TXT challenge record, waits for validation, and later removes it. | DNS team creates DigiCert's persistent validation TXT record once. When DigiCert still shows the domain as Valid, LEGO does not need to modify DNS during the certificate operation. |
Authorization is already valid; skipping the challenge.DigiCert Persistent DNS is not the same as LEGO's --dns-persist option.
⚙️ 5. Create the ACME Directory in DigiCert CertCentral
The ACME Directory must be created in the DigiCert CertCentral console. For Enterprise and Partner accounts, go to:
Configure the ACME credentials with the certificate settings that should apply to requests made through this directory.
| Setting | Recommendation |
|---|---|
| Name | Use a clear automation-specific name. |
| Product | Select the exact DigiCert certificate product you intend to use. |
| Organization | For OV/EV, select the validated organization that should appear in the certificate. |
| User / Owner | Select the dedicated DigiCert Service User. |
| Allowed SANs | Restrict the directory to only the approved domains/SANs. |
| Validity / Coverage | Use your organization-approved DigiCert certificate settings. |
O = (Organization) value, keep that value consistent with the validated legal organization selected for the ACME credentials. Do not use a different organization name in the CSR. The organization itself is selected in CertCentral; it is not supplied through the orderId URL parameter.After creating the ACME Directory, CertCentral displays the ACME Directory URL, EAB KID, and EAB HMAC. Store them immediately in Azure Key Vault. DigiCert displays these credentials only once.
π 6. DigiCert API Key
A DigiCert Services API key is optional for LEGO issuance. It can be used for controlled pre-checks such as order details, product, expiry, domain validation and organization validation.
π 7. Azure Key Vault and Secrets
| Secret | Purpose |
|---|---|
| DIGICERT-ACME-URL-EXAMPLE-PROD | ACME base URL |
| DIGICERT-EAB-KID-EXAMPLE-PROD | EAB KID |
| DIGICERT-EAB-HMAC-EXAMPLE-PROD | EAB HMAC |
| DIGICERT-API-KEY-EXAMPLE-PROD | Optional API key |
| DIGICERT-ORDER-ID-EXAMPLE-PROD | Existing Order ID — needed only when explicitly targeting renew, reissue or duplicate |
π‘️ 8. Managed Identity and RBAC
| Role | Purpose |
|---|---|
| Key Vault Certificates Officer | Certificate import/manage |
| Key Vault Secrets User | Read ACME/EAB/API/order secrets |
π§ 9. Prepare Linux
Required path: outbound HTTPS TCP/443 to DigiCert and Azure Key Vault. No inbound listener is required when authorization is already valid through Persistent DNS.
π 10. Directory Layout and Permissions
✅ 11. Pre-checks Before Enroll, Renew, Reissue, or Duplicate
- Managed Identity login works.
- Azure Key Vault access works.
- DigiCert Service User is active.
- Order Approval Delegation is approved where required.
- The ACME Directory is created in DigiCert CertCentral and assigned to the intended Service User.
- The certificate product in the ACME Directory matches the intended request.
- For OV/EV, the selected organization is active and validation is current.
- If the CSR contains
O =, keep it consistent with the validated organization selected in CertCentral. - Persistent DNS/DCV for all requested domains is valid.
- CN/SANs are allowed by the ACME Directory restrictions.
- Enroll: no existing Order ID is required when explicitly using
?action=enroll. - Renew / Reissue / Duplicate: confirm the exact existing Order ID before building the explicit action URL.
- For duplicate, confirm the certificate profile allows duplicates.
- For renewal, confirm commercial/funding approval where applicable.
π§Ύ 12. Create Private Key and CSR
π 13. Verify CSR and Key Match
The two public-key hashes must match.
π 14. Load Secrets and Build the Required ACME Action URL
Load the ACME base URL and EAB credentials from Azure Key Vault. Load an Order ID only for an operation that targets an existing order.
enroll|renew|reissue|duplicate. Require an Order ID for renew/reissue/duplicate and reject an Order ID for a forced new enroll.π§© 15. Prepare LEGO Account State for the Certificate Transaction
transaction-state? This article covers enroll, renew, reissue and duplicate, so the generic name avoids making every operation look like a renewal. Reuse the ACME accounts state when appropriate, but start the certificate transaction without carrying an old local certificates directory that could influence LEGO local renewal timing.--renew-force: Use this LEGO flag only when you intentionally want LEGO to submit a renewal even when its local renewal timing says the certificate is not due yet. It does not select the DigiCert lifecycle action. DigiCert renewal must still be explicitly selected through LEGO_SERVER, for example ?action=renew&orderId=.... Do not add --renew-force to enroll, reissue or duplicate examples.π 16. Run LEGO with the Selected DigiCert Action
The DigiCert lifecycle behavior is determined by LEGO_SERVER. For renewal, the following example also uses LEGO --renew-force so LEGO does not skip the request because of its local renewal timing.
♻️ Renew Example — with --renew-force
--renew-force is a LEGO renewal-timing flag. It forces LEGO to renew even if the locally stored certificate is not yet due. It does not replace DigiCert's ?action=renew&orderId=... URL.π Enroll / Reissue / Duplicate
Do not use --renew-force merely to trigger enroll, reissue or duplicate. Select those DigiCert lifecycle actions through the ACME URL (LEGO_SERVER) and run LEGO without the renewal-force flag.
--http? LEGO requires a challenge solver to be selected. In this design DigiCert should already consider authorization valid through Persistent DNS, so the challenge is skipped. If a wildcard authorization is not already valid, stop and fix DCV rather than attempting HTTP-01 validation.✅ 17. Expected Successful Behavior with Persistent DNS
The key design result: no per-operation DNS TXT write is required when DigiCert authorization remains valid through Persistent DNS.
π 18. Validate the Issued Certificate
π¦ 19. Create PFX and Import the Certificate to Key Vault
π€ 20. Export PFX for Deployment
-nodes, the temporary PEM contains unencrypted private-key material. Delete it immediately.π§Ή 21. Cleanup, Logging and Security Controls
- Never echo EAB HMAC, API key, PFX password, private key or Azure token.
- Protect and retain reusable LEGO account state.
- Retain audit metadata: order ID, serial, thumbprint, validity dates and pipeline run ID.
- Use Key Vault RBAC at Key Vault resource scope.
- Pin and vulnerability-scan the LEGO image.
- Do not grant DNS write privileges for this Persistent DNS design.
☑️ 22. Production Checklist
- ✅ Linux host hardened and tools verified.
- ✅ LEGO pinned to
goacme/lego:v5.3.1. - ✅ System-assigned Managed Identity enabled.
- ✅ Key Vault Certificates Officer assigned at Key Vault scope.
- ✅ Key Vault Secrets User assigned at Key Vault scope.
- ✅ ACME URL, EAB KID and EAB HMAC stored in Key Vault.
- ✅ For explicit renew/reissue/duplicate, the approved existing Order ID is securely available (for example in Key Vault).
- ✅ Dedicated DigiCert Service User configured.
- ✅ Order Approval Delegation approved.
- ✅ ACME Directory owned by the Service User.
- ✅ Persistent DNS validation is Valid.
- ✅ Organization and domain validation are current.
- ✅ For renew/reissue/duplicate, the existing Order ID and product are confirmed.
- ✅ For enroll, organization/product/domain prerequisites are confirmed and no existing Order ID is required.
- ✅ CSR CN/SANs match approved scope.
- ✅ Explicit lifecycle action is selected:
enroll,renew,reissue, orduplicate. - ✅ Before deployment, confirm the existing certificate revocation/overlap impact for the selected lifecycle action—especially for reissues that change or remove SANs.
- ✅ Order ID is supplied for explicit renew/reissue/duplicate, and is not required for a forced new enroll.
- ✅ No DNS write occurs during a healthy certificate operation when Persistent DNS/DCV is already valid.
- ✅ Issued certificate and private key match.
- ✅ PFX imported into Azure Key Vault and validated.
π― What This Architecture Demonstrates
- DigiCert ACME can be driven through LEGO using a dedicated Service User and EAB credentials.
- An existing DigiCert order can be explicitly targeted for renew, reissue or duplicate.
- Persistent DNS can avoid per-operation DNS TXT creation while authorization remains valid.
- Azure Managed Identity removes the need to store Azure credentials on the Linux host.
- Azure Key Vault can centrally store ACME credentials/metadata and the issued certificate.
π 23. Official References
- DigiCert — Create and manage ACME credentials in CertCentral
- DigiCert — ACME automation actions and URL parameters (CertCentral)
- DigiCert — ACME automation actions
- LEGO — Obtain / renew certificate with a CSR
- LEGO Documentation
- Microsoft — Azure Key Vault RBAC guide
- Microsoft — Managed identities for Azure resources
