Cannot find the CREDENTIAL '<db_scoped_creds>', because it does not exist or you do not have permission

Waqas Hussain 126 Reputation points
2021-07-28T04:07:55.333+00:00

I created external tables using the steps specified here: https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/develop-storage-files-storage-access-control?tabs=shared-access-signature.

Within Synapse workspace, I am able to access external table data (as it uses my AD credentials). However, it doesn't work from an external platform, redash in this case. In order to access data from redash, I created a db user and this is where I think I am missing a step to somehow grant this user to access database scope credentials.

Steps, I took to create external table with required creds:

  1. Create database scope credentials to access data inside blob storage CREATE DATABASE SCOPED CREDENTIAL datalake_credentials
    WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
    SECRET = 'SAS TOKEN';
  2. Create external datasource using credential created in previous step CREATE EXTERNAL DATA SOURCE datalake_raw_marketing
    WITH ( LOCATION = 'https://mydatalake.blob.core.windows.net/raw/marketing'
    , CREDENTIAL= [datalake_credentials]
    );
  3. Finally create an external table using datasource CREATE EXTERNAL TABLE [dbo].[Customers]
    (
    [Id] varchar,
    [FirstName] varchar,
    [Email] varchar,
    [Date] varchar,
    [Group] varchar
    )
    WITH (DATA_SOURCE = [cashieslake_raw_marketing], LOCATION = N'sub_dir/customer_list_*.csv',FILE_FORMAT = [QuotedCsvWithHeaderFormat])
    GO

Using information on this page https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/develop-storage-files-storage-access-control?tabs=shared-access-signature I tried "Grant permissions to use credential" using:

GRANT REFERENCES ON CREDENTIAL::[datalake_credentials] TO [redash];  

But it always results in:

Cannot find the CREDENTIAL 'datalake_credentials', because it does not exist or you do not have permission.

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,378 questions
{count} votes

Accepted answer
  1. Waqas Hussain 126 Reputation points
    2021-07-30T03:23:35.333+00:00

    Yes, I meant Syanpse Studio and the sql command you suggested, I tried that and mentioned in my post that it didn't work.
    Anyway, anyone looking for the solution, it was to execute:

    GRANT REFERENCES ON DATABASE SCOPED CREDENTIAL::[{credential_name}] TO [{user}];
    

    ref: https://stackoverflow.com/questions/68554261/cannot-find-the-credential-db-scoped-creds-because-it-does-not-exist-or-you

    6 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.