Prerequisites
Prerequisites¶
The workshop is divided into separate modules. Each module will guide you through building the solution code step-by-step. Ensure that you finish the modules in the right order as they have dependencies on each other.
Note
Please follow these prerequisites exactly. We understand you have many choices in tooling and personal preferences. However, adhering closely to the workshop's approach increases the likelihood of your success with these labs.
Make sure you have your development environment set up and configured.
- An Azure account with an active subscription - Create an account for free
- .NET SDK 8, 9, or 10 (the checked-in reference applications target .NET 10) - Install
- PowerShell 7.0 or higher version (For Windows Users only!) - Install
Do not use PowerShell 5.1! If you are unsure which version of PowerShell is running, you can execute
$PSVersionTable.PSVersionin a PowerShell terminal. - A local container runtime: Docker Desktop - Install, or WSL containers (
wslc) on Windows - Install WSL. WSLC is included with WSL 2.9.3 or later; no separate installation is needed. Follow the setup for your choice below.As of November 2024, Docker Desktop continues to be free for education purposes. Please consult the Docker Desktop license agreement for any updates.
- Visual Studio Code - Install
- VS Code Docker extension - Install
- Dapr CLI - Install, then initialize it using the instructions for your container runtime below.
- VS Code Dapr extension. Depends on Dapr CLI - Install
- Azure CLI - Install
- Git CLI - Install
- (Optional) A REST client such as Postman or Insomnia or similar.
Local container and Dapr setup¶
Install Docker Desktop and start it. On Windows, follow the Docker Desktop installation instructions for its WSL 2 or Hyper-V backend. Initialize Dapr with:
This creates the default Dapr components and local Redis container. See the Dapr setup guide for details.
If WSL is not installed, open PowerShell as administrator and run:
Restart Windows when prompted. Then update WSL and verify that the version is 2.9.3 or later and that WSLC is available:
See the WSL containers guide for installation and troubleshooting details. Once WSL and the Dapr CLI are installed, initialize Dapr and start Redis:
dapr init --slim installs the Dapr binaries but does not create containers or component files. WSLC is not a Docker daemon, so ordinary dapr init cannot use it to create those resources. The workshop uses Redis for local state and messaging; the Redis container above is for local development only and has no password. If port 6379 or the container name is already in use, resolve that conflict before starting it.
Create the directory %USERPROFILE%\.dapr\components if it does not exist. If you already have Dapr components there, review them before making changes; do not overwrite existing configuration you want to keep. Create statestore.yaml in that directory:
Create pubsub.yaml in the same directory:
Verify Redis with wslc container list and wslc exec workshop-redis redis-cli ping (expect PONG). To stop Redis, run wslc stop workshop-redis. To restart it, run wslc start workshop-redis.
1 2 3 4 5 6 7 8 9 | |
Set up Git Repository & Variable Scripts¶
Git Repository¶
This workshop typically spans several days. As such, you may close your tools, end CLI sessions, reboot, or simply want to persist working implementations in a repository as each module builds upon the one before it. A local Git repository can help.
-
Open a command-line terminal and create this folder for the workshop, then switch to that folder.
-
Initialize the git repository.
-
Use the
codecommand to launch Visual Studio Code from that directory as shown: -
From VS Code's Terminal tab, select New Terminal to open a (PowerShell) terminal in the project folder TasksTracker.ContainerApps.
Note
Throughout the documentation, we may refer to the TasksTracker.ContainerApps directory as root to keep documentation simpler.
-
In the root create a
.gitignorefile. This ensures we keep our git repo clean of build assets and other artifacts. -
Commit the
.gitignorefile.
Set-Variables & Variables Script¶
-
In the root create a new file called
Set-Variables.ps1. -
Copy the Set-Variables.ps1 script into the newly-created
Set-Variables.ps1file and save it. -
Execute the script. You will do this repeatedly throughout the modules. The output of the script will inform you how many variables are written out. As we have not yet defined any variables, the output will indicate that the script has exited (without writing out to the file). This is intentional and expected at this stage.
-
Commit the
Set-Variables.ps1file.
-
In the root create a new file called
set_variables.sh. -
Copy the set_variables.sh script into the newly-created
set_variables.shfile and save it. -
Make it executable and execute the script. You will do this repeatedly throughout the modules. The output of the script will inform you how many variables are written out. As we have not yet defined any variables, the output will indicate that the script has exited (without writing out to the file). This is intentional and expected at this stage.
-
Commit the
set_variables.shfile.
This completes the basic setup for Git and the variables to be used. You are ready to proceed to Module 1!
Jump Ahead¶
If you don't want to build the solution code from scratch, you can clone the source code repository final version by utilizing below command, and you can use the modules to deploy Azure resources using the provided Azure CLI commands.