Lab 2: Configure a local Azure Functions project

Task 1: Initialize a function project

  1. On the taskbar, select the Windows Terminal icon.

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

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

  4. Close the Windows Terminal application.

Task 2: Configure a connection string

  1. On the Start screen, select the Visual Studio Code tile.
  2. On the File menu, select Open Folder.
  3. In the File Explorer window that opens, browse to $HOME\training-az204\Labs\02\Starter\func, and then select Select Folder.
  4. On the Explorer pane of the Visual Studio Code window, open the local.settings.json file.
  5. Observe the current value of the AzureWebJobsStorage setting:

     "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    
  6. Change the value of the AzureWebJobsStorage element to the connection string of the storage account that you recorded earlier in this lab.

  7. Save the local.settings.json file.

Task 3: Build and validate a project

  1. On the taskbar, select the Windows Terminal icon.
  2. 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
    
  3. 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.

results matching ""

    No results matching ""