Data factor cannot connect to Cosmos DB account, blocked IP error

Bhagyashri Nivdunge 1 Reputation point Microsoft Employee
2023-02-08T06:01:04.0133333+00:00

I want to copy data from cosmos db account to Azure storage, I am creating pipeline for the data migration but data factory is not able to connect to this cosmos db account, we have allowed only some IP address ranges which can access this cosmos db account - Tried to add some IP of the data factory but the pipeline uses different IP address each time. How can I make sure this data factory can access this cosmos db acount?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,452 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,628 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. BhargavaGunnam-MSFT 26,331 Reputation points Microsoft Employee
    2023-02-08T20:44:31.9533333+00:00

    Hello @Bhagyashri Nivdunge,

    Welcome to the MS Q&A platform.

    From your issue, It seems like you have restricted access to selected networks and have not selected. 'Accept connections from within public Azure data centers.

    When you select 'Accept connections from within public Azure datacenters,' all Azure services should Accept connections from within public Azure datacenters.

    (Or) your datafactory is not in the same Vnet as the cosmos DB account.

    To resolve this:

    Method1:

    You can add the ADF in the same Vnet (or) white-list the data factory IP address. But ADF will keep on adding the IP addresses, so it's hard to track and add IP addresses.

    The best approach is to configure Vnet service endpoint of data factory and cosmos DB

    You can follow the below steps:

    Create a Vnet and Subnet and add a firewall rule in your cosmos DB to allow traffic only from the subnet of the Vnet

    and configure the ADF to use the same Vnet and the subnet.

    Method2:

    use Azure Private Link to securely access your Cosmos DB account from your Data Factory. Azure Private Link enables you to access Azure PaaS Services (like Cosmos DB) over a private endpoint in your virtual network.

    Below is the document for private endpoints.

    https://learn.microsoft.com/en-us/azure/data-factory/managed-virtual-network-private-endpoint#managed-private-endpoints

    How to configure firewall for cosmos DB: https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-configure-firewall

    I hope this helps. Please let me know if you have any further questions.

    If this answers your question, please consider accepting the answer by hitting the Accept answer and up-vote as it helps the community look for answers to similar questions