Active Directory Management Framework

Configuration driven Active Directory management.

Certificates

This Component does NOT follow the usual pattern of the corresponding “Register”-Command’s parameters are mapped straight through Reading the configuration guidance is strongly recommended!

Synopsis

The certificates Component allows you to manage certificates in the forest-wide certificate stores. This can include several different kinds of certificates, such as Root CA certificates or NTAuth certificates.

Supported Certificate types

The following kinds of certificates can be managed through this component:

Name System Name Description
NTAuth Certificate NTAuthCA CA able to authenticate users
Root Certificate Authority RootCA Trusted Root Certificate Authority. Certificates issued by it will be trusted.
Sub Certificate Authority SubCA An intermediate Certificate Authority. Certificates issued by it will be trusted.
Cross-Signing Certificate Authority CrossCA A Cross-Signing CA, used to mark another CA as trusted.
Key Recovery Agent Certificate KRA Used for Key Recovery Agents

This Component supports adding and removing certificates. You can declare the defined list of certificates as authorative (removing non-defined certificates) or merely add your certificates to the list of already existing certs.

Defining Configuration

Fundamentally, there are a few aspects you can define:

All Json/psd1 bits are combinable, you can use as many json/psd1 files as desired to define your environment.

Removing a Certificate

Removing a certificate requires specifying the type and the thumbprint of the certificate:

{
    "Delete": [
        {
            "Type": "RootCA",
            "Thumbprint": "9D385AC584BE4370BF11C91BE0720FA04DD0071F"
        }
    ]
}

Adding a Certificate

There are two ways to define adding a certificate:

.cer file

The easiest solution is to place the certificate as a .cer file in the Context folder. In order for this solution to work, the filename must begin with the type of certificate it is.

For example: RootCA_contoso.com.cer would add the certificate to the RootCA store.

Json configuration

To define it in json, create it thus:

{
    "Add": [
        {
            "Type": "RootCA",
            "Certificate": "H4sIAAAAAAAEAO1YW3OiyhZ+P1XnP1i+Zo5cVUwlqeoGMV5AuWjEmak5II1gQJAGUX/9QY2JGszM7JmpXbXrVB4kq1d/vS5fr7Xgrm/NcWmEYuyFi/syVaEqZIUql9aBv8D3ZTdJoluCwFMXBSauBN40DnHoJJVpGBBRmOX7XOT7BE2SLEGy5Yd//6tUussxSypy2vZ9mTyIcqEuv5PtpA/aBicoqOR70DT5/PWO0AtWQRybm+Klw8a3tfxJPj72tJMdJ1Z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ynLywa1m2kyNRUz169c/2ZdOvz1eJmlP6uL87CCLtxYX1+IqX1gz4eGWtDEfLhIzH67i8oNj+ji/V/Bi9j8rwpdglw3kb38J+LOvAL/xBeDYB9+P/5ff5F4VC/rbpe4P5vUsq6c5fSPcUbr/xQ//A4VCukUdGAAA"
        }
    ]
}

Not the neatest way to define a certificate, so while this method is supported, it is not recommended. The certificate data is created using the command ConvertTo-PSFClixml.

For example this line would generate the data from the local computer’s certificate store:

Get-ChildItem Cert:\LocalMachine\My\ | Where-Object Subject -eq 'CN=contoso.com' | ConvertTo-PSFClixml

Establishing Authority

To declare authority over a type of certificate, define it thus:

@{
    Authority = @(
        @{
            Type = "RootCA"
            Authorative = $true
        },
        @{
            Type = "SubCA"
            Authorative = $true
        }
    )
}

Combining Settings

All three sets of json/psd1 configuration can exist in the same configuration file or be split across multiple ones as desired. Example with all settings combined:

{
    "Authority": [
        {
            "Type": "RootCA",
            "Authorative":  true
        },
        {
            "Type": "SubCA",
            "Authorative":  true
        }
    ],
    "Delete": [
        {
            "Type": "RootCA",
            "Thumbprint": "9D385AC584BE4370BF11C91BE0720FA04DD0071F"
        }
    ],
    "Add": [
        {
            "Type": "RootCA",
            "Certificate": "H4sIAAAAAAAEAO1YW3OiyhZ+P1XnP1i+Zo5cVUwlqeoGMV5AuWjEmak5II1gQJAGUX/9QY2JGszM7JmpXbXrVB4kq1d/vS5fr7Xgrm/NcWmEYuyFi/syVaEqZIUql9aBv8D3ZTdJoluCwFMXBSauBN40DnHoJJVpGBBRmOX7XOT7BE2SLEGy5Yd//6tUussxSypy2vZ9mTyIcqEuv5PtpA/aBicoqOR70DT5/PWO0AtWQRybm+Klw8a3tfxJPj72tJMdJ1ZRbxacWXYmPz1EQ9M09pJNhY83URLOYjNyN5VxlWzwKE48x5uaCcKXAvrU4t8BeB3vMgoXkTgoh1oSe4vZw2ct3at//bYmSVL4tv8B30olXr7XEU7Yc/n5f5/bGKco/mt7NRR7pl+S08AqgGAFpsZzkOV5tiGS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