0

When I set up an Azure VM (Windows Server 12) I cannot connect from it to an Azure SQL Database because the ODBC driver ("SQL Server") is too old (-> "[Microsoft][ODBC SQL Server Driver][DBNETLIB]SSL Security error"). I hence download & install then the newer driver "ODBC Driver 13 for SQL Server" manually so that the connection works. Fine so far.

Problem: How can I install a new [ODBC] driver on a VM unattended, using a Powershell script, right a after the VM is created?

1 Answer 1

3

This is the PS command to install ODBC 13 on your VM :

$url = "https://download.microsoft.com/download/1/E/7/1E7B1181-3974-4B29-9A47-CC857B271AA2/English/X64/msodbcsql.msi"
$outpath = "c:/odbc.msi"

Invoke-WebRequest -Uri $url -OutFile $outpath

Start-Process -Filepath $outpath -ArgumentList "/qr IACCEPTMSODBCSQLLICENSETERMS=YES"

Save above as a .ps1 file .

Use this command to run command above on your Azure VMs :

$vm = Get-AzVM -Name <VM name> -ResourceGroupName <resource group name>

Invoke-AzVMRunCommand -VM $vm  -CommandId 'RunPowerShellScript' -ScriptPath "<install odbc ps1 file path>"

I have test on my win 2012 vm ,it works for me . Result : enter image description here enter image description here

1
  • Hi Stanley - This is just a TOP answer from you: Problem understood, transparent solution given, proof done! Thanks so much!
    – Woody Chan
    Nov 25, 2019 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.