Skip to content

Commit

Permalink
Reverted bootstrap to leverage Chocolatey for installing prerequisites
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Egil Ring <[email protected]>
  • Loading branch information
janegilring committed Nov 3, 2023
1 parent 01901e9 commit f9b5db2
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions azure_arc_servers_jumpstart/privatelink/artifacts/Bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,36 @@ New-Item -Path "C:\" -Name "Temp" -ItemType "directory" -Force
Start-Transcript -Path C:\Temp\LogonScript.log

#Install pre-requisites
workflow ClientTools_01
{
$chocolateyAppList = 'azure-cli,az.powershell'
InlineScript {
param (
[string]$chocolateyAppList
)
if ([string]::IsNullOrWhiteSpace($using:chocolateyAppList) -eq $false)
{
try{
choco config get cacheLocation
}catch{
Write-Output "Chocolatey not detected, trying to install now"
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
}
if ([string]::IsNullOrWhiteSpace($using:chocolateyAppList) -eq $false){
Write-Host "Chocolatey Apps Specified"

Write-Output "Installing Azure PowerShell Module"
$appsToInstall = $using:chocolateyAppList -split "," | foreach { "$($_.Trim())" }

Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name Az -Force

Write-Output "Installing Azure CLI"

$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindowsx64 -OutFile .\AzureCLI.msi
Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'
Remove-Item .\AzureCLI.msi
foreach ($app in $appsToInstall)
{
Write-Host "Installing $app"
& choco install $app /y -Force| Write-Output
}
}
}
}
ClientTools_01 | Format-Table

#Download and run Arc onboarding script
Invoke-WebRequest ("https://raw.githubusercontent.com/microsoft/azure_arc/main/azure_arc_servers_jumpstart/privatelink/artifacts/installArcAgent.ps1") -OutFile C:\Temp\installArcAgent.ps1
Expand Down Expand Up @@ -72,4 +90,4 @@ Get-ScheduledTask -TaskName ServerManager | Disable-ScheduledTask
# Clean up Bootstrap.log
Stop-Transcript
$logSuppress = Get-Content C:\Temp\LogonScript.log -Force | Where { $_ -notmatch "Host Application: powershell.exe" }
$logSuppress | Set-Content C:\Temp\LogonScript.log -Force
$logSuppress | Set-Content C:\Temp\LogonScript.log -Force

0 comments on commit f9b5db2

Please sign in to comment.