This post has been republished via RSS; it originally appeared at: Azure Database Support Blog articles.
Today, I worked on a service request that our customer needs to know how to run a bulk insert for reading CSV file using Managed Identity credential. Following I would like to share with you how I configure this.
We have to configure two elements: Azure SQL Database and Storage Account.
- First of all, we need to have a blob storage of general-purpose v2 type.
- Using PowerShell, you need to register your Azure SQL server with Azure Active Directory, running the following commands:
- Under your storage account, navigate to Access Control (IAM), and select Add role assignment. Assign Storage Blob Data Contributor Azure role to the server hosting your Azure SQL Database which you've registered with Azure Active Directory (AAD) previously.
Azure SQL Database:
- Open SQL Server Management Studio and connect to the database.
- Open a new query and run the following commands.
- Create the database credential:
- Create the data source:
- Create the Dummy Table:
- Bulk Insert command:
It is possible that running bulk insert command you could get an Access denied issue, I saw that after adding the Identity and the RBAC of the storage account these operations take some minutos to be effective.