16

Is there a way to create a Azure Sql Database and then expose it as a rest API so you may call restful calls to CRUD tables with OData?

foluis
  • 988
  • 2
  • 10
  • 23
  • 3
    It would be good if exists some recent (2017) blog posting about how to Expose Azure SQL tables using OData, being consumed by Xamarin.Forms, WPF, or ASP.Net MVC – Tony Jan 20 '17 at 00:50
  • 2
    [Skyvia Connect](https://skyvia.com/connect/sql-azure-odata) easily and with no coding exposes SQL Azure data via OData REST API. In addition, it does not require any drivers or client libraries and offers useful features such as built-in security layer and detailed logging. –  Jan 31 '17 at 15:23
  • It is unfortunate that links in Microsoft's odata service are dead. Likely meaning this service is no longer being offered. The only solution is to write custom http/https apis. – Nouman Qaiser Feb 09 '21 at 17:10
  • is this problem still unresolved? – mas Apr 06 '21 at 05:43
  • This should be closed, if it is looking for a "How To" then there is extensive detail on how to setup OData in MS Docs, its pretty easy, but there is no difference between Azure Sql Db and any other database. Create a Web API project, add in your EF DbContext, then add your OData Service Implementation. There are 3rd party wizards but the code from first principals in minimal in ASP. Net Core. This is a good start: https://github.com/OData/AspNetCoreOData#:~:text=ASP.NET%20Core%20%28.NET%205%29%20OData%201%20Introduction.%20This,project%20in%20this%20repo.%20...%205%20Community.%20 – Chris Schaller Sep 02 '21 at 15:49

1 Answers1

0

You will have to break this down into two steps

  1. Create the Azure SQL DB

    Refer: https://learn.microsoft.com/en-us/azure/azure-sql/database/single-database-create-bicep-quickstart?view=azuresql&tabs=CLI

  2. Expose the SQL DB with OData

    Refer: https://learn.microsoft.com/en-us/odata/webapi-8/getting-started?tabs=net60%2Cvisual-studio-2022%2Cvisual-studio

You can automate it completely by combining these two into a Single Azure Bicep/ARM template which will create the DB, create an AppService plan to host the ASP.NET OData web app and deploy the code. You will also have to think about how you want to control user access.

Shinva
  • 1,899
  • 18
  • 25