Skip to main content
Skip table of contents

Setting up Visual Studio Code

Introduction to Visual Studio Code

https://vimeo.com/1129901489/4933ffbae1

Visual Studio Code (VS Code) is a lightweight yet powerful code editor widely used for cloud-based and data-centric development. To get started, make sure you have the latest version of VS Code installed.

When working with C# and Azure Functions, you’ll need a few essential components to handle data and integrate with cloud services:

  • Newtonsoft.Json – for efficient data serialization and JSON handling.

  • Azure.Storage.Blobs – to enable interaction with Azure Blob Storage.

  • CsvHelper – since standard .NET libraries don’t natively support CSV writing, this library simplifies CSV file creation and manipulation.

In addition, you should install the Azure Functions extension for VS Code. This extension allows you to create, manage, and deploy Azure Functions directly from the editor. Once installed, ensure you’re connected to your Azure subscription, which links VS Code to your cloud environment for seamless deployment and resource management.

With these tools and extensions configured, you’ll be ready to develop, test, and deploy Azure Functions that handle CSV data efficiently within VS Code.

Setting up a project

https://vimeo.com/1129905738/5222e24c78

Begin by creating a new project (Workspace - Create New Project).

image-20250220-100927.png

Navigate to the folder where you’d like to store your project and open it.

image-20250225-135607.png

Function Apps support multiple programming languages. This manual is based on C#. Other supported languages include JavaScript, TypeScript, Python, Java, Ballerina, etc.

image-20250220-101049.png

Make sure that the latest .NET is selected (.NET 8 in this example).

image-20250220-101242.png

Choose a template for the project's first function. Different trigger functions are available. This manual covers HTTP trigger and Timer trigger.

image-20250220-101426.png

Creating an HTTP trigger

Define a function name.

image-20250220-101531.png

Specify a namespace.

image-20250220-101607.png

Set the appropriate access rights for the function.

In this manual, the access level is set to Anonymous, but the final choice depends on company policy. For more details on access rights, refer to the Microsoft website.

image-20250220-102104.png

Check the final folder structure.

The primary program file is named <function_name>.cs. In the following example, the main file is HttpTriggerAU2opt.cs.

image-20250220-102225.png

Creating a Function App

Open the command palette and enter:
Create Function App in Azure

image-20250217-104234.png

Type a name for your Function App and press Enter.

image-20250217-104331.png

Set the latest .NET version as a runtime stack.

image-20250217-104410.png

Select a location for new resources.

image-20250217-104444.png

Wait until the following message appears:
Create Function App "<name>" Succeeded

image-20250217-104549.png

Creating an HTTPS trigger

Local trigger

To run the function locally, click Run → Start Debugging.

image-20250217-111708.png

Copy the generated localhost link and paste it into a browser of your choice. This will trigger the synchronization.

image-20250217-111853.png

Public URL HTTPS Trigger

To enable a public URL trigger, the application must be deployed to Azure. In the workspace, click Deploy to Azure and deploy it to the desired Resource Group.

image-20250217-115752.png
image-20250217-115804.png

HTTP Trigger - checking results

When clicking on either the localhost link or the public URL, the function triggers a process that executes the following steps:

  1. Retrieves data from the Entra Admin Center using Graph API.

  2. Processes the data based on the configured settings.

  3. Generates one or more of the following files:

    • m2f.csv

    • f2m.csv

    • f2m_interm.csv

  4. Uploads the files to Blob Storage (for customer reference of what is sent to Retarus).

  5. Retrieves the data from Blob Storage.

  6. Sends the data to the Retarus secure HTTPS endpoint.

If files with the same name already exist in the Blob Storage container, they are overwritten. Below is an example of a push requiring the files m2f.csv, f2m.csv, and f2m_interm.csv:

image-20250217-120307.png

If your email address is listed in Retarus Directory Synchronization as a recipient for user synchronization upload reports, you’ll receive an email for each service. This email may contain the pushed .csv files, if configured.

For Email-to-Fax, the email may look similar to this:

image-20250217-120410.png

For Fax-to-Email, the email may look similar to this:

image-20250217-120449.png

For detailed configuration instructions on Retarus User Synchronization via HTTPS Push (DirSync), refer to the following manuals:

Setting up Azure connection and synchronization parameters

https://vimeo.com/1129912660/23f1584b03

After creating your project and testing the HTTP Trigger, the next step is to configure the Azure Function for your organization’s environment. Below are the basic configuration steps you’ll need to complete:

  1. Obtain and enter your Tenant ID, Client ID, and Client Secret from the Azure portal. These values authenticate the function and enable secure communication with your organization’s Azure Active Directory.

image-20251027-135854.png
  1. Add the connection string for the appropriate Azure Blob Storage account, and specify the container name where the CSV files will be stored and processed.

image-20251027-140233.png
  1. Do not change the default CSV file names (m2f.csv and f2m.csv). They are required for correct synchronization.

  2. Provide the Retarus username and password for your tenant. These credentials are supplied by your implementation engineer during onboarding.

image-20251027-140913.png
  1. Keep the predefined CSV separator and file format. These ensure multi-recipient lists (comma-separated) are parsed correctly. Only modify limits or end markers if customization is specifically required.

  2. Choose the Azure sync mode:

    • Mode 1: Synchronizes all Active Directory users.

    • Mode 2: Synchronizes specific Azure AD groups.

    • Mode 3: Allows custom logic for advanced configurations.
      In most cases, Mode 1 or Mode 2 is recommended. Seel also Sync modes.

image-20251027-143548.png
  1. Specify your Retarus customer number, which uniquely identifies your organization in the Retarus Directory Synchronization system.

image-20251027-143806.png

You may also configure additional parameters such as fax number and country code settings, forwarding markers, and other optional properties to suit your organization’s needs.

Creating a Timer trigger

Configuration

https://vimeo.com/1129947575/d4b99048df

Deployment

https://vimeo.com/1129949829/ceaa778120

Enter a name for your timer-triggered function.

image-20250217-122123.png

Specify a namespace.

image-20250217-122203.png

Create a Timer trigger Cron job.

image-20250217-122237.png

Required Libraries (NuGet)

The following table lists the required dependencies that must be installed and referenced in your code.

Module

“Using” command

Package command (NuGet)

Newtonsoft

using Newtonsoft.json

dotnet add package Newtonsoft.Json --version 13.0.3

Azure Storage Blobs

using Azure.Storage.Blobs;

dotnet add package Azure.Storage.Blobs --version 12.19.1

CsvHelper

using CsvHelper;
using CsvHelper.Configuration;

dotnet add package CsvHelper --version 32.0.3

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.