Is it possible to run a sql script while creating database from ARM Template

Nishant Jain 1 Reputation point


We are trying to create a sql database in azure using Azure Resource Group from Tempate using visual studio. We want to run a sql script after the creation of database so that the tables are created in database at run time only. Is there any way avaiable ??

Any help would be appricated.


Azure DevTest Labs
Azure DevTest Labs
An Azure service that is used for provisioning development and test environments.
252 questions
Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
673 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anurag Sharma 17,536 Reputation points

    Hi @Nishant Jain , welcome to Microsoft Q&A forum.

    As I understand you want to deploy the schema of database at the time of server creation.

    We can do it with the help of importing bacpac files with ARM templates. Firstly we need to create the bacpac file and then use the url of it in ARM template. Please refer to below article that has the details related to it:

    Import SQL BACPAC files with ARM templates

    Please refer to completed template and let us know if you face any issue or have any other queries.

    0 comments No comments