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?