Skip to content

Azure-Samples/sql-bindings-guestbook

Repository files navigation

page_type languages products description urlFragment
sample
tsql
sql
csharp
javascript
powershell
azure
azure-sql-database
dotnet
azure-functions
azure-static-web-apps
Geocoding sample for Azure SQL DB with Azure Functions
azure-sql-functions-geocode

SQL bindings guestbook demo

License

A sample web application where users can leave a message and view recent messages. After entry, messages are send to content moderation. Watch a walkthrough of this sample at https://www.youtube.com/watch?v=01nhp4OAk0c.

guestbook screenshot

Components

  • Azure SQL Database
  • .NET Azure Functions
    • SQL trigger
    • SQL output binding
  • JavaScript Azure Functions
    • SQL output binding
    • SQL input binding
  • PowerShell Azure Functions
    • SQL input binding
  • Azure Static Web App
  • Azure Content Moderation

Contents

File/folder Description
.github/workflows GitHub Actions workflows for the sample to deploy the Functions, the Azure Static Web App, and the SQL project.
apis/js-api JavaScript Azure Functions that serve the Azure Static Web App data.
apis/net-api .NET Azure Function that moderates new guestbook entries.
apis/powershell-api PowerShell Azure Function that runs a stored procedure to check the health of change tracking.
guestbook Azure Static Web App that serves the guestbook UI through a React app.
sql SQL project that contains the database objects (tables, stored procedures).

Architecture

Data Exposed episode

  • JavaScript Azure Functions
    • lists some entries from the app.Entry table (SQL input binding)
    • add guestbook entry for to app.Entry table (SQL output binding)
  • Azure Static Web App
    • input form for adding guestbook entries
    • list of guestbook entries
    • calls to the JavaScript Azure Functions
  • .NET Azure Function
    • SQL trigger on changes in app.Entry table
    • sends newly inserted rows to Azure Content Moderation
    • SQL output binding writes moderation results to app.Moderation table
    • SQL output binding updates to app.Entry table
  • PowerShell Azure Function
    • timer trigger runs the PowerShell functoion on a schedule
    • SQL input binding runs a stored procedure checking the health of change tracking

architecture diagram

What are SQL bindings?

summary slide on SQL bindings

Learn more at https://aka.ms/sqlbindings.

  • Azure Functions can authenticate to Azure SQL Database with Azure AD Managed Identity
  • Configure SQL bindings with a connection string and T-SQL query, stored procedure name, or table name
  • SQL bindings are currently in preview for .NET, JavaScript, Python, PowerShell, and Java Azure Functions
  • SQL trigger is currently in preview for .NET Azure Functions

Getting started with the guestbook sample

Instructions are available for setup of local development of this sample in GETTING_STARTED.md.

About

Azure Static Web Apps demo with Azure SQL bindings for Azure Functions (aka.ms/passguestbook)

Resources

License

Code of conduct

Stars

Watchers

Forks