You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Instructions/Labs/02-implement-programmability-objects.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,7 +141,7 @@ Encapsulate a business operation that adds an order line item to an existing ord
141
141
END;
142
142
```
143
143
144
-
This stored procedure performs a transactional insert of a new line item. It first validates that the product and order exist—rolling back and throwing an error if either is invalid. After inserting the detail row with the product's list price, it recalculates the order's subtotal from all line items and updates the header. Wrapping everything in a transaction ensures the operation is atomic: either all changes succeed or none are applied.
144
+
This stored procedure performs a transactional insert of a new line item. It first validates that the product and order exist--rolling back and throwing an error if either is invalid. After inserting the detail row with the product's list price, it recalculates the order's subtotal from all line items and updates the header. Wrapping everything in a transaction ensures the operation is atomic: either all changes succeed or none are applied.
145
145
146
146
1. Execute the following T-SQL code to test the stored procedure.
Copy file name to clipboardExpand all lines: Instructions/Labs/06-optimize-database-performance.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,9 +49,9 @@ First, create an Azure SQL Database with sample data.
49
49
|**Database name**|*AdventureWorksLT*|
50
50
|**Server**| Select **Create new** and create a new server with a unique name. Select your **Location**. For authentication, select one of the following options and then select **OK**: |
51
51
52
-
> 📝**Authentication is not optional**— you must choose the method that matches your organization's security policies. Each option affects how you connect to the database later:
52
+
> 📝**Authentication is not optional.**You must choose the method that matches your organization's security policies. Each option affects how you connect to the database later:
53
53
> -**Use Microsoft Entra-only authentication***(recommended)*: Select this if your organization requires Entra-based access. Set your Azure account as the **Microsoft Entra admin**. You connect to the database using your Microsoft Entra account (for example, in SSMS select *Authentication* = **Microsoft Entra MFA**).
54
-
> -**Use both SQL and Microsoft Entra authentication/SQL authentication**: Select this if you prefer a SQL admin login or your organization allows both methods. Provide a **Server admin login** and **Password** — you need these credentials to connect. You can also set a **Microsoft Entra admin** to enable Entra logins alongside SQL auth.
54
+
> -**Use both SQL and Microsoft Entra authentication/SQL authentication**: Select this if you prefer a SQL admin login or your organization allows both methods. Provide a **Server admin login** and **Password**. You need these credentials to connect. You can also set a **Microsoft Entra admin** to enable Entra logins alongside SQL auth.
55
55
56
56
> 📝 If you already have a test server you can use, select it instead of creating a new one.
Copy file name to clipboardExpand all lines: Instructions/Labs/07-implement-cicd-sql-database-projects.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,9 +53,9 @@ First, create an Azure SQL Database with sample data.
53
53
|**Database name**|*AdventureWorksLT*|
54
54
|**Server**| Select **Create new** and create a new server with a unique name. Select your **Location**. For authentication, select one of the following options and then select **OK**: |
55
55
56
-
> 📝**Authentication is not optional**— you must choose the method that matches your organization's security policies. Each option affects how you connect to the database later:
56
+
> 📝**Authentication is not optional.**You must choose the method that matches your organization's security policies. Each option affects how you connect to the database later:
57
57
> -**Use Microsoft Entra-only authentication***(recommended)*: Select this if your organization requires Entra-based access. Set your Azure account as the **Microsoft Entra admin**. You connect to the database using your Microsoft Entra account (for example, in SSMS select *Authentication* = **Microsoft Entra MFA**).
58
-
> -**Use both SQL and Microsoft Entra authentication/SQL authentication**: Select this if you prefer a SQL admin login or your organization allows both methods. Provide a **Server admin login** and **Password** — you need these credentials to connect. You can also set a **Microsoft Entra admin** to enable Entra logins alongside SQL auth.
58
+
> -**Use both SQL and Microsoft Entra authentication/SQL authentication**: Select this if you prefer a SQL admin login or your organization allows both methods. Provide a **Server admin login** and **Password**. You need these credentials to connect. You can also set a **Microsoft Entra admin** to enable Entra logins alongside SQL auth.
59
59
60
60
> 📝 If you already have a test server you can use, select it instead of creating a new one.
Copy file name to clipboardExpand all lines: Instructions/Labs/08-integrate-sql-solutions-azure-services.md
+43-19Lines changed: 43 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,28 +27,34 @@ You are a database developer who needs to expose product catalog data through mo
27
27
28
28
- An [Azure subscription](https://azure.microsoft.com/free)
29
29
-[Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) installed and signed in to your subscription
30
-
-[Docker Desktop](https://www.docker.com/products/docker-desktop/) installed and running (for local testing)
31
-
- A code editor such as [Visual Studio Code](https://code.visualstudio.com/download)
30
+
- A code editor such as [Visual Studio Code](https://code.visualstudio.com/download) and the [SQL Server (mssql) extension](https://marketplace.visualstudio.com/items?itemName=ms-mssql.mssql) installed
32
31
- Access to an Azure SQL Database or SQL Server instance
32
+
- Dotnet SDK 8.0 or later installed.
33
33
34
34
---
35
35
36
36
## Set up the sample database
37
37
38
38
Before configuring Data API Builder, you need a database with tables and sample data.
39
39
40
-
1. Connect to your SQL Server or Azure SQL Database using Azure Data Studio or SQL Server Management Studio.
40
+
1. Connect to your SQL Server or Azure SQL Database using SQL Server Management Studio (SSMS) or Visual Studio Code with the SQL Server (mssql) extension. For your database, select **master** if not already selected.
41
41
42
42
1. Create a new database for this exercise:
43
43
44
44
```sql
45
45
CREATEDATABASEProductCatalog;
46
46
GO
47
-
47
+
```
48
+
49
+
If you created the database in a SQL Server (not Azure SQL Database), switch to the new database:
50
+
51
+
```sql
48
52
USE ProductCatalog;
49
53
GO
50
54
```
51
55
56
+
If you created the database in Azure SQL Database, select the new database from the database dropdown in SSMS or Visual Studio Code, or open a **New Query** window andset the context to the new database.
57
+
52
58
1. Create the tables for the product catalog:
53
59
54
60
```sql
@@ -174,11 +180,13 @@ Use the DAB CLI to create a baseline configuration file.
174
180
}
175
181
```
176
182
183
+
> 💡 The `dab-config.json` file defines the Data API Builder configuration, including the data source, runtime settings, and entities that will be exposed through the API. Your current settings might differ to the previous example depending on your environment and the database you are connecting to. Your settings will at least include the @env('DATABASE_CONNECTION_STRING') variable, the /api and /graphql paths in the `runtime` section, your mode set to development, and an empty `entities` object.
184
+
177
185
---
178
186
179
187
## Add entities for tables
180
188
181
-
Add the Categories and Products tables as API entities.
189
+
On the terminal orin a command prompt, add the Categories and Products tables as API entities.
182
190
183
191
1. Use the CLI to add the Categories entity:
184
192
@@ -198,7 +206,7 @@ Add the Categories and Products tables as API entities.
198
206
dab update Product --permissions "authenticated:*"
199
207
```
200
208
201
-
1. Open `dab-config.json` to see the generated entities:
209
+
1. Open `dab-config.json` to see the generated entities (your file might look slightly different depending on your environment):
202
210
203
211
```json
204
212
"entities": {
@@ -253,7 +261,7 @@ Enhance the Product entity with field mappings and a relationship to Category.
253
261
254
262
The `mappings` section renames database columns to more API-friendly names. The `relationships` section enables GraphQL clients to navigate from a product to its category.
255
263
256
-
1. Add the reverse relationship to the Category entity:
264
+
1. Add the reverse relationship to the Category entity, replacing the existing Category entity section in`dab-config.json` with the following:
257
265
258
266
```json
259
267
"Category": {
@@ -272,6 +280,8 @@ Enhance the Product entity with field mappings and a relationship to Category.
272
280
}
273
281
```
274
282
283
+
1. Save the changes to `dab-config.json`.
284
+
275
285
---
276
286
277
287
## Add the view as a read-only entity
@@ -304,19 +314,31 @@ Expose the ProductCatalogView for clients who need combined product and category
304
314
305
315
---
306
316
307
-
## Test locally with Docker
317
+
## Test locally
308
318
309
-
Run Data API Builder locally to verify your configuration.
319
+
Run Data API Builder locally to verify your configuration. The `dab start` command launches a local web server using the .NET runtime and connects to your database using the connection string you provide.
310
320
311
-
1. Set the database connection string as an environment variable. Replace the placeholder with your actual connection string:
321
+
1. Open a **PowerShell** or **Bash** terminal. The remaining commands in this section must be run in PowerShell or Bash (not CMD). If you are currently in a CMD prompt, type `pwsh` and press Enter to switch to PowerShell (notice the prompt changes to `PS`).
1. Set the database connection string as an environment variable. Use **one** of the two options below depending on how your SQL server was configured for authentication.
324
+
325
+
> 📝 When you (or your admin) created the Azure SQL server, you chose an authentication method based on your organization's security policies. That same choice determines the connection string you use here. If you are unsure which method was configured, check the Azure portal: navigate to your SQL server >**Settings**>**Microsoft Entra ID**. If an Entra admin is setand the **Support only Microsoft Entra authentication for this server** checkbox is checked, use Option A.
326
+
327
+
**Option A: Microsoft Entra authentication** (no username/password needed; uses your signed-in Azure identity)
> 💡 Replace `your-server` with your actual server name. For Option B, also replace `your-user` and `your-password` with the admin credentials you set during server creation.
320
342
321
343
1. Start Data API Builder:
322
344
@@ -328,9 +350,11 @@ Run Data API Builder locally to verify your configuration.
328
350
329
351
You should see a JSON response with product data using the mapped field names (id, name, price, stockQuantity).
330
352
353
+
> 📝 **If you used Option A (Microsoft Entra)** and get an error about `DefaultAzureCredential failed to retrieve a token`, your Azure CLI session may have expired. Run `az login --scope https://database.windows.net//.default` in your terminal to re-authenticate, then run `dab start` again.
354
+
331
355
1. Navigate to `http://localhost:5000/graphql` to access the GraphQL playground.
332
356
333
-
1. Run a GraphQL query that uses the relationship:
357
+
1. Select**Create Document** to open a new query tab. Paste the following GraphQL query and press **Ctrl+Alt+Enter** (orselectthe **Run** button) to execute it:
334
358
335
359
```graphql
336
360
query {
@@ -349,7 +373,7 @@ Run Data API Builder locally to verify your configuration.
349
373
350
374
The response includes product information with the related category name, demonstrating the configured relationship.
351
375
352
-
1. Press `Ctrl+C` to stop Data API Builder.
376
+
1. Go back to the terminal and press`Ctrl+C` to stop Data API Builder.
0 commit comments