2

I need to use the adalsql.dll in Azure Automation so I can connect to Azure SQL via the Active Directory Password Authentication mode. See this post for details: Active Directory Password Connection Azure SQL Failure from Azure Automation

Downloading this MSI extracts the adalsql.dll to C:\Windows\System32: https://www.microsoft.com/en-us/download/details.aspx?id=48742

Per research and the advice given, creating a Azure Automation Module seems to be the way to go. However, I have not found guidance on how to create a module when I just need to add the DLL.

I created the following directory structure (which I end up zipping for upload):

Microsoft.ADAL.SQL
     Microsoft.ADAL.SQL.psd1 (Manifest)
     Microsoft.ADAL.SQL.psm1 (actual PowerShell to load the dll)
     adalsql.dll 

In my psm1 file I am using the following:

Add-Type -Path "C:\Modules\User\Microsoft.ADAL.SQL\adalsql.dll"

I am able to import this to Azure Automation and it shows as available (with files in the 'C:\Modules\User\Microsoft.ADAL.SQL' directory, but when I run my Runbook, it fails with the same message as before:

New-Object : Exception calling ".ctor" with "1" argument(s): "Keyword not supported: 'authentication'."

If add the Add-Type line from above in my Runbook, it also generates the error of:

Add-Type : Could not load file or assembly 'file:///C:\Modules\User\Microsoft.ADAL.SQL\adalsql.dll' or one of its dependencies. The module was expected to contain an assembly manifest.

Do I need to adjust my PowerShell to load the dll? If so, how?

Shui shengbao
  • 18,746
  • 3
  • 27
  • 45
Kode
  • 3,073
  • 18
  • 74
  • 140
  • There is a similar [feedback](https://feedback.azure.com/forums/246290-automation/suggestions/18562750-add-support-for-adal-sql-library) with you. I had vote up it. – Shui shengbao Jul 18 '17 at 01:49

1 Answers1

2

Based on my knowledge, even you import the dll to Azure automation account, it is not a PowerShell command. You also could not use the dll.

I suggest you could give a feedback to Azure. It is should be supported by Azure.

Shui shengbao
  • 18,746
  • 3
  • 27
  • 45