Training
Certification
Microsoft Certified: Identity and Access Administrator Associate - Certifications
Demonstrate the features of Microsoft Entra ID to modernize identity solutions, implement hybrid solutions, and implement identity governance.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
by Saad Ladki
This article explains how to enable delegated configuration on the server. It discusses how to deploy configuration settings for the server and for your applications, together with the content pages and application code.
Once the machine administrator has defined the application or virtual directory for your use in the master configuration file %windir%\system32\inetsrv\config\applicationHost.config
, and allowed specific sections to be delegated, you can control the settings at the application level: by making settings in the application's web.config file, you override global defaults. This is possible if you have access to the application's directory, even if you are not a local administrator on the machine.
After reading this document, you will know how to define applications and virtual directories at the global level, unlock configuration sections for delegation, and override configuration settings for individual applications at a lower level of the configuration hierarchy.
IIS allows machine administrators to delegate the task of setting and changing configuration to site and application owners. To do this, use web.config files in the content directories. These files specify configuration sections which take effect on their level in the hierarchy and downward. The machine administrator must explicitly unlock sections at the global level to enable such delegation. By default, most IIS sections are locked down for delegation, and all .NET framework sections (including ASP.NET) are not locked at the global level.
This document explains how to define new applications and virtual directories at the global level (only machine administrators can perform this task; it can never be delegated).
This document then explains how to xcopy-deploy web.config with the application content to override some settings for the specific level. It also explains core concepts of the configuration system, and therefore explains how to do these tasks using direct editing of configuration files, without using the UI or other abstractions on top of the configuration system.
http://localhost/
from IE and see that the default "Under Construction" page opens. If IIS is not installed, refer to the Setup How-To for installation instructions.For example, to launch notepad.exe, run this command: "runas /user:administrator notepad.exe". You will be prompted for the password of the Administrator account. It is useful to have a cmd-box shell that is already elevated, by running "runas /user:administrator cmd.exe". Every application run from that cmd-box is elevated as well, and you do not need to use the "runas" syntax from that cmd-box.
Note
You must be an administrator to do this – see previous bullet point above.
Using a text editor such as Notepad, open the ApplicationHost.config file in the following location:
%windir%\system32\inetsrv\config\applicationHost.config
Navigate to the <sites>
section, which looks similar to the following:
<sites>
<siteDefaults>
<logFile directory="C:\WINDOWS\System32\LogFiles" />
</siteDefaults>
<applicationDefaults applicationPool="DefaultAppPool"/>
<site name="Default Web Site" id="1">
<bindings>
<binding protocol="http" bindingInformation="*:80:" />
</bindings>
<application path="/">
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot" />
</application>
<logFile directory="C:\WINDOWS\System32\LogFiles" />
</site>
</sites>
Verify that the Web server is running and that you can access the default Web site. To do so, launch the browser and request http://localhost/
The request should return a Web page. If it does not, start the IIS server by typing "net start w3svc" from the command-box, or troubleshoot using the Windows Event Log viewer.
In the browser, request http://localhost/
This request does not return a page (you see an error page), because the virtual path is not yet defined in the configuration—this is the next procedure.
In the ApplicationHost.config file, add an <application>
element with path "/app" that includes a top-level <virtualDirectory>
element. Top-level virtual directory is one with path "/". For the physical path of the virtual directory, specify C:\tmp
(or something similar that you will later work with).
When you are finished, the <sites>
sections looks similar to the following:
<sites>
<siteDefaults>
<logFile directory="C:\WINDOWS\System32\LogFiles" />
</siteDefaults>
<applicationDefaults applicationPool="DefaultAppPool"/>
<site name="Default Web Site" id="1">
<bindings>
<binding protocol="http" bindingInformation="*:80:" />
</bindings>
<application path="/">
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot" />
</application>
<application path="/app" >
<virtualDirectory path="/" physicalPath="C:\tmp" />
</application>
<logFile directory="C:\WINDOWS\System32\LogFiles" />
</site>
</sites>
You have just defined a new application in the configuration file.
In the browser, request http://localhost/
The Web server returns an error page, saying that directory browsing is not enabled. This happens because you do not have content yet in c:\tmp
, so the server is handling the request as a request to browse the directory. Copy iisstart.htm from the \inetpub\wwwroot
directory into c:\tmp
and refresh the browser. Now you see the Under Construction page.
Using a text editor such as Notepad, open applicationHost.config and locate the <authentication> section group.
Move the <anonymousAuthentication> and <windowsAuthentication>
sections from their current location in the file into a new location tag at the bottom of the file that has overrideMode="Allow" on it, as follows:
<configuration>
<system.webServer>
<security>
<authentication>
<!-- cut the anonymousAuthentication and windowsAuthentication -->
<!-- XML elements from this area in the file, and paste below -->
</authentication>
</security>
</system.webServer>
<location overrideMode="Allow">
<system.webServer>
<security>
<authentication>
<!-- paste the 2 sections from above here -->
</authentication>
</security>
</system.webServer>
</location>
</configuration>
These sections are now over-ridable by lower-levels of the namespace, because they are in a location tag that specifies overrideMode="Allow". All lower-level web.config files can now override these settings.
Using a text editor such as Notepad, create a new text file in the application folder (e.g. c:\tmp
) named web.config.
In the web.config file, create a <configuration>
element and a <system.webServer>
element as its child. Within the <system.webServer>
element, create a <security>
element that contains an <authentication>
element.
Enter the settings to disable the Windows authentication and anonymous authentication schemes, which are turned on by default at the global level.
When you are finished, the web.config file looks like the following:
<configuration>
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="false" />
<anonymousAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>
</configuration>
In a browser, request http://localhost/app
.
Note
You are not authorized to see the page, because you disabled all authentication methods to this page in your web.config file.
In the browser, request http://localhost/
and confirm that you can access the page. The configuration in the web.config file applies only at the application level.
In the web.config file, enable basic authentication by adding a <basicAuthentication>
element with its enabled attribute set to true.
When you are finished, the web.config file looks like the following:
<configuration>
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="false" />
<anonymousAuthentication enabled="false" />
<basicAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</configuration>
Request http://localhost/app
again. You see an error page saying that some configuration is locked at the global level and the web.config files is trying to override it--therefore it is a configuration error. To resolve this, allow the <basicAuthentication> section at the global level (applicationHost.config) to be overridden, as you did for the two other sections. Then refresh the browser .
You will now be prompted for a user name and password, which indicates the basic authentication is taking place.
Enter the user name and password of the logged-on user, and note that the page displays.
If you request http://localhost/
, you will not be asked to enter user name and password, because the changes to configuration you made apply at the application level only.
Note
The server and the browser both cache the user token. If you wish to start from scratch and you no longer see the user-name prompt, close the browser, and stop the IIS worker process (or run "net stop /y http' from the Windows command line, then "net start w3svc", to restart IIS).
This document explains how to define applications and virtual directories in the master configuration file, applicationHost.config. It also covers how to deploy application-specific configuration files that contain server settings in the <system.webServer>
section. You can add settings to the web.config file in the <system.web>
section group, such as ASP.NET settings.
A good practice is to set access control lists (ACLs) on the web.config file or on the entire directory of your application so that non-administrative users cannot access the file.
Training
Certification
Microsoft Certified: Identity and Access Administrator Associate - Certifications
Demonstrate the features of Microsoft Entra ID to modernize identity solutions, implement hybrid solutions, and implement identity governance.