CREATE PROCEDURE LoadData
AS
BEGIN
DELETE FROM [dbo].[File];
BULK INSERT [dbo].[File]
FROM 'File.csv'
WITH (
DATA_SOURCE = 'AzureBlob',
FORMAT = 'CSV',
FIRSTROW = 2
);
END
---------------------
CREATE EXTERNAL DATA SOURCE AzureBlob
WITH (
TYPE = BLOB_STORAGE,
LOCATION = 'https://marczakiocsvstorage.blob.core.windows.net/input',
CREDENTIAL = BlobCredential
);
-----------------------------
CREATE DATABASE SCOPED CREDENTIAL BlobCredential
WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
SECRET = 'sv=SAS_TOKEN_HERE';
Following this guide (https://marczak.io/posts/azure-loading-csv-to-sql/), I am attempting to load data from an Azure Blob into an Azure SQL table.
After creating the external data source and running the stored procedure I am getting the following error:
"Cannot bulk load because the file "File.csv" could not be opened. Operating system error code 5(Access is denied.)."
I made sure to double check my SAS Token and exclude the question mark when creating the credential. Also double checked the Contrainer URL. All seems okay. What could I be missing here preventing the blob from being read?
/
at last likehttps://marczakiocsvstorage.blob.core.windows.net/input/
– Jayendran