Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ The upload script signs in to Azure CLI with your Microsoft Entra account, then

## Requirements

- **AzCopy** — Install from <https://learn.microsoft.com/en-us/azure/storage/common/storage-use-AzCopy-v10>, or install and add it to the PATH by running:
- **AzCopy** — Install from <https://learn.microsoft.com/en-us/azure/storage/common/storage-use-AzCopy-v10>

- **Azure CLI** — Install from <https://aka.ms/installazurecliwindows>

or install both tools by running this script which uses `winget` to add the tools to your environment:

```powershell
.\install_azcopy.bat
.\install_tools.bat
```

- **Azure CLI** — Install from <https://aka.ms/installazurecliwindows>

## Usage

From this directory, run the script with the zip created in `bso_process`. Use the Microsoft Entra tenant ID associated with the storage account, not the subscription ID:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
REM This batch file runs the PowerShell AzCopy install script with execution policy bypass
REM This batch file runs the PowerShell tools install script with execution policy bypass
REM Users can simply run this file without needing to unblock or configure anything

powershell -ExecutionPolicy Bypass -NoProfile -File "%~dp0install_azcopy.ps1" %*
powershell -ExecutionPolicy Bypass -NoProfile -File "%~dp0install_tools.ps1" %*
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#Requires -Version 5.1
<#
.SYNOPSIS
Ensures winget, Azure CLI and AzCopy are installed, pinned to known-good versions.
#>

$ErrorActionPreference = 'Stop'

# Pinned versions so tool behaviour stays stable over time.
$AzureCliVersion = '2.90.0'
$AzCopyVersion = '10.32.8'

function Test-CommandExists {
param([Parameter(Mandatory)][string]$Name)
return [bool](Get-Command -Name $Name -ErrorAction SilentlyContinue)
}

function Install-Winget {
Write-Host 'winget not found. Attempting to install the App Installer (winget)...'

# winget ships with the Microsoft.DesktopAppInstaller package on Windows 10/11.
try {
$progressPreference = 'SilentlyContinue'
$tempInstaller = Join-Path $env:TEMP 'Microsoft.DesktopAppInstaller.msixbundle'
$downloadUrl = 'https://aka.ms/getwinget'

Write-Host "Downloading App Installer from $downloadUrl ..."
Invoke-WebRequest -Uri $downloadUrl -OutFile $tempInstaller -UseBasicParsing

Write-Host 'Registering App Installer package...'
Add-AppxPackage -Path $tempInstaller

Remove-Item -Path $tempInstaller -Force -ErrorAction SilentlyContinue
}
catch {
throw "Failed to install winget automatically. Install 'App Installer' from the Microsoft Store, then re-run this script. Details: $($_.Exception.Message)"
}

if (-not (Test-CommandExists -Name 'winget')) {
throw "winget is still not available after installation. Restart the shell (or the machine) and re-run this script."
}

Write-Host 'winget installed successfully.'
}

function Install-WingetPackage {
param(
[Parameter(Mandatory)][string]$DisplayName,
[Parameter(Mandatory)][string]$Id,
[Parameter(Mandatory)][string]$Version
)

$installed = winget list --exact --id $Id 2>$null | Select-String -SimpleMatch $Id
if ($installed) {
Write-Host "$DisplayName is already installed. Skipping."
return
}

Write-Host "Installing $DisplayName ($Id) version $Version ..."
winget install --exact --id $Id --version $Version `
--accept-package-agreements --accept-source-agreements

if ($LASTEXITCODE -ne 0) {
throw "Failed to install $DisplayName ($Id) version $Version. winget exit code: $LASTEXITCODE"
}

Write-Host "$DisplayName installed successfully."
}

# 1. Ensure winget is available.
if (-not (Test-CommandExists -Name 'winget')) {
Install-Winget
}
else {
Write-Host 'winget is already installed.'
}

# 2. Ensure Azure CLI is installed (pinned version).
Install-WingetPackage -DisplayName 'Azure CLI' -Id 'Microsoft.AzureCLI' -Version $AzureCliVersion

# 3. Ensure AzCopy is installed (pinned version).
Install-WingetPackage -DisplayName 'AzCopy' -Id 'Microsoft.Azure.AZCopy.10' -Version $AzCopyVersion

Write-Host 'All tools are installed.'
Loading