Lab 2: Configure a local Azure Functions project
Task 1: Initialize a function project
On the taskbar, select the Windows Terminal icon.
Run the following command to change the current directory to the $HOME\training-az204\Labs\02\Starter\func empty directory:
cd $HOME\training-az204\Labs\02\Starter\func
Note: In Windows Explorer remove the Read-only attribute from $HOME\training-az204\Labs\02\Starter\func\.gitignore file.
Run the following command to use the Azure Functions Core Tools to create a new local Azure Functions project in the current directory using the dotnet runtime:
func init --worker-runtime dotnet --force
Note: You can review the documentation to [create a new project][azure-functions-core-tools-new-project] using the Azure Functions Core Tools.
Close the Windows Terminal application.
Task 2: Configure a connection string
- On the Start screen, select the Visual Studio Code tile.
- On the File menu, select Open Folder.
- In the File Explorer window that opens, browse to $HOME\training-az204\Labs\02\Starter\func, and then select Select Folder.
- On the Explorer pane of the Visual Studio Code window, open the local.settings.json file.
Observe the current value of the AzureWebJobsStorage setting:
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
Change the value of the AzureWebJobsStorage element to the connection string of the storage account that you recorded earlier in this lab.
- Save the local.settings.json file.
Task 3: Build and validate a project
- On the taskbar, select the Windows Terminal icon.
Run the following command to change the current directory to the $HOME\training-az204\Labs\02\Starter\func directory:
cd $HOME\training-az204\Labs\02\Starter\func
Run the following command to build the .NET Core 3.1 project:
dotnet build
Review
In this exercise, you created a local project that you'll use for Azure Functions development.