Search code examples
azure-devopsazure-sql-databaseazure-pipelinesazure-pipelines-yamlazure-git-deployment

Stored procedure is not deployed to Azure SQL server after running the pipeline


I am new to Azure DevOps.

I have created a stored procedure and after merging the changes with the repository.

I ran the pipeline but that stored procedure is not reflected in the database.

Other functions and tables were deployed successfully, only stored procedures are not deployed.

Can anyone help me with this?

Thanks in advance!


Solution

  • The most likely issue is your project file. When adding new objects to a database project, the scripts must also be configured in the project file with the Build Action set to Build.

    • Open the project in Visual Studio and ensure the stored procedure shows up in the Solution Explorer. If not, add it to the Stored Procedures folder with Add > Existing Item.
    • View the properties of the stored procedure and ensure the Build Action is set to Build.
    • Save and commit the changes to the project file. When adding a new object, you have to commit the new object and the changes to the project file or the new object will not be included in your build.

    One other item to check would be the configuration of your Release in DevOps. Review the Additional SqlPackage.exe Arguments and ensure there is nothing there that would cause Stored Procedures to be skipped.