MongoDB Atlas is a fully managed cloud database service, and the Azure integration enables unified billing through Azure Marketplace alongside native Azure resource management. The Azure Resource Manager SDK for MongoDB Atlas enables AI agents to programmatically provision Atlas organizations as Azure resources, manage marketplace subscriptions, and integrate database infrastructure with Azure-based deployments.
What This Skill Does
The azure-mgmt-mongodbatlas-dotnet skill provides .NET interfaces for managing MongoDB Atlas organizations as Azure ARM resources. It handles organization creation with proper marketplace subscription linkage, administrator assignment for organization governance, tag management for cost allocation, resource lifecycle operations, and marketplace offer configuration with publisher, offer, plan, and billing term details.
This skill enables agents to create Atlas organizations with Azure Marketplace billing integration, specify organization administrators using email addresses and user principal names, list existing organizations across resource groups and subscriptions, update organization properties including user details and tags, and delete organizations when no longer needed.
It's critical to understand this SDK manages the Azure-side organization resource container, not Atlas clusters, databases, collections, or users directly. After provisioning the organization through this SDK, use the MongoDB Atlas API directly for cluster management and database operations.
Getting Started
Install the MongoDB Atlas resource manager SDK and required dependencies:
dotnet add package Azure.ResourceManager.MongoDBAtlas
dotnet add package Azure.Identity
dotnet add package Azure.ResourceManager
Initialize the ARM client with authentication:
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.MongoDBAtlas;
using Azure.ResourceManager.MongoDBAtlas.Models;
var credential = new DefaultAzureCredential();
var armClient = new ArmClient(credential);
Before creating organizations, you need a valid Azure Marketplace subscription for MongoDB Atlas. This typically involves accepting the MongoDB Atlas offer terms through the Azure portal or CLI first.
Key Features
Marketplace Integration: The SDK handles Azure Marketplace billing integration complexity. You provide marketplace subscription details including publisher ID (typically "mongodb"), offer ID, plan ID, plan name, billing term unit, and term identifier. The SDK ensures proper linkage between your Azure subscription and MongoDB Atlas service.
Organization Provisioning: Create Atlas organizations as Azure ARM resources within resource groups. Organizations are long-running operations that the SDK manages through completion polling. Once provisioned, organizations become visible in both Azure portal and MongoDB Atlas UI.
Administrator Configuration: Specify organization administrators using email addresses and user principal names during creation. These users receive administrative access to the Atlas organization for cluster creation, user management, and configuration.
Resource Identifiers: Access organizations directly using resource identifiers without listing operations. This optimization avoids unnecessary API calls when you know the exact resource group and organization name.
Tag Management: Add, update, and remove tags on organization resources for cost allocation, governance policies, and resource filtering. Tags applied to the Azure resource don't automatically apply to Atlas resources, which have separate tagging.
Update Operations: Modify organization properties including user details and tags through patch operations. Most property updates don't require organization recreation, enabling changes without disrupting existing clusters.
Usage Examples
Creating a MongoDB Atlas organization with marketplace integration:
var subscription = await armClient.GetDefaultSubscriptionAsync();
var resourceGroup = await subscription.GetResourceGroupAsync("database-platform");
MongoDBAtlasOrganizationCollection organizations =
resourceGroup.Value.GetMongoDBAtlasOrganizations();
var organizationData = new MongoDBAtlasOrganizationData(AzureLocation.EastUS2)
{
Properties = new MongoDBAtlasOrganizationProperties(
marketplace: new MongoDBAtlasMarketplaceDetails(
subscriptionId: subscription.Id,
offerDetails: new MongoDBAtlasOfferDetails(
publisherId: "mongodb",
offerId: "mongodb_atlas_azure_native_prod",
planId: "private_plan",
planName: "Pay as You Go (Free) (Private)",
termUnit: "P1M",
termId: "gmz7xq9ge3py"
)
),
user: new MongoDBAtlasUserDetails(
emailAddress: "[email protected]",
upn: "[email protected]"
)
{
FirstName = "Database",
LastName = "Administrator"
}
)
{
PartnerProperties = new MongoDBAtlasPartnerProperties
{
OrganizationName = "prod-databases"
}
},
Tags = {
["Environment"] = "Production",
["Team"] = "Platform"
}
};
var operation = await organizations.CreateOrUpdateAsync(
WaitUntil.Completed,
"prod-databases",
organizationData
);
MongoDBAtlasOrganizationResource organization = operation.Value;
string atlasOrgId = organization.Data.Properties?.PartnerProperties?.OrganizationId;
Console.WriteLine($"MongoDB Atlas Org ID: {atlasOrgId}");
Retrieving an existing organization using resource identifiers:
var resourceId = MongoDBAtlasOrganizationResource.CreateResourceIdentifier(
subscriptionId: subscription.Id,
resourceGroupName: "database-platform",
organizationName: "prod-databases"
);
MongoDBAtlasOrganizationResource org =
armClient.GetMongoDBAtlasOrganizationResource(resourceId);
var response = await org.GetAsync();
Console.WriteLine($"Provisioning state: {response.Value.Data.Properties?.ProvisioningState}");
Console.WriteLine($"Subscription status: {response.Value.Data.Properties?.Marketplace?.SubscriptionStatus}");
Managing resource tags for cost allocation:
var organization = await organizations.GetAsync("prod-databases");
await organization.Value.AddTagAsync("CostCenter", "Engineering");
await organization.Value.AddTagAsync("Project", "CustomerAPI");
// Or replace all tags
await organization.Value.SetTagsAsync(new Dictionary<string, string>
{
["Environment"] = "Production",
["Team"] = "Platform",
["ManagedBy"] = "InfrastructureAutomation"
});
Best Practices
Use async methods with proper await patterns for all SDK operations. All ARM operations are asynchronous to avoid blocking threads during network calls, which is especially important for long-running operations like organization provisioning.
Handle long-running operations explicitly by choosing between WaitUntil.Completed for synchronous-style behavior or WaitUntil.Started for background processing with manual polling. Organization provisioning should typically use WaitUntil.Completed to ensure the resource is ready before attempting cluster creation.
Store marketplace subscription details securely in Azure Key Vault rather than hardcoding them. Subscription IDs and term information should be treated as configuration data retrieved at runtime with proper access controls.
Check provisioning state after creation before proceeding with Atlas API operations. Wait for Succeeded state and verify the OrganizationId in partner properties is populated before making MongoDB Atlas API calls.
Use resource identifiers for direct access when you know the exact resource name. Direct access via CreateResourceIdentifier avoids listing operations and reduces API calls, improving performance in large-scale deployments.
Tag resources consistently for cost allocation and governance. Include environment type, team ownership, cost center, and project information. Tags enable filtering in Azure Cost Management and programmatic resource queries.
Separate concerns between Azure provisioning and Atlas operations. Use this SDK to create the organization container and manage its Azure lifecycle. Use MongoDB Atlas APIs for cluster management, database operations, and user administration within that organization.
When to Use This Skill
Use this skill when deploying MongoDB Atlas infrastructure as part of Azure-based applications. Teams building applications on Azure who want unified billing and resource management should provision Atlas organizations through this SDK rather than directly through MongoDB's website.
It's ideal for platform teams building self-service database infrastructure. Create internal APIs that allow development teams to provision their own Atlas organizations through automation, with governance policies enforced through Azure tags and naming conventions.
The skill is valuable when integrating Atlas into existing Azure DevOps or GitHub Actions pipelines. Automate organization creation as part of project setup workflows, ensuring database infrastructure is provisioned consistently alongside compute and storage resources.
Use it for multi-environment database infrastructure where each environment (dev, staging, production) needs isolated Atlas organizations. Programmatic management enables templated creation with environment-specific configurations and proper resource tagging.
When Not to Use This Skill
Don't use this skill for managing Atlas clusters, databases, collections, or users. The MongoDB Atlas API handles those operational tasks. This SDK only provisions the Azure resource container where Atlas operations occur.
If you're using MongoDB Atlas outside of Azure or prefer direct Atlas account management, you don't need this SDK. The Azure integration is specifically for teams wanting unified billing through Azure Marketplace and resource management alongside other Azure services.
Avoid it for querying database data or managing database schemas. Those are database operations handled through MongoDB drivers and Atlas APIs. This SDK focuses on provisioning organization resources, not database management.
Don't use it for one-time organization creation that can be done through the Azure portal. The SDK adds value for automated, repeatable provisioning workflows, not for single manual operations.
Related Skills
- azure-resource-manager-cosmosdb-dotnet - Manage Azure Cosmos DB resources for alternative NoSQL database needs
- azure-resource-manager-mysql-dotnet - Manage Azure Database for MySQL
- azure-resource-manager-postgresql-dotnet - Manage Azure Database for PostgreSQL
Source
This skill is provided by Microsoft as part of the Azure SDK for .NET. The MongoDB Atlas integration is developed in partnership with MongoDB for Azure Marketplace. Learn more at the NuGet package page and explore the API reference documentation.