%3CLINGO-SUB%20id%3D%22lingo-sub-621174%22%20slang%3D%22en-US%22%3ELync%20Backup%20Service%20-%20EVENT%20ID%204060%20-%20The%20server%20principal%20%22CONTOSO%5Cskype-pool1-FE2%24%22%20is%20not%20able%20to%20access%20the%20database%20%22msdb%22%20under%20the%20current%20security%20context.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-621174%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3E%20First%20published%20on%20TECHNET%20on%20May%2025%2C%202017%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ERecently%2C%20I%20was%20working%20on%20a%20case%20with%20pool-pairing%20with%20a%20unique%20twist.%20The%20import%20status%20for%20Conferencing%20Module%20was%20working%2C%20but%20for%20User%20Module%20was%20failing%20.%20Upon%20looking%20further%2C%20I%20noticed%20EVENT%20ID%204060%20with%20the%20following%20text%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CHR%20%2F%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3ELog%20Name%3A%20Lync%20Server%20%3CBR%20%2F%3E%3CBR%20%2F%3ESource%3A%20LS%20Backup%20Service%20%3CBR%20%2F%3E%3CBR%20%2F%3EDate%3A%205%2F16%2F2017%2011%3A25%3A48%20AM%20%3CBR%20%2F%3E%3CBR%20%2F%3EEvent%20ID%3A%204060%20%3CBR%20%2F%3E%3CBR%20%2F%3ETask%20Category%3A%20(4000)%20%3CBR%20%2F%3E%3CBR%20%2F%3ELevel%3A%20Error%20%3CBR%20%2F%3E%3CBR%20%2F%3EKeywords%3A%20Classic%20%3CBR%20%2F%3E%3CBR%20%2F%3EUser%3A%20N%2FA%20%3CBR%20%2F%3E%3CBR%20%2F%3EComputer%3A%20skype-pool1-FE2.contoso.com%20%3CBR%20%2F%3E%3CBR%20%2F%3EDescription%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3ESkype%20for%20Business%20Server%202015%2C%20Backup%20Service%20user%20store%20backup%20module%20failed%20to%20complete%20import%20operation.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3EConfigurations%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3EBackup%20Module%20Identity%3AUserServices.PresenceFocus%20%3CBR%20%2F%3E%3CBR%20%2F%3EWorking%20Directory%20path%3A%5C%5C%20%3CSPAN%3E%20contoso.com%20%3C%2FSPAN%3E%20%5CSFBShare%5C1-BackupService-2%5CBackupStore%5CTemp%20%3CBR%20%2F%3E%3CBR%20%2F%3ELocal%20File%20Store%20Unc%20path%3A%5C%5C%20%3CSPAN%3E%20contoso.com%20%3C%2FSPAN%3E%20%5CSFBShare%5C1-BackupService-2%5CBackupStore%20%3CBR%20%2F%3E%3CBR%20%2F%3ERemote%20File%20Store%20Unc%20path%3A%5C%5C%20%3CSPAN%3E%20contoso.com%20%3C%2FSPAN%3E%20%5C%20%3CSPAN%3E%20SFBShare%20%3C%2FSPAN%3E%20%5C2-BackupService-1%5CBackupStore%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3EAdditional%20Message%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3EException%3A%20Microsoft.Rtc.BackupService.ImportOperationException%3A%20Import%20operation%20(from%20zip%20archive%20)%20is%20failed%20due%20to%3A%20%3CSTRONG%3E%20Failed%20to%20execute%20stored%20procedure%20XdsQueryReplicaStatus.%20Native%20Error%3A%20916%2C%20Exception%3A%20The%20server%20principal%20%22CONTOSO%5Cskype-pool1-FE2%24%22%20is%20not%20able%20to%20access%20the%20database%20%22msdb%22%20under%20the%20current%20security%20context.%20%3C%2FSTRONG%3E%20.%20Retriable%3A%20False.%20Cookie%3A%20.%20---%26gt%3B%20System.Data.SqlClient.SqlException%3A%20%3CSPAN%3E%20The%20server%20principal%20%22CONTOSO%5Cskype-pool1-FE2%24%22%20is%20not%20able%20to%20access%20the%20database%20%22msdb%22%20under%20the%20current%20security%20context.%20%3C%2FSPAN%3E%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20System.Data.SqlClient.SqlConnection.OnError(SqlException%20exception%2C%20Boolean%20breakConnection%2C%20Action%601%20wrapCloseInAction)%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject%20stateObj%2C%20Boolean%20callerHasConnectionLock%2C%20Boolean%20asyncClose)%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20System.Data.SqlClient.TdsParser.TryRun(RunBehavior%20runBehavior%2C%20SqlCommand%20cmdHandler%2C%20SqlDataReader%20dataStream%2C%20BulkCopySimpleResultSet%20bulkCopyHandler%2C%20TdsParserStateObject%20stateObj%2C%20Boolean%26amp%3B%20dataReady)%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean%26amp%3B%20moreRows)%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean%20setTimeout%2C%20Boolean%26amp%3B%20more)%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20System.Data.SqlClient.SqlDataReader.TryNextResult(Boolean%26amp%3B%20more)%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20System.Data.SqlClient.SqlDataReader.NextResult()%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20Microsoft.Rtc.Common.Data.DBCore.ParseResults(SprocContext%20sprocContext%2C%20SqlDataReader%20sqlReader)%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20Microsoft.Rtc.Common.Data.DBCore.Execute(SprocContext%20sprocContext%2C%20SqlConnection%20sqlConnection%2C%20SqlTransaction%20sqlTransaction)%20%3CBR%20%2F%3E%3CBR%20%2F%3E---%20End%20of%20inner%20exception%20stack%20trace%20---%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20Microsoft.Rtc.BackupService.BackupModules.XdsBackupModuleBase.QueryBackupStatus()%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20Microsoft.Rtc.BackupService.BackupModules.UserStoreBackupModule.GetBackupCookie()%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20Microsoft.Rtc.BackupService.BackupModuleHandler.ReceiveBackupDataTask.GetBackupCookie(Boolean%26amp%3B%20isModuleInitialized)%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20Microsoft.Rtc.BackupService.BackupModuleHandler.ReceiveBackupDataTask.InternalExecute()%20%3CBR%20%2F%3E%3CBR%20%2F%3Eat%20Microsoft.Rtc.Common.TaskManager%601.ExecuteTask(Object%20state)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3ECause%3A%20Either%20network%20or%20permission%20issues.%20Please%20look%20through%20the%20exception%20details%20for%20more%20information.%20%3CBR%20%2F%3E%3CBR%20%2F%3EResolution%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3EResolution%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CHR%20%2F%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESo%20I%20decided%20to%20collect%20logs%20the%20built-in%20scenario%20HADR.%20The%20scenario%20HADR%20has%20the%20following%20components%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EBackupService%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3EPowerShell%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3ERtcDbSyncAgent%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%3E%20UserServices%20%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%20Since%20the%20scenario%20included%20both%20BackupService%20and%20UserServices%2C%20I%20was%20optimistic%20that%20I%20would%20certainly%20nail-down%20the%20issue.%20However%2C%20the%20logs%20were%20not%20leading%20me%20to%20any%20solution.%20It%20was%20only%20providing%20the%20name%20of%20the%20sproc%20%3CSTRONG%3E%20XdsQueryReplicaStatus%20%3C%2FSTRONG%3E%20.%20However%2C%20this%20sproc%20exists%20on%20the%20Front-End%20Server%20and%20the%20Back-End%20Servers%2C%20so%20I%20needed%20more%20information%20on%20which%20database%20to%20troubleshoot.%20%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENext%20I%20decided%20to%20collect%20a%20memory%20dump%20using%20the%20command%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3EProcDump.exe%20-ma%20-e%20System.Data.SqlClient.SqlException%20LyncBackupService.exe%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUpon%20investigation%2C%20I%20finally%20found%20that%20the%20sproc%20%3CSTRONG%3E%20XdsQueryReplicaStatus%20%3C%2FSTRONG%3E%20was%20connecting%20to%20the%20Lync%20Back-end%20Server.%20Now%20that%20I%20know%20the%20issue%20was%20with%20SQL%2C%20it%20certainly%20seemed%20like%20a%20Permissions%20issue%2C%20and%20so%20I%20double-checked%20the%20permissions%20with%20permission%20in%20a%20working%20environment.%20But%20was%20unable%20to%20find%20anything%20within%20the%20permissions%20of%20the%20databases%20used%20by%20Skype%20for%20Business%20Server%202015.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFinally%2C%20I%20decided%20to%20check%20the%20permissions%20for%20System%20Databases%2C%20and%20found%20that%20in%20the%20failing%20scenario%2C%20GUEST%20login%20was%20removed%20from%20MSDB%20(system%20database).%26nbsp%3B%20So%20I%20decided%20to%20grant%20GUEST%20user%20the%20Connect%20permissions%20for%20MSDB%20database%20by%20running%3C%2FP%3E%0A%3CDIV%20id%3D%22scid%3AC89E2BDB-ADD3-4f7a-9810-1B7EACF446C1%3A3dbbdeae-1f4f-4b43-93c5-5c769c090ce3%22%20class%3D%22wlWriterEditableSmartContent%22%20style%3D%22margin%3A%200px%3B%20padding%3A%200px%3B%20float%3A%20none%3B%22%3E%0A%3CPRE%3E%3CBR%20%2F%3E%5Bsourcecode%20language%3D'sql'%20%20padlinenumbers%3D'true'%5D%3CBR%20%2F%3EUSE%20msdb%3B%3CBR%20%2F%3EGRANT%20connect%20to%20Guest%3B%3CBR%20%2F%3EGO%3CBR%20%2F%3E%5B%2Fsourcecode%5D%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3CP%3ENext%2C%20since%20this%20was%20an%20update%20to%20the%20System%20Database%2C%20we%20restarted%20the%20SQL%20Services%2C%20and%20the%20issue%20was%20resolved.%20%3C%2FP%3E%0A%3CP%3EResource%3A%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Fhelp%2F2539091%2Fyou-should-not-disable-the-guest-user-in-the-msdb-database-in-sql-server%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20You%20should%20not%20disable%20the%20guest%20user%20in%20the%20msdb%20database%20in%20SQL%20Server%20%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FA%3E%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Farchive%2Fblogs%2Fjenstr%2Fwhat-does-the-status-reported-by-get-csbackupservicestatus-mean%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%20What%20does%20the%20status%20reported%20by%20Get-CsBackupServiceStatus%20mean%3F%20%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-621174%22%20slang%3D%22en-US%22%3E%3CP%3EFirst%20published%20on%20TECHNET%20on%20May%2025%2C%202017%20Recently%2C%20I%20was%20working%20on%20a%20case%20with%20pool-pairing%20with%20a%20unique%20twist.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-621174%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Eevent%20id%204060%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Emsdb%20guest%20access%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ENextHop%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Exdsqueryreplicastatus%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

First published on TECHNET on May 25, 2017

Recently, I was working on a case with pool-pairing with a unique twist. The import status for Conferencing Module was working, but for User Module was failing . Upon looking further, I noticed EVENT ID 4060 with the following text

 

 


 

Log Name: Lync Server

Source: LS Backup Service

Date: 5/16/2017 11:25:48 AM

Event ID: 4060

Task Category: (4000)

Level: Error

Keywords: Classic

User: N/A

Computer: skype-pool1-FE2.contoso.com

Description:

Skype for Business Server 2015, Backup Service user store backup module failed to complete import operation.

 

Configurations:

Backup Module Identity:UserServices.PresenceFocus

Working Directory path:\\ contoso.com \SFBShare\1-BackupService-2\BackupStore\Temp

Local File Store Unc path:\\ contoso.com \SFBShare\1-BackupService-2\BackupStore

Remote File Store Unc path:\\ contoso.com \ SFBShare \2-BackupService-1\BackupStore

 

Additional Message:

Exception: Microsoft.Rtc.BackupService.ImportOperationException: Import operation (from zip archive ) is failed due to: Failed to execute stored procedure XdsQueryReplicaStatus. Native Error: 916, Exception: The server principal "CONTOSO\skype-pool1-FE2$" is not able to access the database "msdb" under the current security context. . Retriable: False. Cookie: . ---> System.Data.SqlClient.SqlException: The server principal "CONTOSO\skype-pool1-FE2$" is not able to access the database "msdb" under the current security context.

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)

at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)

at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)

at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)

at System.Data.SqlClient.SqlDataReader.TryNextResult(Boolean& more)

at System.Data.SqlClient.SqlDataReader.NextResult()

at Microsoft.Rtc.Common.Data.DBCore.ParseResults(SprocContext sprocContext, SqlDataReader sqlReader)

at Microsoft.Rtc.Common.Data.DBCore.Execute(SprocContext sprocContext, SqlConnection sqlConnection, SqlTransaction sqlTransaction)

--- End of inner exception stack trace ---

at Microsoft.Rtc.BackupService.BackupModules.XdsBackupModuleBase.QueryBackupStatus()

at Microsoft.Rtc.BackupService.BackupModules.UserStoreBackupModule.GetBackupCookie()

at Microsoft.Rtc.BackupService.BackupModuleHandler.ReceiveBackupDataTask.GetBackupCookie(Boolean& isModuleInitialized)

at Microsoft.Rtc.BackupService.BackupModuleHandler.ReceiveBackupDataTask.InternalExecute()

at Microsoft.Rtc.Common.TaskManager`1.ExecuteTask(Object state)

 

Cause: Either network or permission issues. Please look through the exception details for more information.

Resolution:

Resolution

 

 


 

So I decided to collect logs the built-in scenario HADR. The scenario HADR has the following components



    • BackupService

 

    • PowerShell

 

    • RtcDbSyncAgent

 

    • UserServices



Since the scenario included both BackupService and UserServices, I was optimistic that I would certainly nail-down the issue. However, the logs were not leading me to any solution. It was only providing the name of the sproc XdsQueryReplicaStatus . However, this sproc exists on the Front-End Server and the Back-End Servers, so I needed more information on which database to troubleshoot.

 

Next I decided to collect a memory dump using the command

 

ProcDump.exe -ma -e System.Data.SqlClient.SqlException LyncBackupService.exe

 

Upon investigation, I finally found that the sproc XdsQueryReplicaStatus was connecting to the Lync Back-end Server. Now that I know the issue was with SQL, it certainly seemed like a Permissions issue, and so I double-checked the permissions with permission in a working environment. But was unable to find anything within the permissions of the databases used by Skype for Business Server 2015.

 

Finally, I decided to check the permissions for System Databases, and found that in the failing scenario, GUEST login was removed from MSDB (system database).  So I decided to grant GUEST user the Connect permissions for MSDB database by running


[sourcecode language='sql' padlinenumbers='true']
USE msdb;
GRANT connect to Guest;
GO
[/sourcecode]

Next, since this was an update to the System Database, we restarted the SQL Services, and the issue was resolved.

Resource:

You should not disable the guest user in the msdb database in SQL Server

What does the status reported by Get-CsBackupServiceStatus mean?