A Unified Communication Blog
Get Adobe Flash player

In my series about using Lync and Exchange better together, we will in this post, be looking at integrating Lync and Exchange so that we can use Exchange as a unified contact store.


What is Unified Contact store you might ask?

Before we got Lync 2013 and Exchange 2013, both products have there own way of storing the users contacts.

Lync can store contacts in Exchange or actually in Outlook in a Lync Contact folder, which is synchronized, and this sometimes can cause problems if they get out of sync.


But still we have contacts stored both places.

With Unified Contacts Store we only have the Lync contacts stored in Exchange, and not storing them in Lync. For this to work Exchange Web Services must be working and we need to setup a couple of things in Exchange and Lync.



Before we can start you must have a running Exchange 2013 and Lync Server 2013 which is both patched with all the latest patches.

We then need to setup up server-to-server authentication, which you might know as Oauth in Lync. In the installation of Lync you have created a oauth certificate, which is replicated among the lync servers.

With Oauth the servers is not exchanging usernames and password, but instead the authentication is done though tokens which are exchanged though the servers.


First we need to get the autodiscover URL from Exchange which you can find with this cmdlet

Get-ClientAccessServer | fl -Property AutoDiscoverServiceInternalUri

If command is empty in your installation, you will need to define it with Set-ClientAccessServer.

The FQDN name you have in your autodiscover url must be in the certificate that is assigned to Exchange.

On the Lync frontend server you need to define the autodiscover url, but instead of the autodiscover.xml document you must define it as autodiscover.svc

Set-CsOAuthConfiguration -Identity global -ExchangeAutodiscoverUrl https://outlook.exchpro.dk/Autodiscover/autodiscover.svc

Next we need to configure Lync and Exchange as partner applications to each other.

From Exchange this is done though a powershell script which is shipped with Exchange called Configure-EnterprisePartnerApplication.ps1

With this script you tell Exchange the name of the frontend pool, and extend that with /metadata/json/1

Configure-EnterprisePartnerApplication.ps1 -AuthMetaDataUrl ‘https://fe01.exchangepro.local/metadata/json/1′ -ApplicationType Lync

After that run a iisreset on the Exchange Server.

Next we need to do the same from Lync with this command:

New-CsPartnerApplication -Identity Exchange -ApplicationTrustLevel Full -MetadataUrl “https://outlook.exchpro.dk/autodiscover/metadata/json/1″

We have now configured Exchange and Lync as partner for each other, and you can test the connection with this command:

Test-CsExStorageConnectivity -SipUri “sip:joachim@exchangepro.dk”

You should see a “Test Passed” – if you do everything works correct.


Normally you are done now and the users contacts will be migrated to Exchange.

The default setting in Lync is that UCSAllowed is set to true in the Global Policy


You could create a new Policy and assign it to a number of users with these cmdlets:

New-CsUserServicesPolicy -Identity “UnifiedContactStore” -UcsAllowed $True
Grant-CsUserServicesPolicy -Identity “joachim” -PolicyName “UnifiedContactStore”


You can check the state of the migration of the contacts with:

Debug-CsUnifiedContactStore -Identity joachim@exchangepro.dk |fl


If it says ready to migrate, the contacts will be migrated with in a couple of minutes


And then it will show:


When the contacts has been successful migrated you the users will get a prompt telling them to restart Lync


You can check the migration state on frontend pool with this cmdlet:

Debug-CsUnifiedContactStore -PoolFqdn fe01.exchangepro.local


If you see an error like this:

It could a number of things, but what I most often see is that the Exchange Contact Sync has been disabled in the CsClientPolicy


Enable this with

Set-CsClientPolicy -EnableExchangeContactSync $true

You could also assign a UserServicePolicy to the user to force the migration.


This is it….


Use Lync and Exchange Better together

Other posts in the series:

OWA Integration: http://exchangepro.dk/2014/01/19/use-lync-and-exchange-better-together-part-1/

Voicemail: http://exchangepro.dk/2014/01/24/use-lync-and-exchange-better-together-part-2/

Voicemail in Office 365: http://exchangepro.dk/2014/01/28/use-lync-and-exchange-better-together-part-3/

Unified Contact Store: http://exchangepro.dk/2014/02/11/use-lync-and-exchange-better-together-part-4/


6 Responses to Use Lync and Exchange Better together – Part 4

  • Thanks Joachim for this series, it’s been very useful to me.

    • Hello Joachim,

      I followed your instructions, but when I use a lync client to try to contact the voicemail, it just don’t work and the voicemail user appears as offline.

      Do you have any clue about what I should do to resolve this ?

      Thanks in advance

      • Hi Georges

        Are you accessing the voicemail from the phone tab in the Lync client ? and also did you remember to restart the frontend service.
        Do you get any errors in the eventlog on the server?


  • Any idea why I can’t seem to get UCS working between Lync (on-premises) and Exchange Online? I obviously can’t run some of those initial commands on the Office 365 servers.

    • Hi Willie

      What is that is not working ? is it IM or voicemail.

      • IM is working. Voicemail is working. Just the contact sync with UCS does not seem to work.
        I’m pretty sure that it has to do with autodiscover not working the same with O365.
        O365 has you point autodiscover.domain.com => autodiscover.outlook.com. But then autodiscover.outlook.com does not listen over HTTPS port 443 because they can’t provide a certificate for autodiscover.domain.com. Lync Server seems to only try HTTPS autodiscover and not fall-back to HTTP.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 77 other subscribers

Follow me on Twitter