I have setup an Azure VM that is linked to my Managed SQL, but I need to install SSMS and ODBC drivers but the machine tells me nothing can be installed.
Also, I did the install from this (https://docs.microsoft.com/en-us/azure/azure-sql/managed-instance/connect-vm-instance-configure) and it was meant to do the SSMS install as part of the process
Do these need to be done via PowerShell scripts? And if so, does anyone have one spare for this or another idea?
Thanks
CodePudding user response:
It can be done directly, install from Browser using link SSMS and ODBC and can also be done with PowerShell Script
PowerShell Script for Downlod SSMS
#Set file and folder path for SSMS installer .exe
$folderpath="c:\windows\temp"
$filepath="$folderpath\SSMS-Setup-ENU.exe"
#If SSMS not present, download
if (!(Test-Path $filepath)){
write-host "Downloading SQL Server 2016 SSMS..."
$URL = "https://download.microsoft.com/download/3/1/D/31D734E0-BFE8-4C33-A9DE-2392808ADEE6/SSMS-Setup-ENU.exe"
$clnt = New-Object System.Net.WebClient
$clnt.DownloadFile($url,$filepath)
Write-Host "SSMS installer download complete" -ForegroundColor Green
}
else {
write-host "Located the SQL SSMS Installer binaries, moving on to install..."
}
# start the SSMS installer
write-host "Beginning SSMS 2016 install..." -nonewline
$Parms = " /Install /Quiet /Norestart /Logs log.txt"
$Prms = $Parms.Split(" ")
& "$filepath" $Prms | Out-Null
Write-Host "SSMS installation complete" -ForegroundColor Green
PowerShell Script for Downlod ODBC Driver.
$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"
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 or SSMS file path>"
Reference : Azure VM: Update Microsoft ODBC Driver via Powershell https://gist.github.com/justinsoliz/34324700ea93c7b77b4ac3e132584de7