Search code examples
sql-serverazure-service-fabric

Service Fabric - The login is from an untrusted domain and cannot be used with Windows authentication


When I am trying to open an sql connection using normal application have no issues. But when I tried with stateless service fabric application, I got the following error "Login failed. The login is from an untrusted domain and cannot be used with Windows authentication."

I used the following connection string to connect to my DB:

When I tried with a specific username and password, its working fine. How to run the service fabric application against a specific user account as we normally did in our windows application?

Thnaks, Divya


Solution

  • Your Service Fabric Service is running as the 'NETWORK SERVICE' by default. This account is a local account, unlikely to be allowed access to SQL Server.

    You can change the account you run your Service under. (chapter 'Use an Active Directory domain group or user')

    Keep in mind that you should be running with least privileges, so I'd recommend creating a separate account that can only access the database it needs to. (no other db's, no other servers, etc.)

    You can also grant the NETWORK SERVICE account of each cluster node access to the database.