What is the best way to update a record in a table in Azure SQL during deployment?

Andrew Choi 21 Reputation points
2022-10-04T06:49:44.867+00:00

Originally, I have a set of scripts to insert data in local sql server for my application deployment. Currently, I would like to deploy my application in Azure and use Azure SQL database. How I can reuse the same script (assuming that it is Azure compatible) to bootstrap my application data in Azure SQL? In addition, if I want to update one of the records in a table after the bootstrapping, how I can do that programmatically (with or without Powershell script)?

Azure SQL Database
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 29,552 Reputation points Microsoft Employee Moderator
    2022-10-05T17:09:39.783+00:00

    Hi, @Andrew Choi Thanks for the ask and for using the Microsoft Q&A platform.
    There are many ways to do this, but the most streamlined ones will be in the context of whatever devops process you are following.

    If you are using DACPACs to deploy your schema, you can run a post-deployment script.
    On GitHub Actions, you can use the sql-action to run a SQL script post-deployment. Similar options exist for Azure DevOps as well.

    you can find a few Blog Posts below.

    •https://devblogs.microsoft.com/azure-sql/devops-for-azure-sql/

    •https://devblogs.microsoft.com/azure-sql/continuous-delivery-for-azure-sql-db-using-azure-devops-multi-stage-pipelines/

    •https://devblogs.microsoft.com/azure-sql/modern-development-creating-a-rest-api-via-ci-cd-and-back/

    Videos

    •https://www.youtube.com/watch?v=j7OnxOz7YDY Azure SQL DevOps - Data Exposed – part 1

    •https://www.youtube.com/watch?v=G7H6HbzwAfs Azure SQL DevOps - Data Exposed – part 2

    •https://www.youtube.com/watch?v=I6T9OA9YBGg SQL Projects in Azure Data Studio

    Code Samples

    •https://aka.ms/implement-azure-sql-devops

    I hope this information helps
    Regards
    Geetha


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.