Skip to content

Commit 89bb479

Browse files
authored
Update SetupGuide_PowerShell.md (#848)
1 parent bdf7a5b commit 89bb479

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed

docs/SetupGuide_PowerShell.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
- [Array](#array)
2121
- [Single Row](#single-row)
2222
- [Trigger Binding](#trigger-binding)
23+
- [function.json Properties for Trigger Bindings](#functionjson-properties-for-trigger-bindings)
24+
- [Setup for Trigger Bindings](#setup-for-trigger-bindings)
2325

2426
## Setup Function Project
2527

@@ -216,4 +218,55 @@ See the [AddProduct](https://github.com/Azure/azure-functions-sql-extension/tree
216218

217219
## Trigger Binding
218220

219-
> Trigger binding support is only available for in-proc C# functions at present.
221+
See [Trigger Binding Overview](./BindingsOverview.md#trigger-binding) for general information about the Azure SQL Trigger binding.
222+
223+
### function.json Properties for Trigger Bindings
224+
225+
The following table explains the binding configuration properties that you set in the *function.json* file.
226+
227+
|function.json property | Description|
228+
|---------|----------------------|
229+
| **name** | Required. The name of the parameter that the trigger binds to. |
230+
| **type** | Required. Must be set to `sqlTrigger`.|
231+
| **direction** | Required. Must be set to `in`. |
232+
| **commandText** | Required. The name of the table being monitored by the trigger. |
233+
| **connectionStringSetting** | Required. The name of an app setting that contains the connection string for the database containing the table monitored for changes. This isn't the actual connection string and must instead resolve to an environment variable. Optional keywords in the connection string value are [available to refine SQL bindings connectivity](https://aka.ms/sqlbindings#sql-connection-string). |
234+
235+
### Setup for Trigger Bindings
236+
237+
Note: This tutorial requires that a SQL database is setup as shown in [Create a SQL Server](./GeneralSetup.md#create-a-sql-server).
238+
239+
- Create a new folder `EmployeeTrigger`
240+
- Inside `EmployeeTrigger` create a new file `function.json`
241+
242+
```json
243+
{
244+
"bindings": [
245+
{
246+
"name": "changes",
247+
"type": "sqlTrigger",
248+
"direction": "in",
249+
"tableName": "dbo.Employees",
250+
"connectionStringSetting": "SqlConnectionString"
251+
}
252+
],
253+
"disabled": false
254+
}
255+
```
256+
257+
- Inside `EmployeeTrigger` create a new file `run.ps1`
258+
259+
```powershell
260+
using namespace System.Net
261+
262+
param($changes)
263+
$changesJson = $changes | ConvertTo-Json -Compress
264+
Write-Host "SQL Changes: $changesJson"
265+
```
266+
267+
- *Skip these steps if you have not completed the output binding tutorial.*
268+
- Open your output binding file and modify some of the values. For example, change the value of Team column from 'Functions' to 'Azure SQL'.
269+
- Hit 'F5' to run your code. Click the link of the HTTP trigger from the output binding tutorial.
270+
- Update, insert, or delete rows in your SQL table while the function app is running and observe the function logs.
271+
- You should see the new log messages in the Visual Studio Code terminal containing the values of row-columns after the update operation.
272+
- Congratulations! You have successfully created your first SQL trigger binding!

0 commit comments

Comments
 (0)