Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arcbox 3.0 #2

Merged
merged 22 commits into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
25a881e
Added initial structure for Pester tests
janegilring Dec 26, 2023
bd5b14c
Added test results to wallpaper using BGInfo
janegilring Dec 26, 2023
6305be3
Added Convert-JSImageToBitMap (for BGInfo to work)
janegilring Dec 26, 2023
dea4b02
Bugfix - path
janegilring Dec 26, 2023
b3bc4d2
Removed undesired prerelease-flag
janegilring Dec 26, 2023
fecc647
Added Windows Terminal
janegilring Dec 26, 2023
37eafb4
Windows Terminal needs to be installed per user, while WinGet Configu…
janegilring Dec 27, 2023
f8e0455
Configured Windows Terminal as the default terminal application
janegilring Dec 27, 2023
e0e3da8
Merge pull request #2336 from janegilring/arcbox_3.0_task_915_tests
janegilring Dec 27, 2023
1984065
Leveraged Foreach-Object -Parallel where applicable
janegilring Dec 27, 2023
cb788ce
Enabled Azure CLI use_dynamic_install for extensions
janegilring Dec 27, 2023
f82fd1e
Added Connect-AzAccount inside ForEach-Object -Parallel
janegilring Dec 27, 2023
c68fd37
Replace 7z with Compress-Archive. Leverage env-variable for temp-folder.
janegilring Dec 29, 2023
25b8553
Moved Creating deployment logs bundle at the end
janegilring Dec 29, 2023
c6c8688
Replace System.IO.File]::Exists with Test-Path
janegilring Dec 29, 2023
c9066cb
Replace System.IO.File Exists with Test-Path
janegilring Dec 29, 2023
c43bdab
Bugfix - syntax
janegilring Dec 29, 2023
6087197
Bugfix - temp dir reference
janegilring Dec 29, 2023
bcbfbcb
Added workaround to avoid "file is being used by another process" err…
janegilring Dec 29, 2023
a38fa49
SQL server BPA optimization to avoid Cannot index into a null array i…
janegilring Dec 29, 2023
2fdbe35
Added Az PowerShell Login
janegilring Dec 29, 2023
b1b3c21
Merge pull request #2337 from janegilring/arcbox_3.0_task_919_optimiz…
janegilring Dec 29, 2023
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
197 changes: 150 additions & 47 deletions azure_jumpstart_arcbox/artifacts/ArcServersLogonScript.ps1

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions azure_jumpstart_arcbox/artifacts/Bootstrap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ $Env:ArcBoxKVDir = "$Env:ArcBoxDir\KeyVault"
$Env:ArcBoxGitOpsDir = "$Env:ArcBoxDir\GitOps"
$Env:ArcBoxIconDir = "$Env:ArcBoxDir\Icons"
$Env:agentScript = "$Env:ArcBoxDir\agentScript"
$Env:ArcBoxTestsDir = "$Env:ArcBoxDir\Tests"
$Env:ToolsDir = "C:\Tools"
$Env:tempDir = "C:\Temp"
$Env:ArcBoxDataOpsDir = "$Env:ArcBoxDir\DataOps"
Expand All @@ -96,6 +97,7 @@ New-Item -Path $Env:ToolsDir -ItemType Directory -Force
New-Item -Path $Env:tempDir -ItemType directory -Force
New-Item -Path $Env:agentScript -ItemType directory -Force
New-Item -Path $Env:ArcBoxDataOpsDir -ItemType directory -Force
New-Item -Path $Env:ArcBoxTestsDir -ItemType directory -Force

Start-Transcript -Path $Env:ArcBoxLogsDir\Bootstrap.log

Expand Down Expand Up @@ -167,6 +169,8 @@ Invoke-WebRequest ($templateBaseUrl + "artifacts/dsc/common.dsc.yml") -OutFile $
Invoke-WebRequest ($templateBaseUrl + "artifacts/dsc/dataops.dsc.yml") -OutFile $Env:ArcBoxDscDir\dataops.dsc.yml
Invoke-WebRequest ($templateBaseUrl + "artifacts/dsc/devops.dsc.yml") -OutFile $Env:ArcBoxDscDir\devops.dsc.yml
Invoke-WebRequest ($templateBaseUrl + "artifacts/dsc/itpro.dsc.yml") -OutFile $Env:ArcBoxDscDir\itpro.dsc.yml
Invoke-WebRequest ($templateBaseUrl + "artifacts/tests/arcbox-bginfo.bgi") -OutFile $Env:ArcBoxTestsDir\arcbox-bginfo.bgi
Invoke-WebRequest ($templateBaseUrl + "artifacts/tests/common.tests.ps1") -OutFile $Env:ArcBoxTestsDir\common.tests.ps1
Invoke-WebRequest ($templateBaseUrl + "artifacts/WinGet.ps1") -OutFile $Env:ArcBoxDir\WinGet.ps1
Invoke-WebRequest ($templateBaseUrl + "../tests/GHActionDeploy.ps1") -OutFile "$Env:ArcBoxDir\GHActionDeploy.ps1"
Invoke-WebRequest ($templateBaseUrl + "../tests/OpenSSHDeploy.ps1") -OutFile "$Env:ArcBoxDir\OpenSSHDeploy.ps1"
Expand Down Expand Up @@ -200,6 +204,7 @@ if ($flavor -eq "Full" -Or $flavor -eq "ITPro") {
Invoke-WebRequest ($templateBaseUrl + "artifacts/ArcSQLManualOnboarding.ps1") -OutFile $Env:ArcBoxDir\ArcSQLManualOnboarding.ps1
Invoke-WebRequest ($templateBaseUrl + "artifacts/installArcAgentSQLUser.ps1") -OutFile $Env:ArcBoxDir\installArcAgentSQLUser.ps1
Invoke-WebRequest ($templateBaseUrl + "artifacts/testDefenderForSQL.ps1") -OutFile $Env:ArcBoxDir\testDefenderForSQL.ps1
Invoke-WebRequest ($templateBaseUrl + "artifacts/tests/itpro.tests.ps1") -OutFile $Env:ArcBoxTestsDir\itpro.tests.ps1
}

# DevOps
Expand All @@ -215,6 +220,7 @@ if ($flavor -eq "DevOps") {
Invoke-WebRequest ($templateBaseUrl + "artifacts/gitops_scripts/ResetBookstore.ps1") -OutFile $Env:ArcBoxGitOpsDir\ResetBookstore.ps1
Invoke-WebRequest ($templateBaseUrl + "artifacts/icons/arc.ico") -OutFile $Env:ArcBoxIconDir\arc.ico
Invoke-WebRequest ($templateBaseUrl + "artifacts/icons/bookstore.ico") -OutFile $Env:ArcBoxIconDir\bookstore.ico
Invoke-WebRequest ($templateBaseUrl + "artifacts/tests/devops.tests.ps1") -OutFile $Env:ArcBoxTestsDir\devops.tests.ps1
}

# DataOps
Expand All @@ -240,6 +246,7 @@ if ($flavor -eq "DataOps") {
Invoke-WebRequest ($templateBaseUrl + "artifacts/installArcAgent.ps1") -OutFile $Env:ArcBoxDir\agentScript\installArcAgent.ps1
Invoke-WebRequest ($templateBaseUrl + "artifacts/installArcAgentSQLSP.ps1") -OutFile $Env:ArcBoxDir\agentScript\installArcAgentSQLSP.ps1
Invoke-WebRequest ($templateBaseUrl + "artifacts/testDefenderForSQL.ps1") -OutFile $Env:ArcBoxDir\testDefenderForSQL.ps1
Invoke-WebRequest ($templateBaseUrl + "artifacts/tests/dataops.tests.ps1") -OutFile $Env:ArcBoxTestsDir\dataops.tests.ps1
}

# Full
Expand Down
6 changes: 6 additions & 0 deletions azure_jumpstart_arcbox/artifacts/WinGet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ Start-Transcript -Path $logFilePath -Force -ErrorAction SilentlyContinue
Install-PSResource -Name Microsoft.WinGet.DSC -Scope AllUsers -Quiet -AcceptLicense -TrustRepository -Prerelease

# Install DSC resources required for ArcBox
Install-PSResource -Name DSCR_Font -Scope AllUsers -Quiet -AcceptLicense -TrustRepository
Install-PSResource -Name HyperVDsc -Scope AllUsers -Quiet -AcceptLicense -TrustRepository -Prerelease

# Install WinGet CLI
$null = Repair-WinGetPackageManager -AllUsers

Write-Header 'Installing WinGet packages and DSC configurations'
$winget = Join-Path -Path $env:LOCALAPPDATA -ChildPath Microsoft\WindowsApps\winget.exe

# Windows Terminal needs to be installed per user, while WinGet Configuration runs as SYSTEM. Hence, this package is installed in the logon script.
& $winget install Microsoft.WindowsTerminal --version 1.18.3181.0 -s winget

# Apply WinGet Configuration files
& $winget configure --file C:\ArcBox\DSC\common.dsc.yml --accept-configuration-agreements --disable-interactivity

switch ($env:flavor) {
Expand Down
18 changes: 7 additions & 11 deletions azure_jumpstart_arcbox/artifacts/dsc/common.dsc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,90 +6,86 @@ properties:
id: git
directives:
description: Install Git
allowPrerelease: true
settings:
id: Git.Git
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: vscode
directives:
description: Install Visual Studio Code
allowPrerelease: true
settings:
id: Microsoft.VisualStudioCode
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: AzureCLI
directives:
description: Install Azure CLI
allowPrerelease: true
settings:
id: Microsoft.AzureCLI
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: PowerShell7
directives:
description: Install PowerShell 7
allowPrerelease: true
settings:
id: Microsoft.PowerShell
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: kubectl
directives:
description: Install kubectl
allowPrerelease: true
settings:
id: Kubernetes.kubectl
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: edge
directives:
description: Install Microsoft Edge
allowPrerelease: true
settings:
id: Microsoft.Edge
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: azcopy
directives:
description: Install azcopy
allowPrerelease: true
settings:
id: Microsoft.Azure.AZCopy.10
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: DotNetSDK7
directives:
description: Install Microsoft DotNet SDK 7
allowPrerelease: true
settings:
id: Microsoft.DotNet.SDK.7
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: helm
directives:
description: Install Helm
allowPrerelease: true
settings:
id: Helm.Helm
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: Microsoft.Sysinternals.BGInfo
directives:
description: Install Sysinternals BGInfo
allowPrerelease: true
settings:
id: Microsoft.Sysinternals.BGInfo
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: OpenSSL
directives:
description: Install OpenSSL
allowPrerelease: true
settings:
id: FireDaemon.OpenSSL
source: winget
- resource: DSCR_Font/cFont
id: CascadiaMono
directives:
description: Install font CascadiaMono
settings:
FontName: Cascadia Mono
FontFile: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.18.3181.0_x64__8wekyb3d8bbwe\CascadiaMono.ttf
- resource: PSDscResources/WindowsFeature
id: Hyper-V
directives:
Expand Down
6 changes: 0 additions & 6 deletions azure_jumpstart_arcbox/artifacts/dsc/dataops.dsc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,41 @@ properties:
id: kubectl
directives:
description: Install kubectl
allowPrerelease: true
settings:
id: Kubernetes.kubectl
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: kubectx
directives:
description: Install kubectx
allowPrerelease: true
settings:
id: ahmetb.kubectx
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: DotNetSDK7
directives:
description: Install Microsoft DotNet SDK 7
allowPrerelease: true
settings:
id: Microsoft.DotNet.SDK.7
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: SQLServerManagementStudio
directives:
description: Install Microsoft SQL Server Management Studio
allowPrerelease: true
settings:
id: Microsoft.SQLServerManagementStudio
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: Microsoft.Azure.DataCLI
directives:
description: Install Microsoft Azure Data CLI
allowPrerelease: true
settings:
id: Microsoft.Azure.DataCLI
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: Microsoft.AzureDataStudio
directives:
description: Install Microsoft Azure Data Studio
allowPrerelease: true
settings:
id: Microsoft.AzureDataStudio
source: winget
Expand Down
4 changes: 0 additions & 4 deletions azure_jumpstart_arcbox/artifacts/dsc/devops.dsc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,27 @@ properties:
id: kubectl
directives:
description: Install kubectl
allowPrerelease: true
settings:
id: Kubernetes.kubectl
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: kubectx
directives:
description: Install kubectx
allowPrerelease: true
settings:
id: ahmetb.kubectx
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: DotNetSDK7
directives:
description: Install Microsoft DotNet SDK 7
allowPrerelease: true
settings:
id: Microsoft.DotNet.SDK.7
source: winget
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: helm
directives:
description: Install Helm
allowPrerelease: true
settings:
id: Helm.Helm
source: winget
Expand Down
1 change: 0 additions & 1 deletion azure_jumpstart_arcbox/artifacts/dsc/itpro.dsc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ properties:
id: terraform
directives:
description: Install Terraform
allowPrerelease: true
settings:
id: Hashicorp.Terraform
source: winget
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'Azure.Arc.Jumpstart.Common.psm1'

# Version number of this module.
ModuleVersion = '0.0.1'
ModuleVersion = '0.0.4'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -69,7 +69,7 @@ Description = 'Common functions for Azure Arc Jumpstart'
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Set-JSDesktopBackground'
FunctionsToExport = 'Set-JSDesktopBackground','Convert-JSImageToBitMap'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = ''
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function Convert-JSImageToBitMap {
param (
$SourceFilePath,
$DestinationFilePath
)
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
$file = Get-Item $SourceFilePath
$convertfile = new-object System.Drawing.Bitmap($file.Fullname)
$convertfile.Save($DestinationFilePath, "bmp")
}
Binary file not shown.
15 changes: 15 additions & 0 deletions azure_jumpstart_arcbox/artifacts/tests/common.tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
BeforeDiscovery {
$spnpassword = ConvertTo-SecureString $env:spnClientSecret -AsPlainText -Force
$spncredential = New-Object System.Management.Automation.PSCredential ($env:spnClientId, $spnpassword)

$null = Connect-AzAccount -ServicePrincipal -Credential $spncredential -Tenant $env:spntenantId -Subscription $env:subscriptionId
}

Describe "ArcBox resource group" {
BeforeAll {
$ResourceGroupName = $env:resourceGroup
}
It "should have 30 resources or more" {
(Get-AzResource -ResourceGroupName $ResourceGroupName).count | Should -BeGreaterOrEqual 30
}
}
Empty file.
Empty file.
33 changes: 33 additions & 0 deletions azure_jumpstart_arcbox/artifacts/tests/itpro.tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

BeforeDiscovery {
$VMs = @("ArcBox-SQL", "ArcBox-Ubuntu-01", "ArcBox-Ubuntu-02","ArcBox-Win2K19","ArcBox-Win2K22")

$spnpassword = ConvertTo-SecureString $env:spnClientSecret -AsPlainText -Force
$spncredential = New-Object System.Management.Automation.PSCredential ($env:spnClientId, $spnpassword)

$null = Connect-AzAccount -ServicePrincipal -Credential $spncredential -Tenant $env:spntenantId -Subscription $env:subscriptionId
}

# Assert that the Hyper-V virtual machines in $VMs exists, are running and connected as Azure Arc-enabled servers

Describe "<vm>" -ForEach $VMs {
BeforeAll {
$vm = $_
}
It "VM exists" {
$vmobject = Get-VM -Name $vm
$vmobject | Should -Not -BeNullOrEmpty
}
It "VM is running" {
$vmobject = Get-VM -Name $vm
$vmobject.State | Should -Be "Running"
}
It "Azure Arc Connected Machine exists" {
$connectedMachine = Get-AzConnectedMachine -Name $vm -ResourceGroupName $env:resourceGroup -SubscriptionId $env:subscriptionId
$connectedMachine | Should -Not -BeNullOrEmpty
}
It "Azure Arc Connected Machine is connected" {
$connectedMachine = Get-AzConnectedMachine -Name $vm -ResourceGroupName $env:resourceGroup -SubscriptionId $env:subscriptionId
$connectedMachine.Status | Should -Be "Connected"
}
}