Docs Menu
Docs Home
/
Atlas
/ /

Connect Azure Services to Atlas with Azure Service Connector

Azure Service Connector enables you to connect Azure compute services to your Atlas clusters. Once you've configured your application to use the Atlas connection string, Azure Service Connector securely stores your connection string and manages the connection between your application and Atlas.

This tutorial demonstrates how to connect an Azure compute service (such as Azure App Service) to your Atlas cluster using the Azure Service Connector within the Azure Portal.

Azure Service Connector for Atlas has the following limitations:

  • Azure Service Connector for Atlas doesn't validate the connection string beyond checking for empty strings. Ensure your connection string is valid to avoid runtime connection errors.

  • Azure Service Connector doesn't support all Azure regions. To learn more, see Service Connector region support.

  • An Azure account with an active subscription.

  • An Azure compute service to connect to Atlas. To learn what Azure services the Azure Service Connector supports, see the Azure documentation.

  • An existing Atlas cluster.

  • A database user with the necessary permissions to access your Atlas cluster.

    Important

    Azure Service Connector for Atlas currently only supports SCRAM authentication. To learn more, see Add Database Users.

  • Your Atlas cluster's connection string.

Follow these steps to connect your Azure compute service (such as App Service) to Atlas using the Azure portal.

1

In the Azure portal, select the App Service, Function App, or other compute resource you want to connect to Atlas.

2

In the service's left-hand menu, scroll to the Settings section and select Service Connector.

3
4

Configure the following fields:

  1. Service type: Search for and select MongoDB Atlas Cluster (preview).

  2. Connection name: Assign a descriptive name for this connection, for example, "atlas_connection", or accept the auto-generated name. This name is for Azure management purposes.

  3. Click Next: Authentication

5

The Connection string option is pre-selected as it's the only supported method for Atlas.

  1. Enter your Atlas connection string. To find your connection string, see Connect to Your Cluster.

  2. (Optional) Edit the variable name that Azure Service Connector uses for your connection string. Click Advanced and click the pencil icon. Edit the variable name, then click Done.

  3. Click Next: Networking.

    Skip this step since you manage network access controls from your Atlas project settings, not through Service Connector's network configuration options.

    To learn about managing network access controls in Atlas, see Configure Security Features for Clusters.

  4. Click Next: Review + Create.

    Review the summary of the connection details. Verify the target service (Atlas), compute service, authentication method, and the environment variables that are created.

  5. Click Create.

    It might take a minute or two for Azure to provision the connection. Service Connector configures the necessary settings on your Azure compute service (primarily environment variables).

    After you create or modify an Azure Service Connector connection, the corresponding environment variables might not be immediately updated or reflected in your application's environment.

    Confirm the connection was created successfully by returning to the Service Connector page for your compute service. The new Atlas connection should be listed.

After you create the connection, Service Connector uses the connection details in your Azure compute service's environment. Your application code accesses these environment variables to connect to Atlas using a standard MongoDB driver or library appropriate for your chosen language or framework.

Back

VS Code

On this page