title: Active Directory Password Connection Azure SQL Failure from Azure Automation
body: <p>I need to connect via Azure Automation to an Azure SQL Server using my Azure Active Directory Admin account that is set as the Azure SQL Server AZ AD Admin. </p>
  
  <p>I am able to connect to Azure SQL:</p>
  
  <ol>
  <li>Using SSMS with the Azure AD Admin Account</li>
  <li>Using the PowerShell ISE with the Azure AD Admin Account in a SQL ConnectionString</li>
  <li>Using Azure Automation with the Azure SQL Admin account (the one created when a new Azure SQL Server is created) in a SQL ConnectionString </li>
  </ol>
  
  <p>However, when attempting to connect to Azure SQL in Azure Automation using the Active Directory Admin account in Azure Automation in a SQL ConnectionString, I get the following error:</p>
  
  <blockquote>
    <p>New-Object : Exception calling ".ctor" with "1" argument(s): "Keyword
    not supported: 'authentication'."</p>
  </blockquote>
  
  <p>Here is my connection attempt:</p>
  
  <pre><code>$server = "tcp:myazuresql.database.windows.net,1433"
  $database = "TestDB"
  $adminName = "test@mytest.onmicrosoft.com"
  $adminPassword = "test1234"
  
  $connectionString = "Server=$server;Database=$database;User ID=$adminName;Password=$adminPassword;authentication=Active Directory Password;"
  $connection = New-Object -TypeName System.Data.SqlClient.SqlConnection($connectionString)
  </code></pre>
  
  <p>Any ideas on why I can connect via PowerShell ISE and SSMS but not Azure Automation with the Azure Active Directory Admin? I can also connect via Azure Automation and the Azure SQL Admin account (the default admin account you create with Azure SQL).</p>
  
  <p>The only way I can't connect is when using the Azure Active Directory Admin tied to Azure SQL when using Azure Automation.</p>