Last active
June 9, 2021 16:15
-
-
Save gsmitheidw/a69645e7f0b275830fff6109206e8157 to your computer and use it in GitHub Desktop.
Testing MSIX container build (& vhd prep for potential app attach)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# This is a list of commands not a script, to be run line-by-line: | |
# ------------------------------------------------------------------- | |
#> | |
# Create self signed cert: | |
New-SelfSignedCertificate -Type Custom -Subject "CN=TUD" -KeyUsage DigitalSignature -KeyAlgorithm RSA -KeyLength 2048 -CertStoreLocation "cert:\LocalMachine\My" -FriendlyName "wvd" | |
$password = ConvertTo-SecureString -String "tGWu9tzQy#l0hr" -Force -AsPlainText | |
# note the fingerprint value for the key created in this: | |
gci cert:\LocalMachine\My | |
# create a working directory somewhere | |
mkdir c:\build | |
# Use this pfx generated in the build of the MSIX packaging app. | |
Export-PfxCertificate -cert "Cert:\LocalMachine\My\09905817EDF7CCD99C0A60B697C3740716042689" -FilePath c:\build\cert-msix.pfx -Password $password | |
# download & install "MSIX Packaging Tool" - next next next... browse to the pfx file created earlier for the cert and enter the same private key password. | |
# For timestampserver this can be used: http://timestamp.digicert.com/ | |
# create a vhd - 20MB is (just) enough for 7zip | |
New-VHD -SizeBytes 20MB -Path c:\build\7z19.vhd -Dynamic -Confirm:$false | |
$vhdObject = Mount-VHD c:\build\7z19.vhd -Passthru | |
$disk = Initialize-Disk -Passthru -Number $vhdObject.Number | |
$partition = New-Partition -AssignDriveLetter -UseMaximumSize -DiskNumber $disk.Number | |
Format-Volume -FileSystem NTFS -Confirm:$false -DriveLetter $partition.DriveLetter -Force | |
# Note: exact filename for msix will differ slightly | |
# msixmgr download & info here: https://docs.microsoft.com/en-us/azure/virtual-desktop/app-attach-msixmgr | |
# msixmgr needs to be in same folder. Name "apps" in next line is arbitrary but must be one level deep - potential gotcha: | |
.\msixmgr.exe -Unpack -packagePath 7zip_19.0.0.0_x64__z8v0tg2xw5f10.msix -destination "e:\apps" -applyacls | |
# Eject vhd and upload to Azure files for attaching to a host pool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment