Skip to content

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.

  1. An Azure account with an active subscription - Create an account for free
  2. .NET SDK 8, 9, or 10 (the checked-in reference applications target .NET 10) - Install
  3. 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.PSVersion in a PowerShell terminal.

  4. 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.

  5. Visual Studio Code - Install
  6. VS Code Docker extension - Install
  7. Dapr CLI - Install, then initialize it using the instructions for your container runtime below.
  8. VS Code Dapr extension. Depends on Dapr CLI - Install
  9. Azure CLI - Install
  10. Git CLI - Install
  11. (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:

dapr init

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:

wsl --install

Restart Windows when prompted. Then update WSL and verify that the version is 2.9.3 or later and that WSLC is available:

1
2
3
wsl --update
wsl --version
wslc version

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
wslc run -d --name workshop-redis -p 127.0.0.1:6379:6379 redis:7

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:

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: statestore
spec:
  type: state.redis
  version: v1
  metadata:
  - name: redisHost
    value: localhost:6379
  - name: redisPassword
    value: ""

Create pubsub.yaml in the same directory:

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: pubsub
spec:
  type: pubsub.redis
  version: v1
  metadata:
  - name: redisHost
    value: localhost:6379
  - name: redisPassword
    value: ""

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
Start the placement service installed by slim initialization in a separate PowerShell terminal, and leave that terminal open while using Dapr:

```powershell
& "$env:USERPROFILE\.dapr\bin\placement.exe" --port 6050 --listen-address 127.0.0.1 --healthz-listen-address 127.0.0.1 --metrics-listen-address 127.0.0.1
```

Without it, Dapr repeatedly tries to connect to the default placement address. If ports 6050, 8201, 8080, or 9090 are in use, resolve the conflict before starting placement. The workshop's CLI examples disable the scheduler; Zipkin is optional.

When finished, stop placement with Ctrl+C in its terminal. Stop and remove only the workshop Redis container with `wslc stop workshop-redis` and `wslc remove workshop-redis`; its data will be lost.

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.

    md TasksTracker.ContainerApps
    cd TasksTracker.ContainerApps
    
    1
    2
    3
    mkdir TasksTracker.ContainerApps
    cd TasksTracker.ContainerApps
    export PROJECT_ROOT=$(pwd)
    
  • Initialize the git repository.

    git init
    
  • Use the code command to launch Visual Studio Code from that directory as shown:

    code .
    
  • 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 .gitignore file. This ensures we keep our git repo clean of build assets and other artifacts.

    1
    2
    3
    4
    # Exclude build artifacts
    **/obj/
    **/bin/
    **/dist/
    
  • Commit the .gitignore file.

    git add .\.gitignore
    git commit -m "Add .gitignore"
    
    git add ./.gitignore
    git commit -m "Add .gitignore"
    

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.ps1 file 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.

    .\Set-Variables.ps1
    
  • Commit the Set-Variables.ps1 file.

    git add .\Set-Variables.ps1
    git commit -m "Add Set-Variables.ps1"
    
  • In the root create a new file called set_variables.sh.

  • Copy the set_variables.sh script into the newly-created set_variables.sh file 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.

    chmod +x ./set_variables.sh
    ./set_variables.sh
    
  • Commit the set_variables.sh file.

    git add ./set_variables.sh
    git commit -m "Add set_variables.sh"
    

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.

git clone https://github.com/Azure/aca-dotnet-workshop.git