Skip to content

Commit 3364773

Browse files
committed
Updating documentation for all templates
1 parent 311f511 commit 3364773

File tree

8 files changed

+368
-131
lines changed

8 files changed

+368
-131
lines changed

src/dotnet-aspire/NOTES.md

+93-33
Large diffs are not rendered by default.

src/dotnet/NOTES.md

+90-30
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,138 @@
11

22
This dev container template enables you to effortlessly explore **.NET** and **Azure SQL**. In just a few simple steps, you can dive into the capabilities of these powerful technologies.
33

4-
A **development container** (Dev Container for short) is a running [Docker](https://www.docker.com) container with a well-defined tool/runtime stack and its prerequisites. You can try out dev containers with **[GitHub Codespaces](https://github.com/features/codespaces)** or **[Visual Studio Code Dev Containers](https://aka.ms/vscode-remote/containers)**.
4+
A **development container** (dev container for short) essentially packages up your project's development environment using the Development Container Specification. This specification enriches your container with metadata and content necessary to enable development from inside a container.
55

6-
To learn more details about all the Azure SQL Database templates, you can explore the template repository at [aka.ms/azuresql-devcontainers](https://aka.ms/azuresql-devcontainers). This repository includes comprehensive information for each Azure SQL template. To learn more about Dev Containers, visit [containers.dev](https://containers.dev/) website, where you find a diverse range of templates.
6+
You can try out dev containers with **[GitHub Codespaces](https://github.com/features/codespaces)** or **[Visual Studio Code Dev Containers](https://aka.ms/vscode-remote/containers)**.
77

8-
> **Note:**
9-
> If you already have a Codespace or Dev Container, you can jump to the [About this template](#about-this-template) section.
10-
11-
## Setting up the development container
8+
To learn more details about all the Azure SQL Database templates, you can explore the template repository at [aka.ms/azuresql-devcontainers-repo](https://aka.ms/azuresql-devcontainers-repo). This repository includes comprehensive information for each Azure SQL template. To learn more about Dev Containers, visit [containers.dev](https://containers.dev/) website, where you find a diverse range of templates.
129

13-
### GitHub Codespaces
10+
> [!NOTE]
11+
> If you already have a VS Code Dev Container or a GitHub Codespace, you can jump to the [About this template](#about-this-template) section.
1412
15-
Follow these steps to open this sample in a Codespaces:
16-
17-
1. Select the Code drop-down menu and select the **Codespaces** tab.
18-
2. Select on **Create codespaces on main** at the bottom of the pane.
19-
20-
For more info, check out the [GitHub documentation](https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/creating-a-codespace#creating-a-codespace).
13+
## Setting up the development container
2114

22-
### Visual Studio Code - Dev Containers
15+
### Visual Studio Code
2316

2417
Follow these steps to open this sample in a container using the VS Code Dev Containers extension:
2518

2619
1. If you're using a dev container for the first time, ensure your system meets the prerequisites in the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started).
2720
2. To use this repository, you can either open the repository in an isolated Docker volume:
2821
- Press `F1` or `Ctrl+Shift+P` to open the command palette.
2922
- Select the **Dev Containers: New Dev Container** command.
30-
- Select the desired dev container template for Azure SQL Database, typing `*Azure SQL*`.
23+
- Select the desired dev container template for Azure SQL Database, typing **Azure SQL**.
3124
- Select the **.NET and Azure SQL (dotnet)** template
3225
- Wait for the container to build.
3326
- Visual Studio Code builds the container based on the selected configuration.
3427
- The build process might take a few minutes the first time.
3528
- Subsequent builds are faster.
3629
- Once the container is built, the repository opens in the dev container.
3730

38-
> **Note:**
31+
For more information, see the [Dev Containers tutorial](https://code.visualstudio.com/docs/devcontainers/tutorial).
32+
33+
> [!NOTE]
3934
> Under the hood, this will use the **Dev Containers: Clone Repository in Container Volume...** command to clone the source code in a Docker volume instead of the local filesystem. [Volumes](https://docs.docker.com/storage/volumes/) are the preferred mechanism for persisting container data.
4035
36+
### GitHub Codespaces
37+
38+
To set up and use a dev container with GitHub Codespaces, follow these steps:
39+
40+
1. **Prerequisites**
41+
- Ensure you have access to GitHub Codespaces.
42+
- Ensure your repository is hosted on GitHub.
43+
44+
2. **Create or Open a Codespace**
45+
- Navigate to your repository on GitHub.
46+
- Click on the **Code** button, then select **Codespaces**.
47+
- Click **New codespace** to create a new one or **...** next to an existing codespace to open it.
48+
49+
3. **Set Up the Development Container**
50+
- Once your codespace is running, open the command palette by pressing `F1` or `Ctrl+Shift+P`.
51+
- Type and select **Dev Containers: Add Development Container Configuration Files...**.
52+
- From the list, select **Show All Definitions...**.
53+
- Type **Azure SQL** to filter the list.
54+
- Select the **.NET and Azure SQL (dotnet)** template.
55+
- The selected template will be added to your repository, creating a `.devcontainer` folder with configuration files.
56+
57+
4. **Rebuild the Codespace**
58+
- To apply the new configuration, you need to rebuild the codespace.
59+
- Open the command palette by pressing `F1` or `Ctrl+Shift+P` again.
60+
- Type and select **Codespaces: Rebuild Container**.
61+
- Wait for the container to rebuild. This might take a few minutes the first time as it pulls and sets up the necessary images and configurations.
62+
63+
5. **Using the Dev Container**
64+
- Once the container is built, your codespace will restart in the new development environment.
65+
- You can now start exploring and developing with the preconfigured .NET and Azure SQL setup.
66+
67+
> [!NOTE]
68+
> The `.devcontainer` folder includes configuration files like `devcontainer.json`, `docker-compose.yml`, and supporting scripts for setting up and managing the development environment.
69+
4170
### About this template
4271

43-
This Dev Container includes a preconfigured database, specifically tailored for use with NET 8. This database serves as a foundation for demonstrating how the .NET component interacts with Azure SQL.
72+
This Dev Container includes a preconfigured database, specifically tailored for use with .NET 8. This database serves as a foundation for demonstrating how .NET interacts with Azure SQL.
4473

45-
This template creates two containers, one for the Dev Container that includes .NET 8, and one for Microsoft SQL Server. You will be connected to the Ubuntu, and from within that container, the MS SQL container will be available on **`localhost`** port 1433. The Dev Container also includes supporting scripts in the `.devcontainer/sql` folder used to configure the `Library` sample database.
74+
This template creates two containers: one for the container that includes .NET 8, and one for the database. You will be connected to the Ubuntu environment, and from within that container, the database container will be available on **`localhost`** port 1433. The dev container also includes a set of VS Code tasks that can help you to verify the database schema and data, as well as build and publish the database project to the database container.
4675

47-
The database container (SQL-Library) is deployed from the latest developer edition of Azure SQL Edge. The database(s) are made available directly in the Codespace/VS Code through the MSSQL extension with a connection labeled **LocalDev**. The default `sa` user password is set using the .devcontainer/.env file. The default SQL port is mapped to port `1433` in `.devcontainer/docker-compose.yml`.
76+
The database container (SQL-Library) is deployed from the latest developer edition of Azure SQL Edge. The database(s) are made available directly in VS Code through the MSSQL extension with a connection labeled **LocalDev**. The default `sa` user password is set using the `.devcontainer/.env` file. The default SQL port is mapped to port `1433` in `.devcontainer/docker-compose.yml`.
4877

4978
.NET 8 is a state-of-the-art framework for developing cloud-native applications, with a focus on containerized environments. Built on .NET Core, .NET 8 offers advanced features for creating scalable, performant, and resilient applications. Improved performance, support for microservices, and robust tools make .NET 8 ideal for modern cloud development.
5079

51-
> **Note:**
80+
> [!IMPORTANT]
5281
> While the database container employs a development version of Azure SQL Edge , all database development within this dev container can be validated for Azure SQL Database using the SQL Database Project. The SQL Database project is preconfigured with the target platform set as Azure SQL Database.
82+
>
83+
> To learn more about the SQL Database Projects extension, visit the [Getting started with the SQL Database Projects extension](/azure-data-studio/extensions/sql-database-project-extension-getting-started).
84+
85+
### Preconfigured Environment
86+
87+
All of the below tools and utilities are pre-loaded in the dev container. You don't need to download or install!
88+
89+
- **.NET** : The environment includes your preferred programming language/framework preinstalled and configured, ready for development.
90+
- **Azure CLI**: Tools for managing Azure resources and deployments.
91+
- **Azure Developer CLI**: A command-line interface providing a unified scripting experience for managing and developing Azure resources.
92+
- **Docker CLI**: Allows building and managing Docker containers from within another container.
93+
- **Azure SQL Database**: The `library` database was created, validated, and is ready for use. This database gives you full compatibility with Azure SQL Database.
94+
- **SQLCMD**: A command-line utility you can use to interact with the database, run queries, and more.
95+
- **SqlPackage**: Command-line utility for deploying database changes, including schema updates and data migrations.
96+
97+
### Visual Studio Code Extensions
98+
99+
- `ms-mssql.mssql`: SQL Server extension for connecting and querying SQL databases.
100+
- `ms-mssql.sql-database-projects`: Extension for managing SQL Database projects, allowing for streamlined schema changes and deployment.
101+
- `github.copilot`: AI-powered code completion for enhanced productivity.
102+
- `ms-azuretools.vscode-docker`: Docker extension for managing containers directly from Visual Studio Code.
103+
- `github.codespaces`: Extension for working with GitHub Codespaces.
104+
- `ms-azuretools.vscode-docker`: Docker extension for managing containers.
105+
106+
> [!TIP]
107+
> There will be more extensions available depending on the template you choose. You can install additional extensions by opening the Extensions view in Visual Studio Code and searching for the desired extension.
53108
54109
#### Visual Code Tasks
55110

56111
This dev container template includes multiple tasks that can help with common actions. You can access these tasks by opening the Command Palette in VS Code. Here's how:
57112

58113
1. To open the Command Palette, press <kbd>F1</kbd> or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>.
59-
2. Type "Run Task" and select "Tasks: Run Task".
114+
2. Type **Run Task** and select **Tasks: Run Task**.
60115
3. Choose the task you want to run from the list.
61116

62-
##### Verify database schema and data
117+
##### 1. Verify database schema and data
63118

64119
This task opens the `verifyDatabase.sql` file in your workspace and executes the SQL query using the `ms-mssql.mssql` extension. This task is optional however it can help you to become familiar with the sample `Library` database tables and data included in this dev container template.
65120

66-
##### Build SQL Database project
121+
##### 2. Build SQL Database project
67122

68123
This task builds the SQL Database project. It runs the command `dotnet build` in the `database/Library` directory of your workspace.
69124

70125
This task is optional, but it's useful to verify the database schema. You can use this SQL Database project to make changes to the database schema and deploy it to the SQL Server container.
71126

72-
#### Publish SQL Database project
127+
##### 3. Publish SQL Database project
73128

74129
This task involves deploying the SQL Database project to your SQL Server container. It executes the `postCreateCommand.sh` script found in the `.devcontainer/sql` directory of your workspace.
75130

76131
The `postCreateCommand.sh` script requires one argument: the path to the directory containing the .dacpac file for the SQL Database project. In this scenario, that directory is `database/Library/bin/Debug`.
77132

78-
It utilizes the sqlpackage command-line utility to update the database schema using the .dacpac file, employing authentication credentials from the `.env` file situated in the `.devcontainer` directory.
133+
It utilizes the `SqlPackage` command-line utility to update the database schema using the .dacpac file, employing authentication credentials from the `.devcontainer/.env` file.
79134

80-
##### Trust HTTPS certificate for .NET
135+
##### 4. Trust HTTPS certificate for .NET
81136

82137
This task trusts the HTTPS certificate for the .NET project. It runs the command `dotnet dev-certs https --trust`.
83138

@@ -92,7 +147,7 @@ The password must comply with the following rules:
92147

93148
### Database deployment
94149

95-
By default, a demo database titled `Library` is created using a DAC package. The deployment process is automated through the `postCreateCommand.sh` script, which is specified in the devcontainer.json configuration:
150+
By default, a demo database titled `Library` is created using a dacpac file. The deployment process is automated through the `postCreateCommand.sh` script, which is specified in the `devcontainer.json' configuration:
96151

97152
```json
98153
"postCreateCommand": "bash .devcontainer/sql/postCreateCommand.sh 'database/Library/bin/Debug'"
@@ -102,14 +157,19 @@ By default, a demo database titled `Library` is created using a DAC package. The
102157

103158
The `postCreateCommand.sh` script handles the database deployment by performing the following steps:
104159

105-
1. Loads the `SA_PASSWORD` from the `.env` file.
160+
1. Loads the `SA_PASSWORD` from the `.devcontainer/.env` file.
106161
1. Waits for the SQL Server to be ready by attempting to connect multiple times.
107162
1. Checks for .dacpac files in the specified directory (`database/Library/bin/Debug`).
108-
1. Deploys each .dacpac file found to the SQL Server.
163+
1. Deploys each .dacpac file found to the database.
109164

110165
#### Using the SQL Database Projects Extension
111166

112-
You can use the SQL Database Projects extension to deploy the database schema. The `Library.sqlproj` project is located in the `database/Library` folder and can be built using the Build SQL Database project task. The output .dacpac files should be placed in the `./bin/Debug` folder for deployment.
167+
To modify the database schema, utilize the SQL Database Projects extension. This allows you to build and publish changes directly from VS Code to your local database included in this development environment. Use the pre-built VS Code tasks for building (`2. Build SQL Database project`) and publishing (`3. Publish SQL Database project`). The build process will update the `.dacpac` file and the project definition, which is located in the `./bin/Debug` folder.
168+
169+
> [!TIP]
170+
> With this demo project, you can easily use the dacpac artifact created by SQL Database Projects and deploy it to Azure SQL Database using the Azure SQL Action for GitHub Actions. This process streamlines your workflow and ensures seamless integration with your production environment.
171+
172+
To learn more about the SQL Database Projects extension, visit the [Getting started with the SQL Database Projects extension](/azure-data-studio/extensions/sql-database-project-extension-getting-started).
113173

114174
### Adding another service
115175

0 commit comments

Comments
 (0)