Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission Issue on Bulk Insert in Azure SQL Server

User is getting below error while running bulk insert command in Azure SQL Server. I am using Azure SQL Server and not SQL Sever. Most of the commands related to Bulk Insert grant permission is not working in Azure SQL Server.

Error

You do not have permission to use the bulk load statement.

Commands Tried in Azure SQL Server to Add User

EXEC sp_addrolemember 'db_ddladmin', 'testuser'; 

ALTER SERVER ROLE [bulkadmin] ADD MEMBER testuser

GRANT ADMINISTER BULK OPERATIONS TO testuser

Error

Msg 40520, Level 16, State 1, Line 5
Securable class 'server' not supported in this version of SQL Server.

Your help is highly appreciated.

like image 835
Jo......... Avatar asked Dec 06 '22 10:12

Jo.........


2 Answers

In Azure SQL Database, grant ADMINISTER DATABASE BULK OPERATIONS to the principal in the context of the desire database:

GRANT ADMINISTER DATABASE BULK OPERATIONS TO testuser;

The user will also need INSERT permissions on the target table. These Azure SQL Database permissions are detailed in the BULK INSERT documentation under the permissions section.

like image 189
Dan Guzman Avatar answered Jan 11 '23 14:01

Dan Guzman


On Azure it works on tables in the database in question only. It does not work on temp tables. So if you are bulk loading in parallel and want to use temp tables, you are in a corner.

like image 24
Scott Mummert Avatar answered Jan 11 '23 13:01

Scott Mummert