Skip to content

Commit

Permalink
Update to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderSehr committed Jan 18, 2025
1 parent 04dbe04 commit d0eb73e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,19 @@ resource maintenanceAssignment_hciHost 'Microsoft.Maintenance/configurationAssig
// Install Host Roles //
// ====================//

// installs required modules
resource runCommand0 'Microsoft.Compute/virtualMachines/runCommands@2024-03-01' = {
parent: vm
location: location
name: 'runCommand0'
properties: {
source: {
script: loadTextContent('./scripts/hciHostStage0.ps1')
}
treatFailureAsDeploymentFailure: true
}
}

// installs roles and features required for Azure Stack HCI Host VM
resource runCommand1 'Microsoft.Compute/virtualMachines/runCommands@2024-03-01' = {
parent: vm
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

Function log {
Param (
[string]$message,
[string]$logPath = 'C:\temp\hciHostDeploy-0.log'
)

If (!(Test-Path -Path 'C:\temp')) {
New-Item -Path 'C:\temp' -ItemType Directory
}

Write-Host $message
Add-Content -Path $logPath -Value "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') [hciHostStage6] - $message"
}

$ErrorActionPreference = 'Stop'

If (!(Get-PackageProvider -Name 'NuGet' -ListAvailable -ErrorAction 'SilentlyContinue')) { Install-PackageProvider -Name NuGet -MinimumVersion '2.8.5.201' -Force }
If (!(Get-PSRepository -Name 'PSGallery' -ErrorAction 'SilentlyContinue')) { Register-PSRepository -Default }
Set-PSRepository -Name 'PSGallery' -InstallationPolicy 'Trusted'
foreach ($module in @(
'Az.Accounts',
'Az.Resources',
'WinInetProxy',
'AsHciADArtifactsPreCreationTool',
'AzsHCI.ARCinstaller')) {
if (-not (Get-Module -Name $module -ListAvailable)) {
log "Installing module [$module]" -Verbose
$null = Install-Module -Name $module -Force -AllowClobber -Scope 'CurrentUser' -Repository 'PSGallery' -Confirm:$false
}
}
Set-PSRepository -Name 'PSGallery' -InstallationPolicy 'Untrusted'
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ foreach ($module in @(
if (-not (Get-Module -Name $module -ListAvailable)) {
log "Installing module [$module]" -Verbose
$null = Install-Module -Name $module -Force -AllowClobber -Scope 'CurrentUser' -Repository 'PSGallery' -Confirm:$false
Import-Module $module -Force -Verbose
Import-Module $module -Force
log ("Installed versions of [$module]: [{0}]" -f ((Get-Module -Name $module -ListAvailable).Version -join ', '))
}
}
Expand Down

0 comments on commit d0eb73e

Please sign in to comment.