SQL Clone is amazing, and it can really save time and disk space for many organizations. I’ve got a series posted here on various little things I’ve learned about the product. There are also a number of articles on the Redgate Community Hub.
I was working on helping a customer install the SQL Clone server recently and one of the things that the client wanted to know was what are the minimum permissions needed for the SQL Clone Server.
When you install the SQL Clone server, the configuration dialog asks you for a Windows account and password. This is noted in the documentation as the account that configures and starts the server.
This means that during the configuration, this account will:
- Create a local service on the Clone Server OS
- Connect to the SQL Server specified
- Create a new database (or use the one that exists)
- Map itself to dbo in the new database
If the SQL Server can be a remote SQL Server from the SQL Clone server, a domain account is needed. If this is a local SQL Server, then you can use a local account. The account does need to have local administrator privileges.
With that in mind, here’s what I did as a minimum permission set:
- Create a new domain account, SQLCloneServer (I want to be able to use a remote SQL Server. I left this as just a member of Domain Users.
- Add this account as a local administrator on the SQL Clone server host.
- Add this AD user as a login to the SQL Server that will host the configuration databse
- Give the SQL user the dbcreator role (you can remove this later and leave them with permissions inside the db)
It’s always better to script. Here’s the AD part in PowerShell:
New-ADUser -Name “SQL Clone Server” -GivenName “SQL” -Surname “Clone Server” -SamAccountName “SQLCloneServer” -UserPrincipalName SQLCloneServer@mydomain.com
Here’s the local SQL Clone, web server permissions part, using local commands. This could be in PoSh, but it’s not as clean (to me).
net localgroup Administrators "MyDomain\SQLCloneServer" /add
Here’s the SQL Part
USE [master] GO CREATE LOGIN [MYDOMAIN\MySQLCloneUser] FROM WINDOWS WITH DEFAULT_DATABASE=[master] GO ALTER SERVER ROLE [dbcreator] ADD MEMBER [MYDOMAIN\MySQLCloneUser] GO