Usage reports in Consuming farm not populating-SharePoint 2013

Worked an issue few months ago where we have a consuming publishing farm scenario. Usage reports have no data in them. Many thanks to Anthony for helping figure this out!

On the Search farm (APC server) Sharepoint logs showed below:

03/11/2015 13:50:55.90        OWSTIMER.EXE (******:0x28E0)        0x44E4        SharePoint Server Search        Analytics        agmik        High        AnalyticsDataFilter: SPRequestUsageEntry filtered out because tenant settings could not be loaded.       

On the Content farm using Sharepoint timer Account we queried the SSA proxy for the analytics tenant settings and we got– Access Denied

$ssaproxy.getRawAnayticsTenantSettings([GUID]::Empty) ( Where $ssaproxy=get-spenterprisesearchserviceapplicationproxy)

Exception calling "getRawAnayticsTenantSettings"with "1" argument(s):"Access is denied"

(Also note above that GetRawAnayticsTenantSettings is not a typo)

Looking at the logs:

04/17/2015 15:37:37.75              PowerShell.exe (0x2FEC)             0x35F0              SharePoint Server Search            Query   dka5      High              SearchServiceApplicationProxy::GetRawAnayticsTenantSettings--Error occured: System.ServiceModel.Security.SecurityAccessDeniedException: Access is denied.    Server stack trace:      at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)     at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)    Exception rethrown at [0]:      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)     at Microsoft.Office.Server.Search.Analytics.IAnalyticsServiceApplication.GetRawAnayticsTenantSettings(Guid tenantId)     at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.<>c__DisplayClass2ea.<GetRawAnayticsTenantSettings>b__2e9(ISearchServiceApplication serviceApplication)     at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.DoSpLoadBalancedUriWsOp[T](WebServiceBackedOperation`1 webServiceCall, Int32 timeoutInMilliseconds, Int32 wcfTimeoutInMilliseconds, String operationName)         01f12c40-f800-0000-5d5f-d685055fd001

So it looked like some sort of permissions were missing.  

Turns out Missing claimID of the consuming farm was the issue here

https://technet.microsoft.com/en-us/library/ff700211.aspx

Next ran below powershell to register FarmID as a claimType.

 Ran below in publishing farm:

 $security = Get-SPServiceApplication SSAGUID| Get-SPServiceApplicationSecurity

$claimprovider=(Get-SPClaimProvider System).ClaimProvider

$principal=New-SPClaimsPrincipal -ClaimType "https://schemas.microsoft.com/sharepoint/2009/08/claims/farmid" -ClaimProvider $claimprovider -ClaimValue "consumingfarmid"

Grant-SPObjectSecurity -Identity $security -Principal $principal -Rights "Full Control"

Set-SPServiceApplicationSecurity SSAGUID  -ObjectSecurity $security

 

Consumingfarmid is the GUID value of the consuming farm which you can get by running Get-SPFarm | Select Id

Run below command on content farm using the SP timer account: No access denied anymore.

$ssaproxy.getRawAnayticsTenantSettings([GUID]::Empty)   ( Where $ssaproxy=get-spenterprisesearchserviceapplicationproxy)

Waited for a day and next day the Usage reports showed us data.