I am attempting to use an Azure Automation Runbook to run a query against an Azure SQL database using Azure AD credentials:

```bsh
$cred = Get-AutomationPSCredential -Name 'SqlAdminUser'
$Username = $cred.UserName
$Password = $cred.GetNetworkCredential().Password
$Server = 'server.database.windows.net'
$Port = 1433
$cxnString = "Server=tcp:$Server,$Port;Database=$Database;Authentication=Active Directory Password;UID=$UserName;PWD=$Password;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"

$cxn = New-Object System.Data.SqlClient.SqlConnection($cxnString)
$cxn.Open()
$cmd = New-Object System.Data.SqlClient.SqlCommand($query, $cxn)
$cmd.CommandTimeout = 120
$cmd.ExecuteNonQuery()
$cxn.Close()

```

and I get the following error:

> 
> Keyword not supported: 'authentication'.
> 
> 
> 

So it seems like Azure Automation doesn't have the [ADAL SQL library](https://www.microsoft.com/en-us/download/details.aspx?id=48742) installed? Is there any easy way to work around this (and still use an Azure AD account to connect)?

I used [this](https://gallery.technet.microsoft.com/scriptcenter/How-to-use-a-SQL-Command-be77f9d2#content) example as a starting point.