Microsoft SSDT (10.3.21208.0)/Data-tier Project (MSVS 2010) and "Sharing"/Copied Certificates between the Project and Referenced Database Project

StackOverflow https://stackoverflow.com/questions/16466920

Question

I am writing a "framework" of SQL Server (targeting 2008R2 and 2012) stored procedures and common/reference tables. Each SSDT/Date-tier project represents a different component (can be within the same database) within this framework (e.g., MasterDBExtensions project has stored procedure extensions/add ons within the Master Database, SQLServerAgentExtensions (msdb), etc).

I developed a farily strict security model heavily based on Schema, database roles, and certificates.

My issue is how do I "share"/copied these certificates between the active project and the referenced projects so that when I publish the active project to SQL Server the certificates are properly copied, etc. (btw I need to share/copy the certificates for cross-database object access so that I do not need to turn the Trustworthy flag on, Service Broker, and also for linked server access).

Just for clarification I have some TSQL Code that represents what I mean:

use [DatabaseA]
Create Certificate [MyCertFromA] ...
Backup Certificate [MyCertFromA] to File = 'MyCertFromA.cert'

use [DatabaseB]
Create Certificate [MyCertFromA] from File = 'MyCertFromA.cert'

SSDT/Data-tier will NOT allow me to place the Backup and Create/From statement (I get the "This statement is not recognized in this context"). If I move the Backup Certificate to a Pre/Post Script I run into issues with file permisions and other issues (e.g., Certificate NOT found). Besides the Pre/Post scripts do not run if I use the project as a database reference in other projects.

So... What am I doing wrong or does anyone have any suggests around these issues?

Thanks!

Enviroment: SQL Server 2012 (I also target SQL Server 2008R2), MSVS 2010, SqlServer Data Tools Dec. 2012, SQL Sever Data-Tier Application Framework May 2013, C# 4.0

Was it helpful?

Solution

Looks like this has been answered somewhat by CTP4 Certficate issue - sometimes server, sometimes database scoped

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top