I am using the PowerShell PKI Module to manage my certificates on Enterprise ADCS. I have created a simple tool that is using PS scripts for better convenience and to save some time.
When issuing certificates, I am using the Submit-CertificateRequest command, which takes as an input CSR stored in the file through -Path
parameter:
Submit-CertificateRequest -Path $csrFileName -CertificationAuthority $cca -Attribute "CertificateTemplate:$certificateTemplate"
This means that whenever I provide the CSR in the script, I need to store it first in the file, than use the command to issue certificate, and after that delete the file with the CSR. This is a complexity I would like to remove.
Is there any way how I can provide the CSR as input to the command without storing it in the file? The -Path
parameter is required and I need somehow reference file that will be used as CSR to issue certificate. Can I avoid that? Is there a better way how I can submit requests without storing them in the file?
My primary interface is PowerShell, if this would be feasible with the current PSPKI commands, it would be great.
You could emulate what
Submit-CertificateRequest
does, but it's probably longer than wrapping it in a function:Note that the above was blatantly plagiarised from the author of
Submit-CertificateRequest
's web page (which was offline when I wrote this, so here is a cached version).The
GetConfig()
method takes a single argument:If you know your CA Config string beforehand, then you can simplify this into two lines: