none
Visual Studio 2017 - Database Project - Error - Unable to build with External Data Source, Database Scoped Credential, and Master Key RRS feed

  • Question

  • Hi,

    I have a database project which I schema compared with the original database. After building my database project in Visual Studio it gives a lot of errors.

    My findings:

    • All database objects are updated to my database project, except:
      - Database Scoped Credentials
      - Master Key
    • I have added those missing database objects, but keep on getting errors when building the project:
      - SQL80001: Incorrect syntax near 'Credential_AzureBlobStorage_MyName'.  Expecting '='
      - SQL80001: Incorrect syntax near 'IDENTITY'.  Expecting AW_CHANGE_TRACKING_CONTEXT, AW_ID, AW_XMLNAMESPACES, or QUOTED_ID
      - SQL71589: Master Key must be created before a database scoped credential
    • Target database: Microsoft Azure SQL Database V12 (tried also the previous ones, but this give many more errors)
    • Visual Studio 2017 version: 15.6.5

    Example code:

    CREATE EXTERNAL DATA SOURCE [DataSource_AzureBlobStorage_MyName]
        WITH (
        TYPE = BLOB_STORAGE,
        LOCATION = N'https://myblob.blob.core.windows.net',
        CREDENTIAL = [Credential_AzureBlobStorage_MyName]
        );


    CREATE DATABASE SCOPED CREDENTIAL Credential_AzureBlobStorage_MyName WITH IDENTITY = 'SHARED ACCESS SIGNATURE', SECRET = '';

    CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'MyPassword';

    Any ideas how to solve this issue?

    Kind regards,

    Johan Machielse

    Tuesday, August 28, 2018 9:33 AM

Answers

All replies

  • Hi,

    Solved the issues!

    I updated Visual Studio 2017 to 15.8.1 and the database project now builds successfully!

    Kind regards,

    Johan Machielse

    Tuesday, August 28, 2018 10:08 AM
  • Hi Johan,

    I'm glad to hear that you have resolved your issue. Please kindly mark your solution as answer. By doing so, it will benefit all community members who are facing similar issues. Your contribution is highly appreciated. 

    Thanks,
    Xi Jin.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Klaus Bilger Friday, March 15, 2019 1:26 PM
    Wednesday, August 29, 2018 1:21 AM
    Moderator
  • Hi Johan, Xi Jin,

    I am having exactly the same issues which Johan had namely the below ones, I have Visual Studio community edition, version 15.9.6.

    and I still see these errors, any idea whats going on here? 

    - SQL80001: Incorrect syntax near 'Credential_AzureBlobStorage_MyName'.  Expecting '='
    - SQL80001: Incorrect syntax near 'IDENTITY'.  Expecting AW_CHANGE_TRACKING_CONTEXT, AW_ID, AW_XMLNAMESPACES, or QUOTED_ID
    - SQL71589: Master Key must be created before a database scoped credential

    thanks for your help.

    Regards,

    Godfrey

    Friday, March 15, 2019 12:25 PM
  • Same issue here - VS 2017 Community Edition v15.8.7

    Azure SQL Database v12 targeted project.  I added to the project a Master Key item (right-click Add>New Item, scroll down under Security to find "Master Key").  I don't know if selecting that type matters, I do not see where VS decorates or classifies the script type anywhere.  I also tried added as a Script (build).  Also tried changing the script Build Action to "PreDeploy" but that did not fix the issue.

    SQL71589: Master Key must be created before a database scoped credential

    The error is coming from two other scripts in the SQL Database Project which create CREDENTIALS:

    CREATE DATABASE SCOPED CREDENTIAL [blobStorage]

    CREATE DATABASE SCOPED CREDENTIAL [SQL_Credential]


    Bill Blakey

    Tuesday, April 2, 2019 7:49 PM
  • I've got the latest version of VS 2019 and I'm seeing this issue. I opened the same db project in 2017 and it worked.
    Wednesday, May 15, 2019 8:05 PM