<?xml version="1.0" encoding="UTF-8"?>
<!-- Configuration Template for a Microsoft Dynamics 365 for Operations, On-premises deployment 
        with additions from @NathanClouseAX from atomicax.com. This file is meant to be paired with the configTemplate.xml file found here:
		http://www.atomicax.com/article/d365ffo-prem-configtemplatexml-deep-dive -->
<DatabaseTopologies>
  <DbServer>
    <Security>
      <User refName="gmsaFRAS" type="gMSA" />
      <User refName="gmsaFRPS" type="gMSA" />
      <User refName="gmsaLocalAgent" type="gMSA" />
      <User refName="axserviceuser" type="DomainUser" />
      <User refName="gmsaAXSF" type="gMSA">
        <ServerPermission>ViewServerState</ServerPermission>
      </User>
	  <!-- userName is the actual SQL user used. This value should match the value defined in ConfigTemplate.xml-->
      <User refName="axdbadmin" type="SqlUser" userName="axdbTESTadmin">
        <ServerPermission>ViewServerState</ServerPermission>
      </User>
    </Security>
  </DbServer>
  <DatabaseTopology purpose = "AOS">
	  <!-- dbName is the actual name for the database for the transaction data database. This value should match the value defined in ConfigTemplate.xml -->
    <Database refName = "axDB" restoreEnabled= "true" dbName="AXDBTEST">
      <Security>
        <User refName="gmsaAXSF">
          <UserMappings>db_owner</UserMappings>
        </User>
        <User refName="axserviceuser">
          <UserMappings>db_owner</UserMappings>
        </User>
        <User refName="gmsaLocalAgent">
          <UserMappings>db_owner</UserMappings>
        </User>
        <User refName="gmsaFRPS">
          <UserMappings>db_owner</UserMappings>
        </User>
        <User refName="gmsaFRAS">
          <UserMappings>db_owner</UserMappings>
        </User>
        <User refName="axdbadmin">
          <UserMappings>db_owner</UserMappings>
        </User>
      </Security>
      <DbTuning>
        <SnapshotIsolation value="true" />
        <ReadCommittedSnapshotOn value="true" />
        <RecoveryModel value="Full" />
        <DBFileGrowthMB value="200" />
        <LogFileGrowthMB value="500" />
        <LogFileSizeGB value="5" />
      </DbTuning>
    </Database>
    <Database refName = "tempDb" restoreEnabled= "false" dbName="tempDb">
      <Security>
        <User refName="gmsaAXSF">
          <UserMappings>db_datareader,db_datawriter,db_ddladmin</UserMappings>
        </User>
        <User refName="axdbadmin">
          <UserMappings>db_datareader,db_datawriter,db_ddladmin</UserMappings>
        </User>
      </Security>
    </Database>
  </DatabaseTopology>
  <DatabaseTopology purpose="Orchestrator">
	  <!-- dbName is the actual name for the database for the orchestrator database. This value is not specified in the configTemplate.xml file and is only specified here-->
    <Database refName = "orchestratorData" restoreEnabled = "false" dbName="OrchestratorDataTEST">
      <Security>
        <User refName="gmsaLocalAgent">
          <UserMappings>db_owner</UserMappings>
        </User>
      </Security>
    </Database>
  </DatabaseTopology>
  <DatabaseTopology purpose="MR">
	  <!-- dbName is the actual name for the database for the orchestrator database. This value is not specified in the configTemplate.xml file and is only specified here-->
    <Database refName = "financialReporting" restoreEnabled = "false" dbName="FinancialReportingTEST">
      <Security>
        <User refName="gmsaLocalAgent">
          <UserMappings>db_owner</UserMappings>
        </User>
        <User refName="gmsaFRPS">
          <UserMappings>db_owner</UserMappings>
        </User>
        <User refName="gmsaFRAS">
          <UserMappings>db_owner</UserMappings>
        </User>
      </Security>
    </Database>
  </DatabaseTopology>
</DatabaseTopologies>