IIS Clear-WebConfiguration cmdlet needs to be executed twice for inherited URL Authorization rules


i trying write dsc resource manage iis url authorization rules, when attempting remove inherited rule (via clear-webconfiguration) instead of removing rule creating local copy of rule.

the workaround run clear-webconfiguration command twice isn't elegant , results in warning if rule trying remove isn't inherited.

i have few questions in relation this:

  1. if expected behaviour there way override this?
  2. is there way determine via get-webconfiguration (or other) if rule has been inherited or local?

steps reproduce:

1. iis site (e.g. default web site) has inherited url authorization rules (e.g. allow users)
2. in powershell execute clear-webconfiguration -filter "/system.webserver/security/authorization/add[@users='*' , @roles='' , @verbs='']" -pspath "iis:\sites\default web site"

expected results:

1. url authorization rules updated remove allow users directive.

actual results:

1. url authorization rule allow users enabled locally (i.e. not inherited)
2. web.config contents (below) shows entry both remove (inherited) rule , contains local entry allow users

<?xml version="1.0" encoding="utf-8"?>  <configuration>      <system.webserver>          <security>              <authorization>                  <remove users="*" roles="" verbs="" />                  <add accesstype="allow" users="*" />              </authorization>          </security>      </system.webserver>  </configuration>

workaround:

1. run clear-webconfiguration twice achieve expected behaviour

hi,

thanks post, issue might related iis, suggest post problem on iis related forum:

https://forums.iis.net/

best regards,

elaine


please remember mark replies answers if , unmark them if provide no help. if have feedback technet subscriber support, contact tnmff@microsoft.com.



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

DCOM received error "2147746132" from...

DFSR RPC replication errors 5014 1726 with large files over VPN

ADFS 3.0 Event ID 4625 | An Error occurred During Logon | Status: 0xC000035B