title: ODBC connection in R with Azure Active Directory Password authentication
body: <p>I'm trying to connect to SQL server from R and I'm using the Azure Active Directory Password authentication. My connection in R define as follow :</p>
  <pre><code>ch &lt;- odbc::dbConnect(odbc(),
                          DSN = &quot;myDSN&quot;,
                          Database = &quot;dbname&quot;,
                          Authentication=&quot;ActivedirectoryPassword&quot;,
                          UID = uid,
                          PWD = password
          )
  </code></pre>
  <p>This is failing by the following error :</p>
  <pre><code>Error: nanodbc/nanodbc.cpp:983: FA004: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Failed to authenticate the user 'my_user_id' in Active Directory (Authentication option is 'ActiveDirectoryPassword').
  Error code 0x800401F0; state 10
  CoInitialize has not been called. 
  </code></pre>
  <p>However, when I test the exact same setting on Microsoft SQL Server DSN Configuration, everything is fine and I'm able to connect successfully to the same database :
  <a href="https://i.stack.imgur.com/uvS1e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uvS1e.png" alt="enter image description here" /></a></p>
  <p>Any idea if I'm missing something here ?!</p>