3

I have a SQL table with a column which is using always encrypted. I am trying to setup CI / CD pipeline for a Visual Studio database project. I am unable to build the project because VS2017 is unable to recognize this particular column

[ColumnName] [varchar](max) COLLATE Latin1_General_BIN2 ENCRYPTED WITH (COLUMN_ENCRYPTION_KEY = [CEKKeyname], ENCRYPTION_TYPE = Deterministic, ALGORITHM = 'AEAD_AES_256_CBC_HMAC_SHA_256') NOT NULL

Below is the build error

Severity    Code    Description Project File    Line    Suppression State
Error       SQL71501: Column: [dbo].[mytable].[ColumnName] has an unresolved reference to Column Encryption Key [CEKKeyname].

I have tried the solutions mentioned here unresolved reference to object [INFORMATION_SCHEMA].[TABLES] and other similar solutions as well without any results.

I am using VS2017 enterprise, SSDT 15.1.61808 , Azure SQL Database

any pointers on how to fix this?

Bala P
  • 143
  • 1
  • 12
  • Could you please update SSDT https://learn.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-2017? Is VS2017 updated? – Alberto Morillo Oct 19 '18 at 02:01
  • @AlbertoMorillo - I did update the SSDT through visual studio as well as stand alone installer.Nothing seems to work – Bala P Oct 19 '18 at 02:34
  • Did you add column encryption (CEKKeyname) to the project? – Dmitrij Kultasev Oct 22 '18 at 16:01
  • @DmitrijKultasev - we did not try adding the keys to the project intentionally as we do not want to expose that information to all the Dev members. I would want to try this locally at somepoint and see if it helps overcome this error. Thanks again – Bala P Oct 23 '18 at 02:41
  • @user6163763 this is not the way how the SSDT works. All referenced objects must be in the project. You might want to create it via post/pre scripts or have some logic that would replace this key when deploying – Dmitrij Kultasev Oct 23 '18 at 11:11
  • @DmitrijKultasev - adding the keys to the project resolved the error and build was successful. Thanks again – Bala P Oct 23 '18 at 15:51

3 Answers3

1

The right solution for this problem would be to add the referenced items to the project as @DmitrijKultasev suggested above.

Bala P
  • 143
  • 1
  • 12
1

In my case, closing VS2017 and reopening the solution again solved the problem.

apio
  • 154
  • 11
0

I had the same issue via VisualStudio UI- I changed the table name in the UI but it didnt change the code. Right click the table- view code and change the table name

E. G.
  • 1
  • 1