Lync federation with Office 365

It is possible to use federation between Lync in Office 365 and Lync on premises. There have been serveral issues discussed on the Office 365 community and Microsoft has a support article to provide help. I will try to describe the DNS record step more in detail, since this seems to be the problem. Basically you need to to the following:

Add SRV DNS record for Lync federation. According to Microsoft you should add the following:

The problem here is to understand how to add the record. It needs to be added as _sipfederationtls._tcp.<DomainName> and the value as 100 1 5061 sipfed.online.lync.com. Look at this example:

The record can be tested with this great tool: http://www.testmyoffice365.com/

Also, you need to allow federation for your Office 365 domain. Go to the Office 365 admin portal and click on Lync. Open the domain for exteral communication, either by allowing all communication or adding domains to the exception list.