Request Guidance for Local Service Fabric Setup with Cosmos DB (Non-Prod)

Ashish Suman 0 Reputation points Microsoft Employee
2025-12-12T06:39:25.61+00:00

We have a C# microservices-based project running on Azure Service Fabric. Our services use Azure Cosmos DB and Redis. For local development and troubleshooting, we want to run Service Fabric locally and connect it to our non-production Cosmos DB instance.

However, because our services use MSI (Managed Identity) for authentication, we’re unable to directly connect to Cosmos DB when running locally.
Additionally, for SFI we have disabled the connection-string option to connect to Azure resources, which further restricts us from using traditional connection strings for local debugging.

We are looking for a solution or recommended approach that allows us to:

  1. Run Service Fabric locally

Connect local microservices to Cosmos DB (non-prod)

Work around MSI authentication so we can debug and troubleshoot issues locally

Configure our project in a way that aligns with recommended best practices for Service Fabric + Cosmos DB local development

Request:

  • Please share any documentation, guidance, or sample implementations for enabling local Service Fabric services to connect to Azure Cosmos DB (non-prod), preferably without disabling MSI.
  • If a recommended approach is to use alternate credentials, emulator, or configuration overrides, please provide details.
  • We are also available to walk you through our complete setup and use case on a call if needed.

Thank you! Let us know if any additional details are required.

Azure Service Fabric
Azure Service Fabric
An Azure service that is used to develop microservices and orchestrate containers on Windows and Linux.
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2025-12-12T06:39:37.8166667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To run your Azure Service Fabric microservices locally while connecting to a non-production Azure Cosmos DB instance, especially when using Managed Identity (MSI) for authentication, you can consider the following approaches:

    1. Use Azure Cosmos DB Emulator: The Azure Cosmos DB emulator provides a local environment that emulates the Azure Cosmos DB service. This allows you to develop and test your application locally without needing an Azure subscription or incurring costs. However, please note that the emulator is not recommended for production workloads. You can transition to using an Azure Cosmos DB account once you are satisfied with your local development.
    2. Local Authentication: Since you have disabled the connection-string option for Azure resources, you might need to configure your local development environment to authenticate using alternate credentials. This could involve using a local account or a service principal that has access to your non-production Cosmos DB instance.
    3. Configuration Overrides: Consider implementing configuration overrides in your local environment. This could involve using environment variables or a local configuration file that specifies the credentials necessary to connect to the Cosmos DB instance without relying on MSI.
    4. Testing with Alternate Credentials: If MSI is not feasible for local development, you can create a service principal in Azure Active Directory and use its credentials for local testing. This allows you to authenticate against Azure resources without needing to disable MSI entirely.
    5. Documentation and Samples: While specific documentation for Service Fabric with Cosmos DB using MSI locally may not be available, you can refer to the Azure Cosmos DB emulator documentation for guidance on setting up the emulator and connecting your application to it. Additionally, reviewing best practices for Azure Service Fabric and Cosmos DB can provide insights into configuring your project effectively.

    For detailed guidance, you may want to explore the Azure Cosmos DB emulator documentation and consider reaching out to Azure support for tailored assistance based on your specific setup and requirements.


    References:

    0 comments No comments

Your answer

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