Edit

Share via


Connect apps to MongoDB Atlas (Preview)

In this guide, you learn how to connect your app to a database within a MongoDB Atlas Cluster (Preview) resource using Service Connector.

Service Connector is an Azure service designed to simplify the process of connecting Azure resources together. Service Connector manages your connection's network and authentication settings to simplify the operation.

This guide shows step by step instructions to connect an app deployed to Azure App Service to a MongoDB Atlas resource. You can apply a similar method to create a connection from apps deployed to Azure Container Apps or Azure Kubernetes Services (AKS).

Prerequisites

Create a new connection

Follow these steps to connect an app to MongoDB Atlas:

  1. Open the App Service, Container Apps, or AKS resource where your app is deployed.

  2. Open Settings > Service Connector from the left menu and select Create.

    Screenshot from the Azure portal showing the Create option.

  3. Enter or select the following information.

    Setting Example Description
    Service type MongoDB Atlas Cluster (preview) The name of the target service: MongoDB Atlas Cluster (Preview).
    Connection name mongodb_atlas_01 The name of the connection between the Azure compute resource and the MongoDB Atlas Cluster resource. Use the connection name provided by Service Connector or enter your own connection name. Connection names can only contain letters, numbers (0-9), periods ("."), and underscores ("_").

    Screenshot from the Azure portal showing the Create connection - Basics tab.

  4. Select Next: Authentication and enter your cluster connection string. Optionally also edit your cluster connection string variable name under Advanced.

    Tip

    To find your cluster's connection string, in the MongoDB Atlas platform, navigate to Clusters > Connection > Drivers, and copy the connection string.

    Screenshot from the Azure portal showing the Create connection - Authentication tab.

  5. Select Next until you reach Review + Create, and review the provided information.

  6. Select Create.

View and edit connections

To review, edit, or delete your existing connections:

  1. Go to your application in the Azure portal. On the left menu, open Service Connector.

  2. Select a connection's checkbox and explore the following options:

    • Select > to access connection details.
    • Select Validate to prompt Service Connector to check your connection.
    • Select Edit to edit connection details.
    • Select Delete to remove a connection.