I tried the following rules, still it is not working
<rewrite>
<rules>
<rule name="rule1" stopprocessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_CLUSTER_HTTPS}" pattern="^on$" negate="true" />
<add input="{HTTP_CLUSTER_HTTPS}" pattern=".+" negate="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{SCRIPT_NAME}" redirecttype="SeeOther" />
</rule>
<rule name="rule2" stopprocessing="true">
<match url="(^agent/amonticone/.*)" ignorecase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:0}" appendquerystring="true" redirecttype="SeeOther" />
</rule>
</rules>
</rewrite>