Azure SQL Database (single database and Managed Instance) enables you to load files from Azure Blob Storage. If you experience issues while you are loading files from Azure blob storage, below are some suggestions on steps you can take to troubleshoot and mitigate the issue.
If you are noticing that a syntax error is returned by BULK INSERT orBULK INSERT check that you are usingsupported syntax in this statement. As an example, if you are trying to load data via network share path note that this option is not supported in Managed Instance.
If you are getting an error 5 (Access Denied), make sure that you have not denied access to your Azure Blob Storage account using the firewall:
Verify that you have created the EXTERNAL DATA SOURCE with type BLOB_STORAGE targeting the URL of the blob storage where you placed the files that should be restored to your database.
Make sure that you are targeting an existing file on Azure blob storage.
Script theCREDENTIALto SQL Server 2017 and try to load the files. If you are troubleshooting the issue on Managed Instance make sure that SQL Server is in the subnet that is within the same VNet as the Managed Instance.
Check if your SAS credential placed in theSECREToption of theCREATE DATABASE SCOPED CREDENTIALstatement valid. The most common errors inSAS token parametersare:
?is not removed from the beginning of the SAS token because the Azure portal generates SAS token with the leading?. Remove this character if you see it.
se(expiry date) property is set to some value in the past (note that this is UTC time).
st(start date) property is not in the past (note that this is UTC time).
sp(permission) property should allow reading the file on the storage account.
sip(ip range) remove this parameter if it is present in SAS token.