Request Filtering, URLScan With Windows Azure Web Role

As you may know URLScan feature is deprecated from IIS7 and Within IIS 7, all the core features of URLScan have been incorporated into a module called Request Filtering, and a Hidden Segments feature has been added. Windows Azure instances for Web Role use IIS7.0 so there is no URLScan to use by default.
More Info: https://learn.iis.net/page.aspx/143/use-request-filtering/

So if you are using Windows Azure and wants to use URLScan the preferred suggestion is to use “Request Filtering” instead of URLScan exactly same way you would do in any ASP.NET website running on IIS7.0+.

However if you really have to use URLScan with Windows Azure Web Role your will have to install URLScan using WebPI in Startup task and then configure it as well.

Following is the batch script to install URLScan during Windows Azure Web Role Startup Task:

  cd "%~dp0"
 md appdata
 reg add "hku\.default\software\microsoft\windows\currentversion\explorer\user shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d "%~dp0appdata" /f 
 WebPICmdLine.exe /accepteula /Products:UrlScan
 reg add "hku\.default\software\microsoft\windows\currentversion\explorer\user shell folders" /v "Local AppData" /t REG_EXPAND_SZ /d %%USERPROFILE%%\AppData\Local /f 
 exit /b 0

Thanks to Arvind MSFT for providing the script.