Skip to content

Setting Up BlueCorpDispatchAuto for Local Development

Shelvin Datt edited this page Mar 26, 2025 · 1 revision

Setting Up BlueCorpDispatchAuto for Local Development

To run the BlueCorpDispatchAuto project locally using Visual Studio 2022 with .NET 8, you'll need to create a local.settings.json file in the root directory of your project. This file contains configuration settings that are specific to your local development environment.

Creating the local.settings.json File

  1. Navigate to the Root Directory: Open your BlueCorpDispatchAuto project in your file explorer and ensure you are in the root directory. This is the same directory where your .csproj file resides.

  2. Create the File: Create a new file named local.settings.json in this directory.

  3. Add the Configuration: Copy and paste the following JSON content into the local.settings.json file:

    {
        "IsEncrypted": false,
        "Values": {
            "AzureWebJobsStorage": "UseDevelopmentStorage=true",
            "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
            "SFTP_TIMER_SCHEDULE": "0 0 18 * * *",
            "SftpSettings:Host": "sftp.example.com",
            "SftpSettings:Username": "sftp-user",
            "SftpSettings:PrivateKeyPath": "C:\\keys\\id_rsa",
            "SftpSettings:RemoteFolder": "/uploads",
            "ProcessedCsvContainer": "processed-csv",
            "RawJsonContainer": "raw-json"
        }
    }

Understanding the Settings

  • IsEncrypted: false: This indicates that the settings are not encrypted. For local development, this is typically set to false.
  • Values: This section contains the application settings.
    • AzureWebJobsStorage: UseDevelopmentStorage=true: This tells Azure Functions to use the local Azure Storage Emulator for development. Ensure you have the emulator installed and running.
    • FUNCTIONS_WORKER_RUNTIME: dotnet-isolated: Specifies that the Azure Function should run in an isolated .NET process.
    • SFTP_TIMER_SCHEDULE: 0 0 18 * * *: Defines the timer trigger schedule for the SFTP processing. This example sets it to run at 6:00 PM every day.
    • SftpSettings:Host: sftp.example.com: The hostname or IP address of the SFTP server.
    • SftpSettings:Username: sftp-user: The username for authenticating with the SFTP server.
    • SftpSettings:PrivateKeyPath: C:\\keys\\id_rsa: The path to the private key file used for SFTP authentication. Important: Ensure this path is correct and accessible to your local environment.
    • SftpSettings:RemoteFolder: /uploads: The remote folder on the SFTP server where files are located.
    • ProcessedCsvContainer: processed-csv: The name of the Azure Storage Blob container for processed CSV files.
    • RawJsonContainer: raw-json: The name of the Azure Storage Blob container for raw JSON files.

Important Considerations

  • Replace Placeholder Values: Make sure to replace the placeholder values (e.g., sftp.example.com, sftp-user, C:\\keys\\id_rsa) with your actual SFTP server details and local file paths.
  • Private Key Security: The private key file (id_rsa) should be kept secure. Avoid committing it to version control systems.
  • Azure Storage Emulator: If you haven't already, download and install the Azure Storage Emulator. Ensure it's running before you start debugging your Azure Function.
  • Container Names: The ProcessedCsvContainer and RawJsonContainer names must align with containers that you have created in your local azure storage emulator, or your Azure cloud storage.

By following these steps, you'll have your BlueCorpDispatchAuto project configured for local development in Visual Studio 2022.

Clone this wiki locally