Skip to content

Commit 31fedf9

Browse files
committed
Update Demo Description
1 parent b1dd92c commit 31fedf9

2 files changed

Lines changed: 30 additions & 112 deletions

File tree

samples/features/security/ledger/sql-server/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ You also need to make sure the following software is installed on your machine:
5555
### Web Application
5656

5757
1. Open Visual Studio
58-
1. Open the folder [WorldCup](../WorldCup)
58+
1. Open the folder [WorldCup](../source/WorldCup/)
5959
1. Click on the file Program.cs in the Explorer and go to line 25
6060
1. Change the *Server* parameter in the connection string to the name of your SQL Server Instance.
6161
1. Save your modifications.
@@ -79,12 +79,12 @@ Perform the below steps before you show the demo.
7979

8080
1. Connect to the database
8181
1. Start the Azure Data Studio.
82-
1. Open the Notebook [Ledger - World Cup Demo - SQL Server 2022](../tsql-scripts/Ledger%20-%20World%20Cup%20Demo%20-%20SQL%20Server%202022.ipynb)
82+
1. Open the Notebook [Ledger - World Cup Demo - SQL Server 2022](../sql-server/tsql-scripts/Ledger%20-%20World%20Cup%20Demo%20-%20SQL%20Server%202022.ipynb)
8383
1. Attach the Notebook to the SQL Server Instance and WorldCup database you have created during the demo Setup.
8484

8585
1. Prepare a browser window .
8686
1. Open Visual Studio
87-
1. Open the folder [WorldCup](../WorldCup)
87+
1. Open the folder WorldCup](../source/WorldCup/)
8888
1. Go to the top menu and click *Terminal - New Terminal*
8989
1. In the terminal window type *dotnet run*. This will launch the web application.
9090
1. Open your browser and enter the following URL *http://localhost:3000*
@@ -96,22 +96,22 @@ Perform the below steps before you show the demo.
9696
1. Show the app and the database.
9797
1. Show the Contoso World Cup web app in the browser. Explain that this is a list of all the soccer games. Show that you are logged in as Pieter (the DBA of the company) and place a bet.
9898
![Place Bet](../../../../../media/features/ledger/Place-Bet.png)
99-
1. Once you have placed the bet, show that the user can download a cryptographic receipt that proves the bet. This receipt could also be used to verify the database afterwards but is not part of this demo.
99+
1. Once you have placed the bet, show that the user can download a cryptographic receipt that proves the bet. This receipt could also be used to verify the database afterwards but this is not part of the demo.
100100
![Download Cryptographic Receipt](../../../../../media/features/ledger/Download-Receipt.png)
101101
1. Go to the Notebook and show the 2 tables, Moneyline and bets in the Explorer. Explain that Moneyline table is an updatable ledger table and bets an append-only ledger table.
102102
![Ledger Tables](../../../../../media/features/ledger/Ledger-Tables.png)
103103
1. Run the `code cell 1` in the Notebook to show the games in the Moneyline table.
104104

105105
1. Show how ledger captures history information in the updatable ledger table
106106
1. Pieter has been asked to change the Home Country Odds for the game with ID 1. Run `code cell 2` in the Notebook to update the record.
107-
1. Run `code cell 3` in the Notebook to show the history of the updated record. Explain that updates are stored as 2 records. A delete of the old version and an insert of the new version of the row.
107+
1. Run `code cell 3` in the Notebook to show the history of the updated record. Explain that updates are stored as 2 records in the history table. A delete of the old version and an insert of the new version of the row.
108108

109109
1. Show how append-only ledger table works and how ledger helps investigate tampering by DBAs.
110-
1. Michael, who is an internal auditor, performs a routine review of changes in the Worldcup database. As his first step, Michael runs the ledger verification to be sure he can trust the data he’s going to examine. Run `code cell 4` to execute the verification stored procedure. The result should be "Success"!
110+
1. Michael, who is an internal auditor, performs a routine review of changes in the Worldcup database. As his first step, Michael runs the ledger verification to be sure he can trust the data he’s going to examine. Run `code cell 4` to execute the verification stored procedure. The result should be "Ledger verification succeeded."
111111
1. Pieter wants to maliciously increase his payout for the game he betted on. Run `code cell 5 and 6` to try to update the record. Explain that update on an append-only ledger table is blocked.
112112
1. Pieter thinks he's smart and tampers with the data directly into the data file by using a stored procedure. Do not run `code cell 7` because the stored procedure does not exists.
113-
1. Michael, reviews the Worldcup database again after the tournament is over. He noticed that the verification procedure failed. Observe the results of code cell 8 to see evidence of tampering in a database ledger. **DO NOT RUN** the cell just review the pre-run results to see tampering in action.
114-
1. Review the history of the transaction and show to the audience that you can verify which transactions cannot be trusted. **DO NOT RUN** the cell just review the pre-run results.
113+
1. Michael, reviews the Worldcup database again after the tournament is over. He noticed that the verification procedure failed. Observe the results of `code cell 8` to see evidence of tampering in a database ledger. **DO NOT RUN** the cell just review the pre-run results to see tampering in action.
114+
1. Review the history of the transaction and show to the audience that you can verify which transactions cannot be trusted. Observe the results of `code cell 9` but **DO NOT RUN** the cell just review the pre-run results.
115115

116116
## Key Takeaways
117117

samples/features/security/ledger/sql-server/tsql-scripts/Ledger - World Cup Demo - SQL Server 2022.ipynb

Lines changed: 22 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"azdata_cell_guid": "f75156e5-6996-4c40-9176-069f1b6ae1c0"
8282
},
8383
"outputs": [],
84-
"execution_count": 39
84+
"execution_count": null
8585
},
8686
{
8787
"cell_type": "code",
@@ -108,7 +108,7 @@
108108
"azdata_cell_guid": "4ae7db74-7c44-4c83-b667-adfa1b77a8f3"
109109
},
110110
"outputs": [],
111-
"execution_count": 40
111+
"execution_count": null
112112
},
113113
{
114114
"cell_type": "markdown",
@@ -193,85 +193,8 @@
193193
"tags": [],
194194
"language": "sql"
195195
},
196-
"outputs": [
197-
{
198-
"output_type": "display_data",
199-
"data": {
200-
"text/html": "Commands completed successfully."
201-
},
202-
"metadata": {}
203-
},
204-
{
205-
"output_type": "display_data",
206-
"data": {
207-
"text/html": "(1 row affected)"
208-
},
209-
"metadata": {}
210-
},
211-
{
212-
"output_type": "display_data",
213-
"data": {
214-
"text/html": "Total execution time: 00:00:00.144"
215-
},
216-
"metadata": {}
217-
},
218-
{
219-
"output_type": "execute_result",
220-
"metadata": {},
221-
"execution_count": 1,
222-
"data": {
223-
"application/vnd.dataresource+json": {
224-
"schema": {
225-
"fields": [
226-
{
227-
"name": "BetID"
228-
},
229-
{
230-
"name": "MoneylineID"
231-
},
232-
{
233-
"name": "FirstName"
234-
},
235-
{
236-
"name": "LastName"
237-
},
238-
{
239-
"name": "Country"
240-
},
241-
{
242-
"name": "Bet"
243-
},
244-
{
245-
"name": "Payout"
246-
},
247-
{
248-
"name": "BetDateTime"
249-
}
250-
]
251-
},
252-
"data": [
253-
{
254-
"0": "6",
255-
"1": "12",
256-
"2": "Pieter",
257-
"3": "Vanhove",
258-
"4": "Belgium",
259-
"5": "300.00",
260-
"6": "-1400.00",
261-
"7": "2022-12-01 13:21:28.5000000"
262-
}
263-
]
264-
},
265-
"text/html": [
266-
"<table>",
267-
"<tr><th>BetID</th><th>MoneylineID</th><th>FirstName</th><th>LastName</th><th>Country</th><th>Bet</th><th>Payout</th><th>BetDateTime</th></tr>",
268-
"<tr><td>6</td><td>12</td><td>Pieter</td><td>Vanhove</td><td>Belgium</td><td>300.00</td><td>-1400.00</td><td>2022-12-01 13:21:28.5000000</td></tr>",
269-
"</table>"
270-
]
271-
}
272-
}
273-
],
274-
"execution_count": 1
196+
"outputs": [],
197+
"execution_count": null
275198
},
276199
{
277200
"cell_type": "code",
@@ -362,7 +285,7 @@
362285
"outputs": [
363286
{
364287
"output_type": "error",
365-
"evalue": "Msg 37371, Level 16, State 1, Procedure sys.sp_verify_database_ledger_from_digest_storage, Line 1\r\nThe computed hash from 'Bets' and the associated history table does not match the hash persisted in sys.database_ledger_transactions for transaction 1466.",
288+
"evalue": "Msg 37371, Level 16, State 1, Procedure sys.sp_verify_database_ledger_from_digest_storage, Line 1\r\nThe computed hash from 'Bets' and the associated history table does not match the hash persisted in sys.database_ledger_transactions for transaction 1004.",
366289
"ename": "",
367290
"traceback": []
368291
},
@@ -375,12 +298,12 @@
375298
{
376299
"output_type": "display_data",
377300
"data": {
378-
"text/html": "Total execution time: 00:00:00.474"
301+
"text/html": "Total execution time: 00:00:00.585"
379302
},
380303
"metadata": {}
381304
}
382305
],
383-
"execution_count": 4
306+
"execution_count": 3
384307
},
385308
{
386309
"cell_type": "markdown",
@@ -397,7 +320,6 @@
397320
"source": [
398321
"SELECT\r\n",
399322
" t.[commit_time] AS [CommitTime] \r\n",
400-
"\t, t.[principal_name] AS [UserName]\r\n",
401323
" ,l.[MoneylineID]\r\n",
402324
" ,l.[FirstName]\r\n",
403325
" ,l.[LastName]\r\n",
@@ -409,7 +331,7 @@
409331
"\tFROM [dbo].[Bets_Ledger] l\r\n",
410332
"\tJOIN [sys].[database_ledger_transactions] t\r\n",
411333
"\tON t.[transaction_id] = l.[ledger_transaction_id]\r\n",
412-
"\tWHERE t.transaction_id=1466;"
334+
"\tWHERE t.transaction_id=1004;"
413335
],
414336
"metadata": {
415337
"azdata_cell_guid": "d3bf1ca4-c66f-4ba8-a863-0811e120de51",
@@ -426,24 +348,21 @@
426348
{
427349
"output_type": "display_data",
428350
"data": {
429-
"text/html": "Total execution time: 00:00:00.033"
351+
"text/html": "Total execution time: 00:00:00.042"
430352
},
431353
"metadata": {}
432354
},
433355
{
434356
"output_type": "execute_result",
435357
"metadata": {},
436-
"execution_count": 5,
358+
"execution_count": 4,
437359
"data": {
438360
"application/vnd.dataresource+json": {
439361
"schema": {
440362
"fields": [
441363
{
442364
"name": "CommitTime"
443365
},
444-
{
445-
"name": "UserName"
446-
},
447366
{
448367
"name": "MoneylineID"
449368
},
@@ -472,29 +391,28 @@
472391
},
473392
"data": [
474393
{
475-
"0": "2022-12-01 13:21:28.5033333",
476-
"1": "EUROPE\\pivanho",
477-
"2": "12",
478-
"3": "Pieter",
479-
"4": "Vanhove",
480-
"5": "Belgium",
481-
"6": "300.00",
482-
"7": "-10000.00",
483-
"8": "2022-12-01 13:21:28.5000000",
484-
"9": "INSERT"
394+
"0": "2022-12-01 16:21:50.7400000",
395+
"1": "12",
396+
"2": "Pieter",
397+
"3": "Vanhove",
398+
"4": "Belgium",
399+
"5": "300.00",
400+
"6": "-10000.00",
401+
"7": "2022-12-01 16:21:50.7400000",
402+
"8": "INSERT"
485403
}
486404
]
487405
},
488406
"text/html": [
489407
"<table>",
490-
"<tr><th>CommitTime</th><th>UserName</th><th>MoneylineID</th><th>FirstName</th><th>LastName</th><th>Country</th><th>Bet</th><th>Payout</th><th>BetDateTime</th><th>Operation</th></tr>",
491-
"<tr><td>2022-12-01 13:21:28.5033333</td><td>EUROPE\\pivanho</td><td>12</td><td>Pieter</td><td>Vanhove</td><td>Belgium</td><td>300.00</td><td>-10000.00</td><td>2022-12-01 13:21:28.5000000</td><td>INSERT</td></tr>",
408+
"<tr><th>CommitTime</th><th>MoneylineID</th><th>FirstName</th><th>LastName</th><th>Country</th><th>Bet</th><th>Payout</th><th>BetDateTime</th><th>Operation</th></tr>",
409+
"<tr><td>2022-12-01 16:21:50.7400000</td><td>12</td><td>Pieter</td><td>Vanhove</td><td>Belgium</td><td>300.00</td><td>-10000.00</td><td>2022-12-01 16:21:50.7400000</td><td>INSERT</td></tr>",
492410
"</table>"
493411
]
494412
}
495413
}
496414
],
497-
"execution_count": 5
415+
"execution_count": 4
498416
}
499417
]
500418
}

0 commit comments

Comments
 (0)