次の方法で共有


IIS クライアント証明書マッピング認証 <iisClientCertificateMappingAuthentication>

概要

<authentication> 要素の <iisClientCertificateMappingAuthentication> 要素は、IIS を使用したクライアント証明書マッピング認証の設定を指定します。

IIS を使用してクライアント証明書をマッピングする方法は 2 つあります。

  • 一対一マッピング - これらのマッピングは、個々のクライアント証明書と個々のユーザー アカウントを一対一で照合します。各クライアント証明書はユーザー アカウントにマップされます。
  • 多対一マッピング - これらのマッピングは、クライアント証明書のサブフィールドに基づいて、複数の証明書をユーザー アカウントに照合します。

Note

IIS を使用したクライアント証明書マッピング認証は、次の点で Active Directory を使用したクライアント証明書マッピングとは異なります。

  • Active Directory を使用したクライアント証明書マッピング認証 - この認証方法では、IIS 7 サーバーとクライアント コンピューターが Active Directory ドメインのメンバーであり、ユーザー アカウントが Active Directory に格納されている必要があります。 この方法のクライアント証明書マッピング認証では、Active Directory サーバーへのラウンドトリップによりパフォーマンスが低下しました。
  • IIS クライアント証明書マッピング認証 - この認証方法では Active Directory は必要ないため、スタンドアロン サーバーで動作します。 この方法のクライアント証明書マッピング認証では、パフォーマンスが向上しましたが、マッピングを作成するには、より多くの構成とクライアント証明書へのアクセスが必要です。

詳細については、Microsoft TechNet Web サイトの「IIS 7.0 での認証の構成」を参照してください。

互換性

バージョン メモ
IIS 10.0 <iisClientCertificateMappingAuthentication> 要素は、IIS 10.0 では変更されませんでした。
IIS 8.5 <iisClientCertificateMappingAuthentication> 要素は、IIS 8.5 では変更されませんでした。
IIS 8.0 <iisClientCertificateMappingAuthentication> 要素は IIS 8.0 では変更されませんでした。
IIS 7.5 <iisClientCertificateMappingAuthentication> 要素は、IIS 7.5 では変更されませんでした。
IIS 7.0 <authentication> 要素の <iisClientCertificateMappingAuthentication> 要素が IIS 7.0 で導入されました。
IIS 6.0 <iisClientCertificateMappingAuthentication> 要素は、IIS 6.0 IIsCertMapper メタベース オブジェクトを置き換えます。

段取り

<iisClientCertificateMappingAuthentication> 要素は、IIS 7 以降の既定のインストールでは使用できません。 インストールするには、次の手順を使用します。

Windows Server 2012 または Windows Server 2012 R2

  1. タスク バーで [サーバー マネージャー]をクリックします。
  2. [サーバー マネージャー] で、[管理] メニューを選択し、[役割と機能の追加] を選択します。
  3. [役割と機能の追加] ウィザードで、[次へ] をクリックします。 インストールの種類を選択し、[次へ] をクリックします。 対象サーバーを選択し、[次へ] をクリックします。
  4. [サーバー ロール] ページで、[Web サーバー (IIS)][Web サーバー] の順に展開し、[セキュリティ] を展開して、[IIS クライアント証明書マッピング認証] を選択します。 次へ をクリックします。
    [I I S Client Certificate Mapping Authentication]\(I I S クライアント証明書マッピング認証\) オプションが強調表示され、選択されているスクリーンショット。
  5. [機能の選択] ページで、[次へ] をクリックします。
  6. [インストール オプションの確認] ページで、[インストール] をクリックします。
  7. [結果] ページで、 [閉じる]をクリックします。

Windows 8 または Windows 8.1

  1. [スタート] 画面で、ポインターを左下隅まで移動し、[スタート] ボタンを右クリックし、[コントロール パネル] をクリックします。
  2. [コントロール パネル][プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。
  3. [インターネット インフォメーション サービス] を展開し、[World Wide Web サービス] を展開し、[セキュリティ] を展開して、[IIS クライアント証明書マッピング認証] を選択します。
    I I S クライアント証明書マッピング認証フォルダーが強調表示され、選択されているスクリーンショット。
  4. OK をクリックします。
  5. 閉じるをクリックします。

Windows Server 2008 または Windows Server 2008 R2

  1. タスク バーで [スタート] をクリックし、[管理ツール] をポイントして、[サーバー マネージャ] をクリックします。
  2. [サーバー マネージャ] 階層ウィンドウで [役割] を展開し、[Web サーバー (IIS)] をクリックします。
  3. [Web Server (IIS)] (Web サーバー (IIS)) ウィンドウで、[Role Services] (役割サービス) セクションまでスクロールし、[Add Role Services] (役割サービスの追加) をクリックします。
  4. 役割サービスの追加ウィザード[役割サービスの選択] ページで、[IIS クライアント証明書マッピング認証] を選択し、[次へ] をクリックします。
    I I S クライアント証明書マッピング認証オプションが強調表示されている役割サービスの追加ウィザードのスクリーンショット。
  5. [インストール オプションの確認] ページで、[インストール] をクリックします。
  6. [結果] ページで、 [閉じる]をクリックします。

Windows Vista または Windows 7

  1. タスク バーで、[スタート][コントロール パネル] の順にクリックします。
  2. [コントロール パネル][プログラムと機能] をクリックし、[Turn Windows Features on or off] (Windows の機能の有効化または無効化) をクリックします。
  3. [インターネット インフォメーション サービス] を展開し、[IIS クライアント証明書マッピング認証] を選択し、[OK] をクリックします。
    展開されている [セキュリティ] フォルダーのスクリーンショット。強調表示されている [I I S Client Certificate Mapping Authentication]\(I I S クライアント証明書マッピング認証\) フォルダーが示されています。

操作方法

IIS 7 の IIS クライアント証明書マッピング認証を構成するためのユーザー インターフェイスはありません。 IIS クライアント証明書マッピング認証をプログラムで構成する方法の例については、このドキュメントの「コード サンプル」セクションを参照してください。

構成

<authentication> 要素の <iisClientCertificateMappingAuthentication> 要素は、サーバーおよびサイト レベルで構成できます。

属性

属性 説明
defaultLogonDomain 省略可能で、 String 型の属性。

サーバーがユーザーの認証に使用する既定のドメインを指定します。
enabled 省略可能な Boolean 属性です。

IIS を使用したクライアント証明書マッピング認証を有効にするかどうかを指定します。

既定値は、false です。
logonMethod 省略可能な列挙型属性。

logonMethod 属性には、次のいずれかの値を指定できます。 (これらの値の詳細については、「LogonUser」を参照してください)。

既定値は、ClearText です。
Value 説明
Batch このログオンの種類は、ユーザーが直接介入することなく、ユーザーの代わりにプロセスが実行される、バッチ サーバーを対象としています。

数値は 1 です。
ClearText このログオンの種類は、名前とパスワードを認証パッケージに保持します。これで、サーバーはクライアントの権限を借用して、他のネットワーク サーバーに接続できます。

数値は 3 です。
Interactive このログオンの種類は、コンピューターを対話的に使用するユーザーを対象としています。

数値は 0 です。
Network このログオンの種類は、プレーンテキスト パスワードを認証するハイ パフォーマンス サーバー向けです。 このログオンの種類の資格情報はキャッシュされません。

数値は 2 です。
manyToOneCertificateMappingsEnabled 省略可能な Boolean 属性です。

多対一マッピングを有効にするかどうかを指定します。

既定値は true です。
oneToOneCertificateMappingsEnabled 省略可能な Boolean 属性です。

一対一マッピングを有効にするかどうかを指定します。

既定値は true です。

子要素

要素 説明
manyToOneMappings 省略可能な要素です。

クライアント証明書を、証明書を認証し、ユーザー アカウントを割り当てる一連のワイルドカード条件にマップします。
oneToOneMappings 省略可能な要素です。

一対一のクライアント証明書マッピングを指定します。

構成サンプル

次の構成サンプルでは、既定の Web サイトに対して次の操作を実行します。

  • 多対一の証明書マッピングを使用して IIS クライアント証明書マッピング認証を有効にします。
  • Contoso と一致するクライアント証明書のサブジェクトの組織フィールドに基づいて、ユーザー アカウントの多対一の証明書マッピング規則を作成します。
  • SSL を要求し、クライアント証明書をネゴシエートするようにサイトを構成します。
<location path="Default Web Site">
   <system.webServer>
      <security>
         <authentication>
            <windowsAuthentication enabled="false" />
            <anonymousAuthentication enabled="false" />
            <digestAuthentication enabled="false" />
            <basicAuthentication enabled="false" />
            <iisClientCertificateMappingAuthentication enabled="true"
                  manyToOneCertificateMappingsEnabled="true">
               <manyToOneMappings>
                  <add name="Contoso Employees"
                        enabled="true"
                        permissionMode="Allow"
                        userName="Username"
                        password="[enc:AesProvider:57686f6120447564652c2049495320526f636b73:enc]">
                     <rules>
                        <add certificateField="Subject"
                           certificateSubField="O"
                           matchCriteria="Contoso"
                           compareCaseSensitive="true" />
                     </rules>
                  </add>
               </manyToOneMappings>
            </iisClientCertificateMappingAuthentication>
         </authentication>
         <access sslFlags="Ssl, SslNegotiateCert" />
      </security>
   </system.webServer>
</location>

次の構成サンプルでは、既定の Web サイトに対して一対一の証明書マッピングを使用して IIS クライアント証明書マッピング認証を有効にし、ユーザー アカウントに対して一対一の証明書マッピングを作成し、SSL を要求し、クライアント証明書をネゴシエートするようにサイトを構成します。

<location path="Default Web Site">
   <system.webServer>
      <security>
         <access sslFlags="Ssl, SslNegotiateCert" />
         <authentication>
            <windowsAuthentication enabled="false" />
            <anonymousAuthentication enabled="false" />
            <digestAuthentication enabled="false" />
            <basicAuthentication enabled="false" />
            <iisClientCertificateMappingAuthentication enabled="true"
                  oneToOneCertificateMappingsEnabled="true">
               <oneToOneMappings>
                  <add enabled="true"
                     userName="administrator"
                     password="[enc:57686f6120447564652c2049495320526f636b73:enc]"
                     certificate="Base64-Encoded-Certificate-Data" />
               </oneToOneMappings>
            </iisClientCertificateMappingAuthentication>
         </authentication>
      </security>
   </system.webServer>
</location>

クライアント証明書から Base-64 でエンコードされた文字列を取得する方法

Note

このトピックのすべてのサンプルの Base-64 でエンコードされた証明書データを取得するには、次の手順を使用して証明書をエクスポートできます。

  1. [スタート][実行] の順にクリックします。

  2. 「MMC」と入力し、[OK] をクリックします。

  3. Microsoft 管理コンソールが開いたら、[ファイル] をクリックし、[スナップインの追加と削除] をクリックします。

  4. [スナップインの追加と削除] ダイアログ ボックスで次のように操作します。

    • 使用可能なスナップインの一覧で [証明書] を強調表示し、[追加] をクリックします。
    • [My user account]\(マイ ユーザー アカウント\) で証明書を管理するように選択し、[完了] をクリックします。
    • [OK] をクリックしてダイアログ ボックスを閉じます。
  5. Microsoft 管理コンソールで次のように操作します。

    • [証明書 - 現在のユーザー][個人用][証明書] の順に展開します。
    • 証明書の一覧で、エクスポートする証明書を右クリックし、[すべてのタスク] をクリックし、[エクスポート] をクリックします。
  6. 証明書のエクスポート ウィザードが開いたら、次の操作を行います。

    • 次へ をクリックします。
    • [いいえ、秘密キーをエクスポートしません] を選択し、[次へ] をクリックします。
    • [Base-64 encoded X.509 9 (.CER)]\(Base-64 でエンコードされた X.509 9 (.CER)\) のエクスポート形式を選択し、[次へ] をクリックします。
    • 証明書を MyCertificate.cer としてデスクトップに保存し、[次へ] をクリックします。
    • [完了] をクリックすると、エクスポートが成功したことを示すダイアログ ボックスが表示されます。
  7. Microsoft 管理コンソールを閉じます。

  8. Windows のメモ帳を使用してエクスポートした MyCertificate.cer ファイルを開きます。

    • テキストの先頭から "-----BEGIN CERTIFICATE-----" を削除します。
    • テキストの末尾から "-----END CERTIFICATE-----" を削除します。
    • すべての行を 1 行のテキストに連結します。これは、このトピックのすべてのサンプルで使用する Base-64 でエンコードされた証明書データです。

サンプル コード

次のコード サンプルでは、既定の Web サイトに対して次の操作を実行します。

  • 多対一の証明書マッピングを使用して IIS クライアント証明書マッピング認証を有効にします。
  • Contoso と一致するクライアント証明書のサブジェクトの組織フィールドに基づいて、ユーザー アカウントに多対一の証明書マッピング規則を作成します。
  • SSL を要求し、クライアント証明書をネゴシエートするようにサイトを構成します。

AppCmd.exe

appcmd.exe set config "Default Web Site" -section:system.webServer/security/authentication/iisClientCertificateMappingAuthentication /enabled:"True" /manyToOneCertificateMappingsEnabled:"True" /commit:apphost

appcmd.exe set config "Default Web Site" -section:system.webServer/security/authentication/iisClientCertificateMappingAuthentication /+"manyToOneMappings.[name='Contoso Employees',enabled='True',permissionMode='Allow',userName='Username',password='Password']" /commit:apphost

appcmd.exe set config "Default Web Site" -section:system.webServer/security/authentication/iisClientCertificateMappingAuthentication /+"manyToOneMappings.[name='Contoso Employees'].rules.[certificateField='Subject',certificateSubField='O',matchCriteria='Contoso',compareCaseSensitive='True']" /commit:apphost

appcmd.exe set config "Default Web Site" -section:system.webServer/security/access /sslFlags:"Ssl, SslNegotiateCert" /commit:apphost

Note

AppCmd.exe を使用してこれらの設定を構成するときは、commit パラメーターを必ず apphost に設定する必要があります。 これで、ApplicationHost.config ファイルの適切な場所セクションに構成設定がコミットされます。

C#

using System;
using System.Text;
using Microsoft.Web.Administration;

internal static class Sample
{
   private static void Main()
   {
      using (ServerManager serverManager = new ServerManager())
      {
         Configuration config = serverManager.GetApplicationHostConfiguration();

         ConfigurationSection iisClientCertificateMappingAuthenticationSection = config.GetSection("system.webServer/security/authentication/iisClientCertificateMappingAuthentication", "Default Web Site");
         iisClientCertificateMappingAuthenticationSection["enabled"] = true;
         iisClientCertificateMappingAuthenticationSection["manyToOneCertificateMappingsEnabled"] = true;

         ConfigurationElementCollection manyToOneMappingsCollection = iisClientCertificateMappingAuthenticationSection.GetCollection("manyToOneMappings");
         ConfigurationElement addElement = manyToOneMappingsCollection.CreateElement("add");
         addElement["name"] = @"Contoso Employees";
         addElement["enabled"] = true;
         addElement["permissionMode"] = @"Allow";
         addElement["userName"] = @"Username";
         addElement["password"] = @"Password";

         ConfigurationElementCollection rulesCollection = addElement.GetCollection("rules");
         ConfigurationElement addElement1 = rulesCollection.CreateElement("add");
         addElement1["certificateField"] = @"Subject";
         addElement1["certificateSubField"] = @"O";
         addElement1["matchCriteria"] = @"Contoso";
         addElement1["compareCaseSensitive"] = true;
         rulesCollection.Add(addElement1);
         manyToOneMappingsCollection.Add(addElement);

         ConfigurationSection accessSection = config.GetSection("system.webServer/security/access", "Default Web Site");
         accessSection["sslFlags"] = @"Ssl, SslNegotiateCert";

         serverManager.CommitChanges();
      }
   }
}

VB.NET

Imports System
Imports System.Text
Imports Microsoft.Web.Administration

Module Sample

   Sub Main()
      Dim serverManager As ServerManager = New ServerManager
      Dim config As Configuration = serverManager.GetApplicationHostConfiguration

      Dim iisClientCertificateMappingAuthenticationSection As ConfigurationSection = config.GetSection("system.webServer/security/authentication/iisClientCertificateMappingAuthentication", "Default Web Site")
      iisClientCertificateMappingAuthenticationSection("enabled") = True
      iisClientCertificateMappingAuthenticationSection("manyToOneCertificateMappingsEnabled") = True

      Dim manyToOneMappingsCollection As ConfigurationElementCollection = iisClientCertificateMappingAuthenticationSection.GetCollection("manyToOneMappings")
      Dim addElement As ConfigurationElement = manyToOneMappingsCollection.CreateElement("add")
      addElement("name") = "Contoso Employees"
      addElement("enabled") = True
      addElement("permissionMode") = "Allow"
      addElement("userName") = "Username"
      addElement("password") = "Password"

      Dim rulesCollection As ConfigurationElementCollection = addElement.GetCollection("rules")
      Dim addElement1 As ConfigurationElement = rulesCollection.CreateElement("add")
      addElement1("certificateField") = "Subject"
      addElement1("certificateSubField") = "O"
      addElement1("matchCriteria") = "Contoso"
      addElement1("compareCaseSensitive") = True
      rulesCollection.Add(addElement1)
      manyToOneMappingsCollection.Add(addElement)

      Dim accessSection As ConfigurationSection = config.GetSection("system.webServer/security/access", "Default Web Site")
      accessSection("sslFlags") = "Ssl, SslNegotiateCert"

      serverManager.CommitChanges()
   End Sub

End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";

var iisClientCertificateMappingAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/iisClientCertificateMappingAuthentication", "MACHINE/WEBROOT/APPHOST/Default Web Site");
iisClientCertificateMappingAuthenticationSection.Properties.Item("enabled").Value = true;
iisClientCertificateMappingAuthenticationSection.Properties.Item("manyToOneCertificateMappingsEnabled").Value = true;

var manyToOneMappingsCollection = iisClientCertificateMappingAuthenticationSection.ChildElements.Item("manyToOneMappings").Collection;
var addElement = manyToOneMappingsCollection.CreateNewElement("add");
addElement.Properties.Item("name").Value = "Contoso Employees";
addElement.Properties.Item("enabled").Value = true;
addElement.Properties.Item("permissionMode").Value = "Allow";
addElement.Properties.Item("userName").Value = "Username";
addElement.Properties.Item("password").Value = "Password";

var rulesCollection = addElement.ChildElements.Item("rules").Collection;
var addElement1 = rulesCollection.CreateNewElement("add");
addElement1.Properties.Item("certificateField").Value = "Subject";
addElement1.Properties.Item("certificateSubField").Value = "O";
addElement1.Properties.Item("matchCriteria").Value = "Contoso";
addElement1.Properties.Item("compareCaseSensitive").Value = true;
rulesCollection.AddElement(addElement1);
manyToOneMappingsCollection.AddElement(addElement);

var accessSection = adminManager.GetAdminSection("system.webServer/security/access", "MACHINE/WEBROOT/APPHOST/Default Web Site");
accessSection.Properties.Item("sslFlags").Value = "Ssl, SslNegotiateCert";

adminManager.CommitChanges();

VBScript

Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"

Set iisClientCertificateMappingAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/iisClientCertificateMappingAuthentication", "MACHINE/WEBROOT/APPHOST/Default Web Site")
iisClientCertificateMappingAuthenticationSection.Properties.Item("enabled").Value = True
iisClientCertificateMappingAuthenticationSection.Properties.Item("manyToOneCertificateMappingsEnabled").Value = True

Set manyToOneMappingsCollection = iisClientCertificateMappingAuthenticationSection.ChildElements.Item("manyToOneMappings").Collection
Set addElement = manyToOneMappingsCollection.CreateNewElement("add")
addElement.Properties.Item("name").Value = "Contoso Employees"
addElement.Properties.Item("enabled").Value = True
addElement.Properties.Item("permissionMode").Value = "Allow"
addElement.Properties.Item("userName").Value = "Username"
addElement.Properties.Item("password").Value = "Password"

Set rulesCollection = addElement.ChildElements.Item("rules").Collection
Set addElement1 = rulesCollection.CreateNewElement("add")
addElement1.Properties.Item("certificateField").Value = "Subject"
addElement1.Properties.Item("certificateSubField").Value = "O"
addElement1.Properties.Item("matchCriteria").Value = "Contoso"
addElement1.Properties.Item("compareCaseSensitive").Value = True
rulesCollection.AddElement(addElement1)
manyToOneMappingsCollection.AddElement(addElement)

Set accessSection = adminManager.GetAdminSection("system.webServer/security/access", "MACHINE/WEBROOT/APPHOST/Default Web Site")
accessSection.Properties.Item("sslFlags").Value = "Ssl, SslNegotiateCert"

adminManager.CommitChanges()

次のコード サンプルでは、既定の Web サイトに対して一対一の証明書マッピングを使用して IIS クライアント証明書マッピング認証を有効にし、ユーザー アカウントに対して一対一の証明書マッピングを作成し、SSL を要求し、クライアント証明書をネゴシエートするようにサイトを構成します。

Note

以下に示すコード サンプルの Base-64 でエンコードされた証明書データを取得するには、このドキュメントの「構成の詳細」セクションに記載されている手順を使用して証明書をエクスポートできます。

AppCmd.exe

Note

AppCmd.exe で解析できない証明書文字列の文字があるため、AppCmd.exe を使用して IIS の一対一の証明書マッピングを構成しないでください。

C#

using System;
using System.Text;
using Microsoft.Web.Administration;

internal static class Sample
{
   private static void Main()
   {
      using (ServerManager serverManager = new ServerManager())
      {
         Configuration config = serverManager.GetApplicationHostConfiguration();

         ConfigurationSection iisClientCertificateMappingAuthenticationSection = config.GetSection("system.webServer/security/authentication/iisClientCertificateMappingAuthentication", "Default Web Site");
         iisClientCertificateMappingAuthenticationSection["enabled"] = true;
         iisClientCertificateMappingAuthenticationSection["oneToOneCertificateMappingsEnabled"] = true;

         ConfigurationElementCollection oneToOneMappingsCollection = iisClientCertificateMappingAuthenticationSection.GetCollection("oneToOneMappings");
         ConfigurationElement addElement = oneToOneMappingsCollection.CreateElement("add");
         addElement["enabled"] = true;
         addElement["userName"] = @"Username";
         addElement["password"] = @"Password";
         addElement["certificate"] = @"Base-64-Encoded-Certificate-Data";
         oneToOneMappingsCollection.Add(addElement);

         ConfigurationSection accessSection = config.GetSection("system.webServer/security/access", "Default Web Site");
         accessSection["sslFlags"] = @"Ssl, SslNegotiateCert";

         serverManager.CommitChanges();
      }
   }
}

VB.NET

Imports System
Imports System.Text
Imports Microsoft.Web.Administration

Module Sample

   Sub Main()
      Dim serverManager As ServerManager = New ServerManager
      Dim config As Configuration = serverManager.GetApplicationHostConfiguration

      Dim iisClientCertificateMappingAuthenticationSection As ConfigurationSection = config.GetSection("system.webServer/security/authentication/iisClientCertificateMappingAuthentication", "Default Web Site")
      iisClientCertificateMappingAuthenticationSection("enabled") = True
      iisClientCertificateMappingAuthenticationSection("oneToOneCertificateMappingsEnabled") = True

      Dim oneToOneMappingsCollection As ConfigurationElementCollection = iisClientCertificateMappingAuthenticationSection.GetCollection("oneToOneMappings")
      Dim addElement As ConfigurationElement = oneToOneMappingsCollection.CreateElement("add")
      addElement("enabled") = True
      addElement("userName") = "Username"
      addElement("password") = "Password"
      addElement("certificate") = "Base-64-Encoded-Certificate-Data"
      oneToOneMappingsCollection.Add(addElement)

      Dim accessSection As ConfigurationSection = config.GetSection("system.webServer/security/access", "Default Web Site")
      accessSection("sslFlags") = "Ssl, SslNegotiateCert"

      serverManager.CommitChanges()
   End Sub

End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";

var iisClientCertificateMappingAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/iisClientCertificateMappingAuthentication", "MACHINE/WEBROOT/APPHOST/Default Web Site");
iisClientCertificateMappingAuthenticationSection.Properties.Item("enabled").Value = true;
iisClientCertificateMappingAuthenticationSection.Properties.Item("oneToOneCertificateMappingsEnabled").Value = true;

var oneToOneMappingsCollection = iisClientCertificateMappingAuthenticationSection.ChildElements.Item("oneToOneMappings").Collection;
var addElement = oneToOneMappingsCollection.CreateNewElement("add");
addElement.Properties.Item("enabled").Value = true;
addElement.Properties.Item("userName").Value = "Username";
addElement.Properties.Item("password").Value = "Password";
addElement.Properties.Item("certificate").Value = "Base-64-Encoded-Certificate-Data";
oneToOneMappingsCollection.AddElement(addElement);

var accessSection = adminManager.GetAdminSection("system.webServer/security/access", "MACHINE/WEBROOT/APPHOST/Default Web Site");
accessSection.Properties.Item("sslFlags").Value = "Ssl, SslNegotiateCert";

adminManager.CommitChanges();

VBScript

Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"

Set iisClientCertificateMappingAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/iisClientCertificateMappingAuthentication", "MACHINE/WEBROOT/APPHOST/Default Web Site")
iisClientCertificateMappingAuthenticationSection.Properties.Item("enabled").Value = True
iisClientCertificateMappingAuthenticationSection.Properties.Item("oneToOneCertificateMappingsEnabled").Value = True

Set oneToOneMappingsCollection = iisClientCertificateMappingAuthenticationSection.ChildElements.Item("oneToOneMappings").Collection
Set addElement = oneToOneMappingsCollection.CreateNewElement("add")
addElement.Properties.Item("enabled").Value = True
addElement.Properties.Item("userName").Value = "Username"
addElement.Properties.Item("password").Value = "Password"
addElement.Properties.Item("certificate").Value = "Base-64-Encoded-Certificate-Data"
oneToOneMappingsCollection.AddElement(addElement)

Set accessSection = adminManager.GetAdminSection("system.webServer/security/access", "MACHINE/WEBROOT/APPHOST/Default Web Site")
accessSection.Properties.Item("sslFlags").Value = "Ssl, SslNegotiateCert"

adminManager.CommitChanges()