I am trying to modify an IIS Web Application that is installed, and change the Authentication Methods. The Default Web Site is set to alloy Anonymous, and disable everything else. When I use the following line in PowerShell:

Write-Host "Enabling Basic Authentication"
Set-WebConfigurationProperty -Filter /system.webServer/security/authentication/basicAuthentication -Name enabled -Value true -PSPath "IIS:\Sites\Default Web Site\$app_name"

I get the following error, and nothing changes.

Enabling Basic Authentication
Set-WebConfigurationProperty : This configuration section cannot be used at this path. This happens when the section is locked at a parent level. 
Locking is either by default (overrideModeDefault="Deny"), or set explicitly by alocation tag with overrideMode="Deny" or the legacy allowOverride="false".
At E:\web_iis_applications\web_application\ps_Install_web_application.ps1:61 char:1
+ Set-WebConfigurationProperty -Filter /system.webServer/security/authe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-WebConfigurationProperty], FileLoadException
    + FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.IIs.PowerShell.Provider.SetConfigurationPropertyCommand

However, I can go right into the UI and modify those entries by a right-click and its done. This, however, is not very helpful when I have to do 20 of these installs on 2 or 3 servers. I know I shouldn't change the Default Web Site's overridgeModeDefault setting, which is why I'm trying to do it per page under default web site.

I'm not the developer of these applications, so I'm not sure if these options could be set in the web.config or not per application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.