Push the data out

Apply event-driven architectures to the database too

Davide Mauri
Microsoft Azure
2 min readNov 27, 2022

--

Azure SQL Database can push data to any other service

Event-Driven and reactive architectures (see the “Reactive Manifesto” if you’re new to the topic or interested to learn more about it) are extremely popular today. Events — and thus data — are pushed to services so that integration can happen faster and more efficiently.

With Azure SQL database it is possible to call a REST API using the stored procedure sp_invoke_external_rest_endpoint. It is available in any Azure SQL Database (so, no Azure SQL Managed Instance or SQL Server for now) and it as easy to use as you would expect:

declare @response nvarchar(max);

exec sp_invoke_external_rest_endpoint
@url = N'https://say-hello.azurewebsites.net/api/hello-message',
@response = @response output;

select * from openjson(@response);

Look at the documentation (and please do it! To prevent abuse of such a powerful feature we had to put some guardrails in place) here: sp_invoke_external_rest_endpoint (Transact-SQL) and unleash your creativity. The possibilities that this feature opens are almost infinite.

The feature is in Public Preview, which means that this is the perfect time to give us your feedback, if you think something can be improved or needs to be changed. Feel free to comment here below, if you have any questions or ideas you want to share.

In the meantime, happy coding! :)

--

--

Davide Mauri
Microsoft Azure

Data Geek, Storyteller, Developer at heart, now infiltrated in Azure SQL product group to make sure developers voice is heard loud and clear. Heavy Metal fan.