20212021. 3. 22. 11:04

SQL Server 클러스터를 설치할 때, SQL Server 서비스 계정을 입력한 후 다음 단계로 넘어가지 않고 Access Denied 오류가 발생할 수 있습니다. 

Slp: Sco.User.LookupADEntry - Attempting to find user account CONTOSO\sqladmin
Slp: Sco: Attempting to check if container 'WinNT://CONTOSO' of user account exists
Slp: Prompting user if they want to retry this action due to the following failure:
Slp: ----------------------------------------
Slp: The following is an exception stack listing the exceptions in outermost to innermost order
Slp: Inner exceptions are being indented
Slp:
Slp: Exception type: Microsoft.SqlServer.Configuration.Sco.ScoException
Slp: Message:
Slp: 액세스가 거부되었습니다.
Slp:
Slp: HResult : 0x84bb0001
Slp: FacilityCode : 1211 (4bb)
Slp: ErrorCode : 1 (0001)
Slp: Data:
Slp: WatsonData = Domain
Slp: DisableRetry = true
Slp: Inner exception type: System.UnauthorizedAccessException
Slp: Message:
Slp: 액세스가 거부되었습니다.
Slp:
Slp: HResult : 0x80070005
Slp: Stack:
Slp: 위치: System.DirectoryServices.Interop.UnsafeNativeMethods.IAdsContainer.GetObject(String className, String relativeName)
Slp: 위치: System.DirectoryServices.DirectoryEntries.Find(String name, String schemaClassName)
Slp: 위치: Microsoft.SqlServer.Configuration.Sco.User.LookupADEntry()


트러블슈팅을 위해 Netmon 로그를 수집하여 체크해 본 결과 DC로부터 SAMRPC 프로토콜이 차단되는 것을 확인할 수 있었습니다. 

NETMON 
System DC01 SQLDB1   SAMR   SAMR:SamrConnect5 Request, ServerName=\\DC01 DesiredAccess=1 InVersion=1  
System DC01 SQLDB1 MSRPC  MSRPC:c/o Fault:  Call=0x2  Context=0x1  Status=0x5  Cancels=0x0     
// RPC Access Denied 

GPO – 도메인 컨트롤러 보안 정책 – “네트워크 액세스: SAM에 대한 원격 호출을 수행할 수 있는 클라이언트 제한” 이 설정되어 있는 경우 허용되지 않은 사용자는 SAMRPC 포로토콜을 사용할 수 있는 권한이 거부됩니다. 즉, 원격 액세스를 허용하도록 SQL Server 클러스터 서비스 시작 계정이 아닌 멤버 서버에 로그인하여 SQL Server 클러스터 설치를 시도하는 사용자 로그인을 추가하여 DC에서 GPUPDATE 후 멤버 서버에서 SQL Server 설치를 시도하여 문제를 해결할 수 있습니다.

이 설치 단계의 과정은 Domain Controller 에 SQL Server 서비스 계정으로 사용할 사용자가 있는지 체크하는 단계입니다. 설치 테스트를 시도하지 않더라도 멤버 서버의 Command Prompt에서 net user /domain 명령으로 현재 로그인한 사용자가 SAMRPC 프로토콜 접근 권한이 있는지 간단히 체크할 수 있습니다.

이렇게 차단되는 원인이 해당 그룹 정책에 의해서 발생하는 것이 맞는지 검증이 필요하다면
RestrictRemoteSamAuditOnlyMode 레지스트리를 만들어서 1을 설정하면 그 즉시 적용되며 설정된 그룹 정책을 무시하고 모든 사용자의 설정된 SAMRPC 접근이 모두 허용됩니다. 다만 그룹 정책에 의해 접근이 허용하지 않는 사용자가 SAMRPC 접근을 요청한 경우 아래와 같이 시스템 이벤트 로그에 Event ID 16968 경고를 발생하지만 실제 접근은 차단하지 않기 때문에 운영 환경에 이 정책을 적용하기 앞서 어플리케이션 테스트를 할 때 유용하게 사용할 수 있습니다.

Registry Path: HKLM\SYSTEM\CurrentControlSet\Control\Lsa
Setting: RestrictRemoteSamAuditOnlyMode
Type: DWORD
Value: 1

Audit only mode configures the SAMRPC protocol to do the access check against the currently configured security descriptor but will not fail the call if the access check fails. Instead, the call will be allowed, but SAMRPC will log an event describing what would have happened if the feature had been enabled. This provides administrators a way to test their applications before enabling the policy in production. Audit only mode is not configured by default. To configure it, add the following registry setting.
https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/network-access-restrict-clients-allowed-to-make-remote-sam-calls


솔루션은 다르지만 근본 원인은 유사한 아래 케이스도 흥미롭습니다. 

SQL SERVER installation failed. “Access is denied” when validating SQL Service account password
techcommunity.microsoft.com/t5/sql-server-support/sql-server-installation-failed-access-is-denied-when-validating/ba-p/2091066



작성자: Lai Go / 작성일자: 2021.03.22

Posted by Lai Go