hero banner for azure and nylas

How to create an Azure app

5 min read

The blog post has been updated to work with Nylas API V3.

In this post, let’s take a look at creating an Azure App to use with Nylas. This is useful when building applications requiring access to a user’s communication data. In this scenario, we’ll be allowing Outlook users to connect their accounts so we can access their email, calendar, and contacts. We created a similar post on how to create a Google API project. This post will walk the reader through how to create an Azure App.

Also, check out our livestream that walks you through setting up your first Azure app:

Prerequisites

  • Sign up here if you need to create a Nylas account for free!
  • Create a new App in the Nylas dashboard
    • Note the starter app (quickstart apps) does not allow setting up Outlook Authentication
  • We’ll be using Azure console to create an Azure App, so make sure you signup for an Azure account!

Environment

No local environment setup is required, we’ll be using the Nylas and Azure dashboards to set everything up.

Azure App Overview

A few items we need to consider upfront are authentication flow and supported account types.

The two different authentication flows are: hosted and native authentication. Hosted authentication flow is a no-code approach to connecting users. The differences between hosted and native authentication are discussed in the Nylas docs. We’ll be using hosted authentication.

Most applications will be external public-facing applications. This requires additional checks before publishing and you are initially limited on the total number of test accounts. For the purposes of this blog, when creating an app in Azure, when selecting Supported account types, we will use Accounts in any organizational directory that is open to all users.

Let’s jump into Azure and create our app. This involves a few steps, so we’ll go through them one by one.

Understanding Required APIs and Permissions

The Nylas docs contain a list of different Azure permissions we can set up when building with Nylas. Keep in mind that we have a few Azure scopes that will be required (openid, profile, and User.Read) when creating an Azure app. For now, let’s consider the flow where we are just accessing the user’s calendar data, so that will requires us to include the Calendars.Read Azure API permission.

Create an Azure App

Let’s head over to Azure and create a new app:

create an Azure App called azure-app

One thing to note is that since we are using Nylas’ Hosted Authentication, we need to add the Redirect URI as https://api.nylas.com/oauth/callback as per the Nylas docs on Integrated Hosted Authentication.

Now we’ve created an Azure App that we can start to configure the APIs we want to use.

Enable APIs and Permissions

The APIs that we enable will allow us to access specific user communication data: profile data, contacts, emails, calendars, and available resources (i.e. room availability). For now lets’ consider connecting the Azure Calendar API so that we can receive emails.

We’ve gone ahead and added the required permissions (openid, profile, and User.Read), so let’s add the Calendar scope (Calendar.Read):

Set up API / permissions for Azure app

One thing to keep in mind is that we are setting up Application permission for Calendar.Read. Have a look at Azure’s overview of permissions and consent.

Now we’ve enabled the Azure permissions to receive a user’s calendar data such as upcoming events.

Configure OAuth Credentials

We need to create API credentials, so Nylas can communicate with Azure API and similar service providers to retrieve the user data for us. The purpose of doing this is so our application can receive a consistent structure of communication data across all providers as we build out our application.

Let’s set up the Azure API OAuth Credentials on Azure:

setup OAuth credentials for Azure app

After creating the new secret, you will have a Value and Secret ID:

azure app client secret

Note: Ensure to securely store the Secret ID, this should not be publicly available (i.e. the client credentials have been deleted)

We will be taking the Secret ID and adding it to the Nylas Dashboard shortly. Another value that we will need is the Application (client) ID for the app we created (azure-app):

azure app client ID

Now we’ve set up OAuth credentials so we can start communicating with the Azure API to access user communication data like upcoming calendar events.

Update Nylas Dashboard

Let’s add the Azure OAuth credentials to the Nylas dashboard:

Note in the above image, we created a new application azure-app before adding the Azure OAuth credentials user to the Office365 Auth section of Authentication.

Connecting accounts with Nylas

Let’s test out the integration by connecting an Outlook account using the Nylas Dashboard (this is equivalent to using Nylas’ Hosted Authentication):

Note: Ensure to securely store the access token, this should not be publicly available (i.e. the client credentials have been deleted)

Now we’ve successfully tested connecting to an Outlook account using the Nylas Dashboard.

Build Time!

Continue building with Nylas and learn more by visiting the documentation. Sign up here if you need to create a Nylas account for free!

Related resources

How to build a CRM in 3 sprints with Nylas

What is a CRM? CRM stands for Customer Relationship Management, and it’s basically a way…

How to create an appointment scheduler in your React app

Learn how to create an appointment scheduler in your React app using Nylas Scheduler. Streamline bookings and UX with step-by-step guidance.

Beyond APIs: Designing elegant, smart Web Components

Dive into the world of smart Web Components for advanced API integration solutions. Design elegant, customizable elements to elevate user experiences.