question

alexandrehtrb avatar image
0 Votes"
alexandrehtrb asked RaghunandanVenkateswaran-2026 answered

SQL Server BULK INSERT does not work with Azure Blob Storage emulator (Azurite)

Hello,

I am trying to perform a bulk insert in my SQL Server database, following the documentation here: https://docs.microsoft.com/en-us/sql/t-sql/statements/bulk-insert-transact-sql?redirectedfrom=MSDN&view=sql-server-ver15#f-importing-data-from-a-file-in-azure-blob-storage

I am testing it locally, using SSMS v18.4, SQL Server 2019 Developer Edition (Windows 10 Pro x64) and an Azure Storage Emulator (Azurite). When I try to run the bulk insert command, I get the error:

"Referenced external data source "MyAzureBlobStorage" not found."

Even though I successfully created that data source.

The blob storage emulator logs do not indicate any connection attempts when the command runs, although I can connect to emulator using a browser and it appears on the logs.

I wonder if this bug is related to the one reported here: https://feedback.azure.com/forums/217321-sql-database/suggestions/35725408-azure-sql-db-bulk-insert-to-support-blob-store-whe

The blob storage emulator is listening on: https://127.0.0.1:27161 (the default port is 10000, changing ports or using HTTP did not solve the problem)

azure-sql-databaseazure-storage-accountsazure-blob-storage
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

shivapatpi-MSFT avatar image
0 Votes"
shivapatpi-MSFT answered shivapatpi-MSFT edited

Hello @alexandrehtrb ,
Thanks for your query . I was able to repro your issue locally in my SQL Server Management Studio Express.
But after following the steps mentioned here:
https://github.com/microsoft/sql-server-samples/blob/master/samples/features/sql-bulk-load/load-from-azure-blob-storage/LoadFromAzureBlobStorage.sql

ref: https://stackoverflow.com/questions/43813493/load-csv-from-blob-to-azure-sql-server-referenced-external-data-source-not-fou


Data got inserted successfully.


Please note: my test blob had public access so I just skipped the previous 2 steps:

Overall script used:

CREATE EXTERNAL DATA SOURCE MyAzureBlobStorage
WITH ( TYPE = BLOB_STORAGE,
LOCATION = 'https://storageaccoutname.blob.core.windows.net/test'
);
BULK INSERT test
FROM 'test.csv'
WITH (DATA_SOURCE = 'MyAzureBlobStorage',FIELDTERMINATOR=',',DATAFILETYPE='char',FIRSTROW=2,ROWTERMINATOR='0x0a', TABLOCK);


When I got the same error: "Referenced external data source "MyAzureBlobStorage" not found."
I just created a new data source (eg myazureblobstorage1 and provided that name in the second BULK command)


Couple of things to note:
1) Try creating the external data source , wait for couple of mins before running the BULK Insert
2) If the CSV file is not formatted properly , you might run into other issues
3) Take a note of additional parameters in the BULK Insert command
4) When I got the error "Cannot obtain the required interface ("IID_IColumnsInfo") from OLE DB provider "BULK" for linked server "(null)" , I just added additional parameters in BULK INSERT Command.
5) Table column names must match with that of CSV file


FYI - Also the the bug mentioned by you not related to this particular issue.

Let me know if you have additional questions. If the above steps works for you - Make sure to "Accept Answer" , so that it helps for the community out there



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

alexandrehtrb avatar image
0 Votes"
alexandrehtrb answered alexandrehtrb commented

Hello @shivapatpi-MSFT ,

Thank you for your response, but it did not work for me...

I got the error: Bad or inaccessible location specified in external data source "MyAzureBlobStorage".

I am using Azurite emulator and placed the product.csv file in a "testcontainer" there.

To create the data source, the SQL command was:

 CREATE EXTERNAL DATA SOURCE MyAzureBlobStorage
 WITH ( TYPE = BLOB_STORAGE,
 LOCATION = 'http://127.0.0.1:10000/devstoreaccount1/testcontainer');
 GO

The Product table and bulk insert command were copied from the GitHub sample: LoadFromAzureBlobStorage.sql

Did it work for you using an emulator?


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @alexandrehtrb ,
I tried using direct container URL which is stored in a storage account. I will try out using the emulator and let you know.

Regards,
Shiva.

1 Vote 1 ·

Hello @shivapatpi-MSFT ,

I am sending you the script and test files I used for my local test; also, I am including a SQL Server Profiler error report (XML file).65444-bulk-blob-error-sql-trace-report.xml65412-bulktest.txt65463-format.xml65481-bulkinsertblobtestsql.txt


0 Votes 0 ·
DenisRobert-0371 avatar image
0 Votes"
DenisRobert-0371 answered

As usual, Microsoft just abandons issues it doesn't want to resolve. No activity since Feb on this?
Seems like Azurite is nothing but a trap that Microsoft uses to force you to use the Azure version, even when you're doing local development. No software they produce seems to actually support it. You think for two seconds it might work, then you spend hours down a useless rabbit hole until you give up and use an Azure Storage account so you can move forward with your project, dooming you to have to be connected to Azure at all times.

What a piece of junk.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RaghunandanVenkateswaran-2026 avatar image
0 Votes"
RaghunandanVenkateswaran-2026 answered

Does this fix work with a non public access container / storage

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.