diff --git a/src/python/dm/common/cli/dmRestSessionCli.py b/src/python/dm/common/cli/dmRestSessionCli.py
index 462c5baa8575d49f6ce40d3d075d850149437e99..2c8cfe097e2e6ea7cd43b56331cfa19e30631366 100755
--- a/src/python/dm/common/cli/dmRestSessionCli.py
+++ b/src/python/dm/common/cli/dmRestSessionCli.py
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 
 from dm.common.cli.dmRestCli import DmRestCli
+from dm.common.utility.configurationManager import ConfigurationManager
 
 class DmRestSessionCli(DmRestCli):
     """ Base dm session cli class. """
@@ -14,11 +15,14 @@ class DmRestSessionCli(DmRestCli):
         self.addOptionGroup(loginGroup, None)
         self.addOptionToGroup(loginGroup, '', '--login-username', dest='loginUsername', help='Login username.')
         self.addOptionToGroup(loginGroup, '', '--login-password', dest='loginPassword', help='Login password.')
+        self.addOptionToGroup(loginGroup, '', '--login-file', dest='loginFile', help='Login file, contains "<login username>|<login password>" pair. It can be specified using DM_LOGIN_FILE environment variable. This option cannot be used with --login-username and --login-password options.')
 
     def parseArgs(self, usage=None):
         DmRestCli.parseArgs(self, usage)
         self.loginUsername = self.options.loginUsername
         self.loginPassword = self.options.loginPassword
+        self.loginFile = self.options.loginFile
+        self.parseLoginFile()
         return (self.options, self.args)
 
     def getLoginUsername(self):
@@ -27,8 +31,26 @@ class DmRestSessionCli(DmRestCli):
     def getLoginPassword(self):
         return self.loginPassword
 
+    def getLoginFile(self):
+        if not self.loginFile:
+            configManager = ConfigurationManager.getInstance()
+            self.loginFile = configManager.getLoginFile()
+        return self.loginFile
+
+    def parseLoginFile(self):
+        if self.getLoginFile() and not self.getLoginUsername() and not self.getLoginPassword():
+            try:
+                # Assume form <username>|<password>
+                tokenList = open(self.loginFile).readline().split('|')
+                if len(tokenList) == 2:
+                    self.loginUsername = tokenList[0].strip()
+                    self.loginPassword = tokenList[1].strip()
+            except:
+                # Ignore invalid login file
+                pass
+
     def hasCredentials(self):
-        return (self.loginUsername != None and self.loginPassword != None)
+        return (self.getLoginUsername() != None and self.getLoginPassword() != None)
 
 #######################################################################
 # Testing