After you install the ADFS server for Office 365, you need to publish the rule in your TMG (Threat Management Gateway) if you are using TMG as your front end firewall. To do that, open the TMG portal and do the following

Create the new rule.

Now create the new Listener for ADFS by doing below.

Then click Select Certificate. (Before you do this, make sure that you have uploaded your certificate for ADFS service in your IIS of TMG. When you upload it, the installed certificate will show as below.)

Above you have to select the valid certificate for ADFS.

Now click OK and your ADFS listener configuration is done. Once you did this, below screen you will be able to select the newly created listener.

Click OK and now your ADFS rule has been created inside TMG.

Now right-click the ADFS rule and select Configure HTTP.

Uncheck the "Verify normalization" and "Block high bit characters" and click OK.

Now your TMG rule for ADFS publishing rule is ready for Production.