When performing a schema compare having db_owner rights on the target database results in the following error:
The user does not have permission to perform this action.
Using the SQL Server Profiler I figured out this error occurs executing a query targeting the master db view: [sys].[dm_database_encryption_keys]
While specifically ignoring all object types but Tables one would presume the SQL Compare doesn't need access to the db encryption keys. Also note:
http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/c11a5f8a-b9cc-454f-ba77-e1c69141d64b/
One solution would be to GRANT VIEW SERVER STATE to the db user, but in my case I'm not hosting the database services and won't get the rights to the server state.
Also tried excluding DatabaseEncryptionKey element in the compare file.
<PropertyElementName>
<Name>Microsoft.Data.Schema.Sql.SchemaModel.SqlServer.ISql100DatabaseEncryptionKey</Name>
<Value>ExcludedType</Value>
</PropertyElementName>
Anyone has an workaround this?
We're using MS Data Tools compare to publish from a Database project into a DTAP environment.