I'm trying to create an external table on Synapse serverless pool to access a delta table on ADLS gen 2.
I first created an external source as shown here.
--Create a database scoped credential using SAS Token
CREATE DATABASE SCOPED CREDENTIAL datalakegen2
WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
SECRET = '<DataLakeGen2_SAS_Token>';
GO
CREATE EXTERNAL DATA SOURCE data_lake_gen2_dfs
WITH (
LOCATION = 'adls://<container>@<storage_account>.dfs.core.windows.net',
CREDENTIAL = datalakegen2
);
I then created the external table CREATE EXTERNAL TABLE [dbo].[table_ext] ( [Employeeid] BIGINT, [Name] VARCHAR(MAX), [Phone] VARCHAR(MAX), [Email] VARCHAR(MAX), [Zip] VARCHAR(MAX), [City] VARCHAR(MAX), [State] VARCHAR(MAX), [Country] VARCHAR(MAX), [Link] VARCHAR(MAX), [CreditCard] VARCHAR(MAX), [text100] VARCHAR(MAX), [license] VARCHAR(MAX), [ssn] VARCHAR(MAX), [uuid] VARCHAR(MAX) ) WITH ( LOCATION = '/database/table_ext/', DATA_SOURCE = data_lake_gen2_dfs, FILE_FORMAT = DeltaLakeFormat );
I'm able to access this table from within the Synapse workspace. However, when I try to access the table from SSMS using the Synapse workspace admin id and password, I get the below error.
Msg 16561, Level 16, State 1, Line 1
External table 'dbo.table_ext3' is not accessible because content of directory cannot be listed.
Completion time: 2025-01-23T10:51:49.8070604+08:00
Am I missing something in the setup process? Has it got something to do with the admin userid+password not having access to the ADLS gen 2 storage? And if yes, then how do I provide that access top a user id which is not present on Azure Entra Id?
Error:
Msg 16562, Level 16, State 1, Line 2 External table 'dbo.smplexttbl' is not accessible because location does not exist or it is used by another process.
Create a login in the master database of the Serverless SQL Pools service Directly grant permissions to the user. Additionally, create a database role to manage permissions and assign users to this role.
USE MASTER;
CREATE LOGIN [<YOUR ACTIVE DIRECTORY GROUP>] FROM EXTERNAL PROVIDER;
CREATE USER [Dilip] FROM LOGIN [synpdileep];
GRANT SELECT ON dbo.smplexttbl TO [Dilip];
GRANT REFERENCES ON DATABASE SCOPED CREDENTIAL::[credentialobject20] TO [Dilip];
Reference: User Permissions in Serverless SQL Pools: External Tables vs Views