Class WindowsCertificates
- Namespace
- Fabricator.Resources
- Assembly
- Fabricator.Resources.dll
[CompilationMapping(SourceConstructFlags.Module)]
public static class WindowsCertificates
- Inheritance
-
WindowsCertificates
- Inherited Members
Methods
trustedCertificate(AbsolutePath, CertificateStoreLocation)
Creates a resource that ensures a certificate is installed in the specified certificate store. This is a pure .NET implementation equivalent to PowerShell's Import-Certificate command.
[CompilationArgumentCounts(new int[] { 1, 1 })]
public static IResource trustedCertificate(AbsolutePath certificatePath, WindowsCertificates.CertificateStoreLocation storeLocation)
Parameters
certificatePathAbsolutePathThe absolute path to the certificate file to install.
storeLocationWindowsCertificates.CertificateStoreLocationThe certificate store location where the certificate should be installed.
Returns
- IResource
An implementation of the IResource interface, which provides methods to check if the certificate is already installed and to install it if needed.
Examples
Install a certificate to the Local Machine Root store:
let certResource = trustedCertificate(AbsolutePath @"C:\certs\mycert.cer", CertificateStores.LocalMachineTrustedRootCertificationAuthorities)
Remarks
This feature is Windows-only. On other platforms, certificate management varies significantly. The resource identifies certificates by their thumbprint, so if a certificate with the same thumbprint already exists in the store, it will be considered already applied.