Adding Management Authentication Credentials <add>

Overview

The <add> element of the <credentials> element adds a user account to the collection of IIS Manager users for Internet Information Services (IIS) 7. IIS Manager users can use IIS Manager to connect to sites and applications for which they are authorized by a server administrator.

Note

The <credentials> element only applies when you use the default ConfigurationAuthenticationProvider as your authentication provider.

Compatibility

Version Notes
IIS 10.0 The <add> element was not modified in IIS 10.0.
IIS 8.5 The <add> element was not modified in IIS 8.5.
IIS 8.0 The <add> element was not modified in IIS 8.0.
IIS 7.5 The <add> element was not modified in IIS 7.5.
IIS 7.0 The <add> element of the <credentials> element was introduced in IIS 7.0.
IIS 6.0 N/A

Setup

The default installation of IIS 7 and later does not include the Management Service role service. To install this role service, use the following steps.

Windows Server 2012 or Windows Server 2012 R2

  1. On the taskbar, click Server Manager.
  2. In Server Manager, click the Manage menu, and then click Add Roles and Features.
  3. In the Add Roles and Features wizard, click Next. Select the installation type and click Next. Select the destination server and click Next.
  4. On the Server Roles page, expand Web Server (IIS), expand Management Tools, and then select Management Service. Click Next.
    Screenshot of Server roles page showing Management Tools pane expanded and Management Service selected. .
  5. On the Select features page, click Next.
  6. On the Confirm installation selections page, click Install.
  7. On the Results page, click Close.

Windows 8 or Windows 8.1

  1. On the Start screen, move the pointer all the way to the lower left corner, right-click the Start button, and then click Control Panel.
  2. In Control Panel, click Programs and Features, and then click Turn Windows features on or off.
  3. Expand Internet Information Services, expand Web Management Tools, and then select IIS Management Service.
    Screenshot of Web Management Tools node expanded and I I S Management Service highlighted.
  4. Click OK.
  5. Click Close.

Windows Server 2008 or Windows Server 2008 R2

  1. On the taskbar, click Start, point to Administrative Tools, and then click Server Manager.
  2. In the Server Manager hierarchy pane, expand Roles, and then click Web Server (IIS).
  3. In the Web Server (IIS) pane, scroll to the Role Services section, and then click Add Role Services.
  4. On the Select Role Services page of the Add Role Services Wizard, select Management Service, and then click Next.
    Screenshot of Select Role Services in Add Role Services Wizard showing Management Tools node expanded and Management Service selected.
  5. On the Confirm Installation Selections page, click Install.
  6. On the Results page, click Close.

Windows Vista or Windows 7

  1. On the taskbar, click Start, and then click Control Panel.
  2. In Control Panel, click Programs and Features, and then click Turn Windows Features on or off.
  3. Expand Internet Information Services, then Web Management Tool.
  4. Select IIS Management Service, and then click OK.
    Screenshot displays Management Service dialog box with Enable remote connections box selected.

How To

How to enable IIS Manager credentials for a server

  1. Open Internet Information Services (IIS) Manager:

    • If you are using Windows Server 2012 or Windows Server 2012 R2:

      • On the taskbar, click Server Manager, click Tools, and then click Internet Information Services (IIS) Manager.
    • If you are using Windows 8 or Windows 8.1:

      • Hold down the Windows key, press the letter X, and then click Control Panel.
      • Click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
    • If you are using Windows Server 2008 or Windows Server 2008 R2:

      • On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
    • If you are using Windows Vista or Windows 7:

      • On the taskbar, click Start, and then click Control Panel.
      • Double-click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
  2. In the Connections pane, click the server name.

  3. In the server's Home pane, double-click Management Service.
    Screenshot shows Server Home pane with Management Service feature selected.

  4. On the Management Service page, choose Windows credentials or IIS Manager credentials, then click Apply in the Actions pane.
    Screenshot of Management Service page with Windows Credentials or I I S Manager Credentials option selected.

How to add IIS Manager user credentials to a server

  1. Open Internet Information Services (IIS) Manager:

    • If you are using Windows Server 2012 or Windows Server 2012 R2:

      • On the taskbar, click Server Manager, click Tools, and then click Internet Information Services (IIS) Manager.
    • If you are using Windows 8 or Windows 8.1:

      • Hold down the Windows key, press the letter X, and then click Control Panel.
      • Click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
    • If you are using Windows Server 2008 or Windows Server 2008 R2:

      • On the taskbar, click Start, point to Administrative Tools, and then click Internet Information Services (IIS) Manager.
    • If you are using Windows Vista or Windows 7:

      • On the taskbar, click Start, and then click Control Panel.
      • Double-click Administrative Tools, and then double-click Internet Information Services (IIS) Manager.
  2. In the Connections pane, click the server name.

  3. In the server's Home pane, double-click IIS Manager Users.
    Screenshot displays Home pane with I I S Manager Users selected.

  4. On the IIS Manager Users page, click Add User... in the Actions pane.
    Screenshot of I I S Manager Users page.

  5. In the Add User dialog box, enter the user name and password, and then click OK.
    Screenshot displays Add User dialog box with fields populated with User name and password.

Configuration

Attributes

Attribute Description
name Required string attribute.

Specifies the user name of the IIS Manager user account.
password Required string attribute.

Specifies the SHA256 hash of the user's password for the IIS Manager user account. This attribute is case sensitive.

If you configure an IIS Manager user account by using IIS Manager, the password hash is computed automatically. If you want to calculate the hash of a password programmatically, you can use the System.Security.Cryptography.SHA256.ComputeHash method. For more information, see SHA256 Class on MSDN.
enabled Optional Boolean attribute.

Specifies whether the IIS Manager user is enabled (true) or disabled (false). When true, the IIS Manager user can use IIS Manager to connect to all sites and applications for which they have authorized by a server administrator on the Web server.

The default value is true.

Child Elements

None.

Configuration Sample

The following configuration sample shows how to add an IIS Manager user named ContosoUser to Administration.config.

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

Sample Code

The following code samples add an IIS Manager user account named ContosoUser to IIS 7.

AppCmd.exe

Note

You cannot configure <system.webServer/management/authentication> settings using AppCmd.exe.

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()