Forum Discussion

NTolani's avatar
NTolani
New Member
8 months ago

undefined

Trying to establish connection from power bi to mongo cosmos azure db. I have below inputs

Host: accountname.mongo.cosmos.azure.com

Account name: accountname

Key: Key

We are using power bi gateway server to connect to cloud. 

On power bi service able to create mongodb connector and Azure cosmos db for mongo connector they r successfully established.

These r not available in desktop tool, how to consume data or create model from these gateway connection.

If this can't be used, how to establish this connectivity.

 

Any feedback appreciated.

5 Replies

  • Hello NTolani 

     

    Power BI Desktop does not support direct connectivity to Azure Cosmos DB (Mongo API) via the on-premises gateway in the same way the Power BI Service does.
     

    Why the Gateway Connections Don’t Show in Desktop

    • The gateway is designed for Power BI Service to access on-premises or hybrid data sources.
    • Power BI Desktop cannot consume gateway connections directly; it needs a connector or a direct connection string.

    Use the following workarounds -

     

    1. Use the Native Azure Cosmos DB Connector

    • Power BI Desktop has a built-in Azure Cosmos DB connector, but it works with the SQL API, not Mongo API.
    • If your Cosmos DB is using the Mongo API, this connector won’t work.

    2. Use the MongoDB Connector

    • Power BI Desktop supports MongoDB via the ODBC driver or BI Connector.
    • Steps:
      1. Install a MongoDB BI Connector or ODBC driver on your machine.
      2. Configure the connection string using:
        mongodb://<accountname>.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&authSource=admin
        • Use your account name and key as credentials.
      3. In Power BI Desktop, go to Get Data > ODBC or Get Data > MongoDB (if available).
      4. Authenticate using username = accountname, password = Key.

    3. Use an Intermediate Layer

    • If direct Mongo connectivity is problematic, you can:
      • Create an Azure Function or Data Factory pipeline to pull data from Cosmos DB and store it in:
        • Azure SQL Database
        • Azure Data Lake
      • Then connect Power BI Desktop to that source.

    Hope this helps - please appreciate by leaving a Kudos or accepting as a Solution to help others! 

    • trillionaires's avatar
      trillionaires
      New Member

       

      Power BI Desktop cannot use gateway connections directly for Azure Cosmos DB (Mongo API). To connect:

      1. MongoDB Connector / ODBC – Install the Mongo BI Connector or ODBC driver, then connect using your account name as username and key as password.

      2. Intermediate Layer – Pull data via Azure Data Factory or Azure Function into Azure SQL Database or Data Lake, then connect Power BI Desktop to that source.

  • Hi NTolani ,
    Thanks for reaching out to Microsoft Fabric Community.
    Just wanted to check if the response provided was helpful. If further assistance is needed, please reach out.
    Thank you.

  • Hi NTolani ,

     

    Just checking in to see if you query is resolved and if any responses were helpful.
    Otherwise, feel free to reach out for further assistance.

     

    Thank you.

  • ShivekMaharaj's avatar
    ShivekMaharaj
    Impactful Individual

    Hi NTolani,

     

    The connection you created in Manage connections and gateways is a service-side connection. Power BI Desktop does not automatically expose those connections in its Get Data window, so its absence there is expected.

     

    The next step depends on which Azure Cosmos DB for MongoDB deployment you are using.

     

    The hostname and account-key authentication in your example appear to be from the RU-based Azure Cosmos DB for MongoDB API, rather than MongoDB vCore. Microsoft’s current Azure Cosmos DB for MongoDB vCore Power Query connector is specifically for vCore clusters and supports both Power BI Desktop and Power Query Online. It would therefore not be the correct connector for an RU-based account.

     

    For the RU-based MongoDB API, I would use the connection you already created with a Fabric pipeline or Copy job to load the required collections into a Lakehouse or Warehouse. Microsoft lists the Azure Cosmos DB for MongoDB connector in Fabric Data Factory as supporting Copy activity and Copy job through cloud, on-premises, or virtual network connectivity. You can then build the Power BI semantic model over the Lakehouse or Warehouse.

     

    I would not use the Microsoft Cosmos DB ODBC driver for this account. Microsoft’s ODBC driver documentation states that it supports Azure Cosmos DB for NoSQL only, not the MongoDB API.

     

    So the practical architecture would be:

     

    Azure Cosmos DB for MongoDB → Fabric pipeline or Copy job → Lakehouse/Warehouse → Power BI

     

    The account name and key you already have can be used as the MongoDB username and password where the Fabric connector requests basic authentication. Microsoft also recommends copying the complete MongoDB connection information from the Azure portal’s Connection strings page rather than manually constructing it.

     

    I hope this helps clarify why the gateway connection is not appearing in Desktop. The key first step is confirming whether the account is MongoDB vCore or the RU-based MongoDB API, because the supported Power BI path differs between them.