Private/Install-PreRequisites.ps1

function Restart-PowerShell {
    Start-Sleep -Seconds 5
    refreshenv
    $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") 
    Clear-Host
}

function Invoke-InstallPreRequisites {

    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    Register-PSRepository -Default -ErrorAction SilentlyContinue
    Install-PackageProvider -Name NuGet -Force -Scope CurrentUser
    Set-PSRepository -Name PSGallery -InstallationPolicy Trusted -ErrorAction SilentlyContinue

    if (!$env:ChocolateyInstall) {
        Write-Warning "The ChocolateyInstall environment variable was not found. `n Chocolatey is not detected as installed. Installing..."
        $message = "Installing Chocolatey ...."
        Write-Host $message
        
        Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
    }

    choco upgrade chocolatey -y
 
    $message = "Installing Git ...."
    Write-Host $message

    choco upgrade git.install -y

    $message = "Installing NodeJS ...."
    Write-Host $message

    choco upgrade nodejs-lts -y

    $message = "Installing Azure CLI ...."
    Write-Host $message
    choco upgrade azure-cli -y 

    $message = "Installing dotnet CLI ...."
    Write-Host $message

    choco upgrade dotnetcore -y

    ## Install Azure DevOps Extension
    $message = "Installing azure-devops extenstion"
    Write-Host $message

    az extension add --name azure-devops

    ## Restart PowerShell Environment to Enable Azure CLI
    Restart-PowerShell
}