Hello @Martins Marco
NTE_DEVICE_NOT_READY during CRL generation points more toward the HSM/KSP communication path than CRL publication itself. AD CS must access the CA private key through the configured CNG Key Storage Provider to sign the CRL; if the network HSM session has dropped, the signing operation can fail.
I wouldn't recommend trying to manipulate or recreate CNG/KSP handles from AD CS. There isn't a documented AD CS command for forcing CertSvc to reinitialize an HSM provider session while keeping the existing CA service instance running. The provider/session recovery behavior is largely dependent on the HSM vendor's KSP implementation.
A useful test when the problem occurs is:
certutil -csplist
certutil -store my "<CA Common Name>"
certutil -crl
certutil -csplist can verify that the KSP remains available, while the certificate-store output can help confirm that the CA certificate is still associated with the expected provider. Microsoft documents certutil -crl as the supported command for generating/publishing a new CRL.
If the HSM vendor's diagnostic tools also fail to access the key at that point, I'd investigate the HSM connection itself: KSP/HSM client logs, network interruptions, session/time-out limits, firmware/client compatibility, and whether the vendor KSP supports automatic session reconnection.
If the vendor KSP can't recover its session, restarting CertSvc may unfortunately be necessary to establish a fresh provider context. I wouldn't automate repeated CA-service restarts until the HSM vendor confirms that as their supported recovery mechanism.
The fact that this occurs specifically during CRL signing is useful evidence, since Microsoft also recommends certutil -crl when validating that a CA's configured KSP/private key can successfully sign a CRL.
If you can share the HSM vendor/model and KSP version, that would be the next important detail because session reconnection behavior is provider-specific.
Please "Accept the Answer" if this information helped you. This will help us and others in the community as well.