次の方法で共有


管理認証 <authentication>

概要

<management> 要素の <authentication> 要素は、IIS マネージャー ユーザー アカウントの認証資格情報を指定します。 IIS マネージャー ユーザーは、IIS マネージャーを使用して、サーバー管理者によって承認されているサイトとアプリケーションに接続できます。

既定の ConfigurationAuthenticationProvider を認証プロバイダーとして使用し、IIS マネージャー認証を有効にすると、<credentials> 子要素には、IIS マネージャー ユーザー アカウントのユーザー名とパスワードを定義する一連の <add> 要素が含まれている場合があります。 これらの IIS マネージャー ユーザー アカウントは、Windows アカウントではないため、サーバー管理者が使用できるサイトと設定のみの構成に限定されます。

互換性

バージョン メモ
IIS 10.0 <authentication> 要素は、IIS 10.0 では変更されませんでした。
IIS 8.5 <authentication> 要素は、IIS 8.5 では変更されませんでした。
IIS 8.0 <authentication> 要素は IIS 8.0 では変更されませんでした。
IIS 7.5 <authentication> 要素は IIS 7.5 では変更されませんでした。
IIS 7.0 <management> 要素の <authentication> 要素は IIS 7.0 で導入されました。
IIS 6.0 該当なし

段取り

IIS 7 以降の既定のインストールには、管理サービスの役割サービスは含まれません。 この役割サービスをインストールするには、次の手順を使用します。

Windows Server 2012 または Windows Server 2012 R2

  1. タスク バーで [サーバー マネージャー]をクリックします。
  2. [サーバー マネージャー] で、[管理] メニューをクリックし、[役割と機能の追加] をクリックします。
  3. 役割と機能の追加ウィザードで、[次へ] をクリックします。 [インストールの種類] を選択し、[次へ] をクリックします。 対象サーバーを選択し、[次へ] をクリックします。
  4. [サーバーの役割] ページで、[Web サーバー (IIS)][管理ツール] の順に展開し、[管理サービス] を選択します。 次へ をクリックします。
    Screenshot of the Server Roles page with the Management Service option being highlighted.
  5. [機能の選択] ページで、[次へ] をクリックします。
  6. [インストール オプションの確認] ページで、[インストール] をクリックします。
  7. [結果] ページで、 [閉じる]をクリックします。

Windows 8 または Windows 8.1

  1. [スタート] 画面で、ポインターを左下隅まで移動し、[スタート] ボタンを右クリックし、[コントロール パネル] をクリックします。
  2. [コントロール パネル][プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。
  3. [インターネット インフォメーション サービス][Web 管理ツール] の順に展開し、[IIS 管理サービス] チェック ボックスをオンにします。
    Screenshot of the Web Management Tools folder being expanded with the I I S Management Service folder being highlighted.
  4. OK をクリックします。
  5. 閉じるをクリックします。

Windows Server 2008 または Windows Server 2008 R2

  1. タスク バーで [スタート] をクリックし、[管理ツール] をポイントして、[サーバー マネージャー] をクリックします。
  2. [Server Manager] (サーバー マネージャー) 階層ウィンドウで [ロール] を展開し、[Web Server (IIS)] (Web サーバー (IIS)) をクリックします。
  3. [Web サーバー (IIS)] ウィンドウで、[役割サービス] セクションまでスクロールし、[役割サービスの追加] をクリックします。
  4. 役割サービスの追加ウィザード[役割サービスの選択] ページで、[管理サービス] を選択し、[次へ] をクリックします。
    Screenshot of the Management Service option being highlighted.
  5. [インストール オプションの確認] ページで、[インストール] をクリックします。
  6. [結果] ページで、 [閉じる]をクリックします。

Windows Vista または Windows 7

  1. タスク バーで、[スタート][コントロール パネル] の順にクリックします。
  2. [コントロール パネル][プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。
  3. [インターネット インフォメーション サービス][Web 管理ツール] の順に展開します。
  4. [IIS 管理サービス] を選択し、[OK] をクリックします。
    Screenshot of the Management Service screen with the Enable Remote connections option selected.

操作方法

サーバーの IIS マネージャー資格情報を有効にする方法

  1. インターネット インフォメーション サービス (IIS) マネージャーを開きます。

    • Windows Server 2012 または Windows Server 2012 R2 を使用している場合:

      • タスク バーで、[サーバー マネージャー] をクリックし、[ツール][インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
    • Windows 8 または Windows 8.1 を使用している場合:

      • Windows キーを押しながら文字 X を押し、[コントロール パネル] をクリックします。
      • [管理ツール] をクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
    • Windows Server 2008 または Windows Server 2008 R2 を使用している場合:

      • タスク バーで、[スタート] ボタンをクリックし、[管理ツール][インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
    • Windows Vista または Windows 7 を使用している場合:

      • タスク バーで、[スタート][コントロール パネル] の順にクリックします。
      • [管理ツール] をダブルクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
  2. [接続] ウィンドウで、サーバー名をクリックします。

  3. サーバーの [ホーム] ウィンドウで、[管理サービス] をダブルクリックします。
    Screenshot of the Home pane with the Management Service option being highlighted.

  4. [管理サービス] ページで、[Windows credentials or IIS Manager credentials]\(Windows 資格情報または IIS マネージャー資格情報\) を選択し、[操作] ウィンドウで [適用] をクリックします。
    Screenshot of the Identity Credentials section with the Windows credentials or I I S Manager credentials option being selected.

IIS マネージャーのユーザー資格情報をサーバーに追加する方法

  1. インターネット インフォメーション サービス (IIS) マネージャーを開きます。

    • Windows Server 2012 または Windows Server 2012 R2 を使用している場合:

      • タスク バーで、[サーバー マネージャー] をクリックし、[ツール][インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
    • Windows 8 または Windows 8.1 を使用している場合:

      • Windows キーを押しながら文字 X を押し、[コントロール パネル] をクリックします。
      • [管理ツール] をクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
    • Windows Server 2008 または Windows Server 2008 R2 を使用している場合:

      • タスク バーで、[スタート] ボタンをクリックし、[管理ツール][インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
    • Windows Vista または Windows 7 を使用している場合:

      • タスク バーで、[スタート][コントロール パネル] の順にクリックします。
      • [管理ツール] をダブルクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
  2. [接続] ウィンドウで、サーバー名をクリックします。

  3. サーバーの [ホーム] ページで、[IIS マネージャー ユーザー] をダブルクリックします。
    Screenshot of the I I S Manager Users icon in the Home pane being highlighted.

  4. [IIS マネージャー ユーザー] ページの [操作] ウィンドウで、[ユーザーの追加...] をクリックします。
    Screenshot of the I I S Manager Users page.

  5. [ユーザーの追加] ダイアログ ボックスで、ユーザー名とパスワードを入力し、[OK] をクリックします。
    Screenshot of the Add User dialog box, showing the User Name, Password, and Confirm password fields.

構成

属性

属性 説明
defaultProvider 省略可能な文字列属性。

Web サーバー上の IIS マネージャー ユーザーに認証を提供する既定のプロバイダーを指定します。

既定のプロバイダーを変更する場合は、変更を有効にするために管理サービス (WMSVC) を再起動する必要があります。 IIS マネージャーを開いている場合は、IIS マネージャーも開き直す必要があります。

子要素

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

ユーザーが IIS マネージャーを使用してサーバー上のサイトとアプリケーションに接続できるように、IIS マネージャーのユーザー資格情報を構成します。
providers 省略可能な要素です。

IIS マネージャーを使用してサイトとアプリケーションにリモート接続する IIS マネージャー ユーザーを認証する認証プロバイダーを構成します。

構成サンプル

次の構成サンプルは、ContosoUser という名前の IIS マネージャー ユーザーを Administration.config に追加する方法を示しています。

<credentials>
   <add name="ContosoUser" password="Encrypted-Password-Data" enabled="true" />
</credentials>

<authentication> 要素の下にある次の既定の <providers> 要素は、管理サービスの役割サービスがインストールされている場合、IIS 7 の Administration.config ファイルで構成されます。

<authentication defaultProvider="ConfigurationAuthenticationProvider">
   <providers>
      <add name="ConfigurationAuthenticationProvider"
         type="Microsoft.Web.Management.Server.ConfigurationAuthenticationProvider, Microsoft.Web.Management, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
   </providers>
</authentication>

サンプル コード

次のコード サンプルでは、ContosoUser という名前の IIS マネージャー ユーザー アカウントを IIS 7 に追加します。

AppCmd.exe

Note

AppCmd.exe を使用して <system.webServer/management/authentication> 設定を構成することはできません。

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.GetAdministrationConfiguration();

         ConfigurationSection authenticationSection = config.GetSection("system.webServer/management/authentication");
         ConfigurationElementCollection credentialsCollection = authenticationSection.GetCollection("credentials");
         ConfigurationElement addElement = credentialsCollection.CreateElement("add");
         addElement["name"] = @"ContosoUser";
         addElement["password"] = @"P@ssw0rd";
         addElement["enabled"] = true;
         credentialsCollection.Add(addElement);

         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.GetAdministrationConfiguration

      Dim authenticationSection As ConfigurationSection = config.GetSection("system.webServer/management/authentication")
      Dim credentialsCollection As ConfigurationElementCollection = authenticationSection.GetCollection("credentials")
      Dim addElement As ConfigurationElement = credentialsCollection.CreateElement("add")
      addElement("name") = "ContosoUser"
      addElement("password") = "P@ssw0rd"
      credentialsCollection.Add(addElement)
      addElement("enabled") = True
      serverManager.CommitChanges()
   End Sub

End Module

JavaScript

var adminManager = new ActiveXObject("Microsoft.ApplicationHost.WritableAdminManager"); 
adminManager.CommitPath = "MACHINE/WEBROOT"; 
adminManager.SetMetadata("pathMapper", "AdministrationConfig");

var authenticationSection = adminManager.GetAdminSection("system.webServer/management/authentication", "MACHINE/WEBROOT"); 
var credentialsCollection = authenticationSection.ChildElements.Item("credentials").Collection;

var addElement = credentialsCollection.CreateNewElement("add");
addElement.Properties.Item("name").Value = "ContosoUser";
addElement.Properties.Item("password").Value = "P@ssw0rd";
addElement.Properties.Item("enabled").Value = true;
credentialsCollection.AddElement(addElement);

adminManager.CommitChanges();

VBScript

Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT"
adminManager.SetMetadata "pathMapper", "AdministrationConfig"

Set authenticationSection = adminManager.GetAdminSection("system.webServer/management/authentication", "MACHINE/WEBROOT")
Set credentialsCollection = authenticationSection.ChildElements.Item("credentials").Collection

Set addElement = credentialsCollection.CreateNewElement("add")
addElement.Properties.Item("name").Value = "ContosoUser"
addElement.Properties.Item("password").Value = "P@ssw0rd"
addElement.Properties.Item("enabled").Value = True
credentialsCollection.AddElement(addElement)

adminManager.CommitChanges()

Note

このドキュメントの例は、.NET グローバル アセンブリ キャッシュ (GAC) に格納されているマネージドコード アセンブリの使用を示しています。 これらの例のコードを使用して独自のアセンブリを配置する前に、GAC からアセンブリ情報を取得する必要があります。 そのためには、次の手順を行ってください。

  • Windows エクスプローラーで、C:\Windows\assembly パスを開きます。C: はオペレーティング システム ドライブです。
  • アセンブリを見つけます。
  • アセンブリを右クリックし、[プロパティ] をクリックします。
  • カルチャ値 (例: Neutral) をコピーします。
  • Version 番号 (例: 1.0.0.0) をコピーします。
  • 公開キー トークン値 (例: 426f62526f636b73) をコピーします。
  • [キャンセル] をクリックします。

次のコード例では、ContosoAuthenticationProvider という名前の認証プロバイダーを管理認証プロバイダーのコレクションに追加し、既定の認証プロバイダーを ContosoAuthenticationProvider に設定します。

AppCmd.exe

Note

AppCmd.exe を使用して <system.webServer/Management> 設定を構成することはできません。

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.GetAdministrationConfiguration();

         ConfigurationSection authenticationSection = config.GetSection("system.webServer/management/authentication");
         ConfigurationElementCollection providersCollection = authenticationSection.GetCollection("providers");
         ConfigurationElement addElement = providersCollection.CreateElement("add");
         addElement["name"] = @"ContosoAuthenticationProvider";
         addElement["type"] = @"Contoso.Provider, System.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=426f62526f636b73";
         providersCollection.Add(addElement);
         authenticationSection["defaultProvider"] = "ContosoAuthenticationProvider";

         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.GetAdministrationConfiguration

      Dim authenticationSection As ConfigurationSection = config.GetSection("system.webServer/management/authentication")
      Dim providersCollection As ConfigurationElementCollection = authenticationSection.GetCollection("providers")
      Dim addElement As ConfigurationElement = providersCollection.CreateElement("add")
      addElement("name") = "ContosoAuthenticationProvider"
      addElement("type") = "Contoso.Provider, System.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=426f62526f636b73"
      providersCollection.Add(addElement)
      authenticationSection("defaultProvider") = "ContosoAuthenticationProvider"

      serverManager.CommitChanges()
   End Sub

End Module

JavaScript

var adminManager = new ActiveXObject("Microsoft.ApplicationHost.WritableAdminManager"); 
adminManager.CommitPath = "MACHINE/WEBROOT"; 
adminManager.SetMetadata("pathMapper", "AdministrationConfig");

var authenticationSection = adminManager.GetAdminSection("system.webServer/management/authentication", "MACHINE/WEBROOT"); 
var providersCollection = authenticationSection.ChildElements.Item("providers").Collection;

var addElement = providersCollection.CreateNewElement("add");
addElement.Properties.Item("name").Value = "ContosoAuthenticationProvider";
addElement.Properties.Item("type").Value = "Contoso.Provider, System.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=426f62526f636b73";
providersCollection.AddElement(addElement);
authenticationSection.Properties.Item("defaultProvider").Value = "ContosoAuthenticationProvider";

adminManager.CommitChanges();

VBScript

Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT"
adminManager.SetMetadata "pathMapper", "AdministrationConfig"

Set authenticationSection = adminManager.GetAdminSection("system.webServer/management/authentication", "MACHINE/WEBROOT")
Set providersCollection = authenticationSection.ChildElements.Item("providers").Collection

Set addElement = providersCollection.CreateNewElement("add")
addElement.Properties.Item("name").Value = "ContosoAuthenticationProvider"
addElement.Properties.Item("type").Value = "Contoso.Provider, System.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=426f62526f636b73"
providersCollection.AddElement(addElement)
authenticationSection.Properties.Item("defaultProvider").Value = "ContosoAuthenticationProvider"

adminManager.CommitChanges()