iis
iis copied to clipboard
Setting up Windows Authentication for web application
Cookbook version
iis (6.8.0)
Chef-client version
13.6.4
Platform Details
Windows 2008 R2
Scenario:
Setting up Windows Authentication for web application
Steps to Reproduce:
iis_site 'MySiteName' do protocol :http #port 80 Default port is 80 path "D:\Folder\Path" action [:add,:start] end
Expected Result:
How do I enable windows authentication and disable anonymous auth?
Actual Result:
I did not find any doc. This is a feature request.
looks like currently it has to be done via
# Set IUSR username and password authentication
iis_config "\"MyWebsite/aSite\" -section:system.webServer/security/authentication/anonymousAuthentication /enabled:\"True\" /userName:\"IUSR_foobar\" /password:\"p@assword\" /commit:apphost" do
action :set
end
which isn't idempotent...
this is the best windows doc i can find
appcmd.exe set config "Contoso" -section:system.webServer/security/authentication/anonymousAuthentication /enabled:"False" /commit:apphost
appcmd.exe set config "Contoso" -section:system.webServer/security/authentication/windowsAuthentication /enabled:"True" /commit:apphost
so it looks like it is on the apphost, which makes me not sure if you can commit it to a specific site only
The following works for me. Give it a shot!
iis_config_property "disable anonymous auth" do
ps_path "IIS:\\"
filter "/system.WebServer/security/authentication/anonymousAuthentication"
location "<site name here>"
property "Enabled"
value "False"
action :set
end
iis_config_property "enable windows auth" do
ps_path "IIS:\\"
filter "/system.WebServer/security/authentication/windowsAuthentication"
location "<site name here>"
property "Enabled"
value "True"
action :set
end