Depoyment failure when creating cosmo db with mongo support on azure

Harmeet Kamboj 0 Reputation points
2025-06-13T13:29:19.19+00:00

I am getting an error when I am trying to create Cosmos MongoDB service in Azure.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,901 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Taduturu Balaji 80 Reputation points Microsoft External Staff Moderator
    2025-06-18T10:25:06.09+00:00

    Hi @Harmeet Kamboj ,

    From your first screenshot, the error indicates that the Cosmos DB account name you chose is already in use. Try creating the account with a globally unique name.

    From your second screenshot, the error shows that the resource write operation failed and reached the terminal provisioning state 'Failed'. Means a previous attempt to create a Cosmos DB account with the same name has failed that deployment may still be causing a conflict.

    Try with the below code to create Azure Cosmos DB with Mongo using Powershell:

    It will create provisioned throughput (RU/s) account, as we use -Kind MongoDB with New-AzCosmosDBAccount.

    
    >>$resourceGroup = "*******"
    
    >> $location = "East US"
    
    >> $accountName = "mycosmosmongotest"  
    
    >>
    
    >> New-AzResourceGroup -Name $resourceGroup -Location $location
    
    >>
    
    >> New-AzCosmosDBAccount `
    
    >>     -ResourceGroupName $resourceGroup `
    
    >>     -Name $accountName `
    
    >>     -Location $location `
    
    >>     -ApiKind MongoDB `
    
    >>     -DefaultConsistencyLevel "Session"
    
    

    Output:

    
    ResourceGroupName : *********
    
    Location          : eastus
    
    ProvisioningState : Succeeded
    
    Tags              :
    
    ResourceId        : /subscriptions/**********/resourceGroups/*********
    
    

    For more information on Azure Cosmos Mongo DB refer to the below articles,


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.