New-SPConfigurationDatabase – system error 5 (Access is denied.)

This not something very fancy and the solution is actually very clear and something I should have understood right from the error message. But because it took me a while to figure it out and googling with error message didn’t give that much help, maybe this helps someone else also.

I was installing SharePoint 2010 in very typical three tiers environment. SQL Server was installed as it should be based on best practice recommendations. This means that log and data files were also separated to different drivers. SharePoint was also meant to be installed based on least privilege practices. I was using power shell script to make the SharePoint installation but the same error is given to you with wizard also.

So on the stage where Configuration database is created I get the following error

New-SPConfigurationDatabase : CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file ‘R:\Log\Config_log.ldf’. CREATE DATABASE failed. Some file names listed could not be created. Check related errors.

And now what?

I know that my setup account has all the necessary privileges to SQL Server. First I thought that my setup account should have access privileges to Log folder (where all the database log files are created) and I tried that with no help. After some googling, wondering and discussion with my colleague I figured it out.

The SQL server instance is driven with service account. Even though I’m using a setup account to operate in SQL server the actual creation of database is done with service account. I checked the SQL Server Services log on account with Sql Server Configuration Manager and gave this account read/write access to Log –folder.

And that solved the problem and the installation process was over quite quickly.