Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
- An Azure account with an active subscription. Create an account for free.
- An existing MongoDB Atlas resource. If you don't have one yet, go to MongoDB Atlas.
- An app deployed to an Azure compute service supported by Service Connector.
Create a new connection
Follow these steps to connect an app to MongoDB Atlas:
Open the App Service, Container Apps, or AKS resource where your app is deployed.
Open Settings > Service Connector from the left menu and select Create.
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 ("_"). 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.
Select Next until you reach Review + Create, and review the provided information.
Select Create.
View and edit connections
To review, edit, or delete your existing connections:
Go to your application in the Azure portal. On the left menu, open Service Connector.
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.