title: Authentication in MongoDB is not working in Azure Container Instance when deploying with Azure File Share as mount volume
body: <p>I am deploying MongoDB container as Azure container instance in a group using Azure CLI YAML script. Here I am using a Azure file share as a mount volume, while using this mount volume the authentication is not enabled in MongoDB. Though without mount volume it is working fine. Here is my YAML script:</p>
  <pre><code>apiVersion: '2019-12-01'
  location: eastus
  name: api-service
  properties:
  containers:
   - name: mongo-db
   properties:
    image: serviceregistry.azurecr.io/apiservice_mongo-db:latest
    ports:
     - port: 27017
    environmentVariables:
     - name: MONGO_INITDB_DATABASE
       value: logsdb
     - name: MONGO_INITDB_ROOT_USERNAME
       value: root
     - name: MONGO_INITDB_ROOT_PASSWORD
      secureValue: mypass
    resources:
     requests:
      cpu: 1.0
      memoryInGB: 1.5
   volumeMounts:
    - mountPath: /data/mongodata
      name: mongofileshare
   command: ['mongod', '--dbpath', '/data/mongodata'] #if i comment this line works fine
   - name: log-api
    properties:
     environmentVariables: []
     image: serviceregistry.azurecr.io/apiservice_log-api:latest
     ports:
      - port: 3100
     resources:
      requests:
       cpu: 1.0
       memoryInGB: 1.5
   - name: mongo-express
     properties:
     image: mongo-express:latest
     ports:
      - port: 8081
     environmentVariables:
      - name: ME_CONFIG_MONGODB_SERVER
        value: 127.0.0.1
      - name: ME_CONFIG_MONGODB_PORT
        value: 27017
      - name: ME_CONFIG_MONGODB_ADMINUSERNAME
        value: root
      - name: ME_CONFIG_MONGODB_ADMINPASSWORD
        secureValue: mypass
      - name: ME_CONFIG_BASICAUTH_USERNAME
        value: admin
      - name: ME_CONFIG_BASICAUTH_PASSWORD
        secureValue: mypass
     resources:
      requests:
       cpu: 1.0
       memoryInGB: 1.5
   osType: Linux
   restartPolicy: OnFailure
   ipAddress:
    type: Public
   ports:
    - protocol: tcp
      port: 3100
    - protocol: tcp
      port: 8081
    - protocol: tcp
      port: 27017
   dnsNameLabel: serviceapidns
   volumes:
    - name: mongofileshare
      azureFile:
       sharename: mysharefile
       storageAccountName: myaccount
       storageAccountKey: mykey
   imageRegistryCredentials:
    server: serviceregistry.azurecr.io
    username: MyUserName
    password: MyPass
   tags: {}
   type: Microsoft.ContainerInstance/containerGroups
  </code></pre>
  <p>I got this:</p>
  <pre><code>msg&quot;:&quot;Authentication failed&quot;,&quot;attr&quot;:{&quot;mechanism&quot;:&quot;SCRAM-SHA-256&quot;,&quot;principalName&quot;:&quot;root&quot;,&quot;authenticationDatabase&quot;:&quot;admin&quot;,&quot;client&quot;:&quot;127.0.0.1:44566&quot;,&quot;result&quot;:&quot;UserNotFound: Could not find user &quot;root&quot; for db &quot;admin&quot;&quot;}}
  </code></pre>