CRUD operations on Provider Hosted SharePoint Add-In to Azure SQL Database

Hi All,

This post is about connecting a SharePoint provider hosted add-in deployed on Azure to a Azure SQL DB for performing basic CRUD operations.


  • Microsoft Azure account.
  • Office 365 account
  • Visual Studio 2015/2017 with SharePoint extensions.
  • A empty provider hosted add-in with ACS mode created and deployed on an Azure web app.


  • Create Azure SQL DB:
    • Within Azure portal, click New –> Databases –> SQL Database
    • Enter SQL server details.



  • Update DB server firewall to allow client IP access to the DB
    • Go to list of DBs in Azure, select the current DB – Select ‘Set server firewall’
    • Hit ‘Add client IP’ and then hit Save button.



  • Modify Provider hosted add-in to create model ¬†from newly created DB:
    • Within project, go to Project –> Models –> Right click add new item. Select ADO.NET Entity data model from Data tab.
    • Select EF Designer from Database option to choose model contents
    • Provide correct Azure connection details to establish the correct connection with newly created Azure SQL DB.
  • Modify Provider hosted add-in to create controller from newly created DB:
    • Within project, go to Project –> Controllers –> Right click add controller 


  • Next add link in the layouts page for user to click from the application.


Next when running the SharePoint App, and clicking Customers link, you should be able to see all the data on the screen as shown below: