There are two things:
1. Just insert this code in the web.release.config
<system.webServer xdt:Transform=”Insert”>
<rewrite>
<rules>
<rule name=”Force HTTPS” enabled=”true”>
<match url=”(.*)” ignoreCase=”false” />
<conditions>
<add input=”{HTTPS}” pattern=”off” />
</conditions>
<action type=”Redirect” url=”https://{HTTP_HOST}/{R:1}” appendQueryString=”true” redirectType=”Permanent” />
</rule>
</rules>
</rewrite>
</system.webServer>
2. Then make sure that the Url Rewrite module is installed in IIS – if that module is not installed you will get perplexing, unhelpful error messages