Getting an Access Denied error when accessing a file in Azure Blob Storage

IAA Dashboard 0 Reputation points
2025-05-30T17:00:14.79+00:00

Files have been loaded into a blob container, and through PowerShell, that data has been loaded into the Azure SQL database successfully for over 2 years. As of last week, this process was functioning correctly.

Currently encountering an Access Denied error:

Error merging 2025-04-05 00:00:00: ('42000', '[42000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Cannot bulk load because the file "brandong2/docs-20250405 - US.json" could not be opened. Operating system error code 5(Access is denied.). (4861) (SQLExecDirectW)')

Despite checking permissions, nothing appears to have changed. Seeking options that may have been overlooked.

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Ovidiu Cif 0 Reputation points
    2025-05-30T20:38:55.6033333+00:00

    Hi @IAA Dashboard here are a few things that might be worth re-checking (sometimes the root cause isn’t immediately apparent):

    1. make sure the account running the SQL Server service has explicit read access to both the file and its parent directory. The permissions needed are for the SQL service account, not your personal account
    2. If you’re using a local or network path, verify that the file is accessible from the SQL Server machine and that the path hasn’t changed. If you're accessing an Azure Blob, ensure any SAS tokens, access keys, or managed identity permissions are still valid and haven't expired or been rotated
    3. if there have been any recent updates to OS, group policy, antivirus, or firewall rules that might be affecting access
    4. the file isn’t open or being used by another process, which can sometimes cause access errors
    5. Make sure the SQL login being used has the necessary bulk operations permissions
    6. If this is running against Azure SQL Database (not SQL Server in a VM), direct file system access isn’t supported—use external data sources and make sure your authentication method is still valid
    0 comments No comments

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.