How to run a Service Fabric application with different security permissions?

后端 未结 1 2017
耶瑟儿~
耶瑟儿~ 2020-12-16 03:04

Service Fabric RunAs feature

By default, a Service Fabric application will run with the Network Service account. Microsoft has (partial) documentation on how to ru

相关标签:
1条回答
  • 2020-12-16 03:31

    When you run as a localuser, this creates a random local user account on the machine. The reason this is most likely failing in the example above is the <SystemGroup Name="MyLocalGroup"/> needs to be a valid Windows system group such as "Administrators". You also do not really need the AccountName attribute above, but it does no harm.

    To solve you issue of getting a file from a remote directory you need to use a domain user as you tried since a local user does not have a shared secret that can be verified with AD. The difference is that you can encrypt the password in the application manifest using a certificate that is deployed to the machine. I have put an example ApplicationManifest.xml snippet below, showing how the password for the domain user is encrypted with a certificate called "MyCert".

    <Principals>
      <Users>
        <User Name="TestUser" AccountType="DomainUser" AccountName="Domain\User" Password="[Put Encrypted Password Here" PasswordEncrypted="true" />
      </Users>
    </Principals>
    <Policies>
      <DefaultRunAsPolicy UserRef="TestUser" />
      <SecurityAccessPolicies>
        <SecurityAccessPolicy ResourceRef="MyCert" PrincipalRef="TestUser" GrantRights="Full" ResourceType="Certificate" />
        </SecurityAccessPolicies>
    </Policies>
    

    As a side note the article here https://azure.microsoft.com/en-us/documentation/articles/service-fabric-application-secret-management show how to create the encrypted password in settings.xml which is also often useful.

    0 讨论(0)
提交回复
热议问题