• From https://technet.microsoft.com/en-us/library/ms189128.aspx:

    When you are detaching or attaching a database, the Database Engine tries to impersonate the Windows account of the connection performing the operation to guarantee that the account has permission to access the database and log files. For mixed security accounts that use SQL Server logins, the impersonation might fail.

    What is likely happening is that your Windows user has permissions on that D drive path, but the service account for SQL Server does not.

    When you run the attach as your Windows authenticated login, SQL Server impersonates your Windows account, which has permissions.

    When you run the attach as your SQL authenticated login, it just runs using the service account, which likely doesn't have permissions on that D drive path.

    If you give the SQL Server service account permissions on that D drive folder and make sure you set it to replace permissions on the child objects so that the files' permissions also change, then you should be able to do it as the SQL authenticated user as well.

    Cheers!