Here is what I'm currently trying to do -
1.Create a new instance of a timer job from a web part
2.Add a new site collection to the current web application again from a web part
Each time the code in question fails with the following SQL error message:
Insufficient SQL database permissions for user '' in database 'MOSS_Config' on SQL Server instance 'MYVM'. Additional error information from SQL Server is included below. The EXECUTE permission was denied on the object 'proc_putObject', database 'MOSS_Config', schema 'dbo'.
I have tried every form of impersonation I can think of within the code and yes I have instantiated my SPSite/SPWeb objects within the elevated code -
- Running as SHAREPOINT\System User
- Token Using .NET Impersonation
Each time it still fails with the same error. I have used SQL Profiler and each time the code executes it is always trying to run under the Application Pool account - therefore it fails as of course the app pool account does not have sufficient privileges on the config database.
All my research has led me to only one answer - making the application pool account a member of the Farm Admin group (http://www.hezser.de/blog/archive/2008/05/20/using-the-propertybag.aspx)
Is this really the only solution? and more importantly is a supported modification? as I would guess it violates best practices?