This guide details how to mount and Register Msix packages outside of Azure Virtual Desktop for testing App Attach deployments. The APIs that support App Attach are available on Windows 11 Enterprise and Windows 10 Enterprise. While these APIs can be used outside of Azure Virtual Desktop for testing purposes, there is no management interface for App Attach or MSIX App Attach outside of Azure Virtual Desktop.
Prerequisites for testing application packages include: a device running Windows 11 Enterprise or Windows 10 Enterprise; an application expanded from the MSIX format into an image usable with App Attach; the CimDiskImage PowerShell module installed if using a CimFS image; and a user account with local administrator rights on the test device. Note that this guide outlines the testing process outside of Azure Virtual Desktop, so an Azure Virtual Desktop deployment is not required. Microsoft does not support the CimDiskImage PowerShell module; if you encounter issues, you will need to submit an issue on the module’s GitHub repository.
The process for utilizing MSIX packages outside Azure Virtual Desktop involves four stages: Stage, Register, Deregister, and Destage. Stage and Destage are machine-level operations, while Register and Deregister are user-level operations. The commands used will vary depending on the PowerShell version and the disk image format (CimFS, VHDX, or VHD). All MSIX packages include a certificate. You will need to ensure the certificate for the MSIX package is trusted in your environment.
Before staging the MSIX package, prepare the machine by running specific commands depending on the PowerShell version. For PowerShell 6 and later, download and install the Windows Runtime Package, then run a command to activate Windows Runtime components within PowerShell. For PowerShell 5.1 and earlier, simply run a command to activate the Windows Runtime components.
Next, to stage the MSIX package, mount the disk image. For CimFS images, use the Mount-CimDiskImage
command. For VHDX or VHD images, use the Mount-DiskImage
command. Save the $deviceId
variable for the Destage step later.
After mounting, complete the staging process by retrieving application information, the full name of the MSIX package, creating an absolute URI for the manifest folder, and using the URI to stage the application package with the PackageManager API. Monitor the staging progress by checking the Status
property of the $stagingResult
variable.
To register the MSIX package, use the Add-AppxPackage
command with the path to the AppxManifest.xml file within the MSIX package folder. After registration, the application will be available in your session.
To deregister the MSIX package, retrieve the disk’s DeviceId
parameter and remove the package using the Remove-AppxPackage
command along with the $msixPackageFullName
variable.
Finally, destage the MSIX package by dismounting the disk image and ensuring the package is no longer registered for any users using the Remove-AppxPackage -AllUsers
command. Use the Dismount-CimDiskImage
command for CimFS images and Dismount-DiskImage
for VHDX or VHD images.
Scripts can be created to automate the Stage, Register, Deregister, and Destage phases at startup, logon, logoff, and shutdown. For offline devices, package licenses need to be installed using a PowerShell script that calls the MDM_EnterpriseModernAppManagement_StoreLicenses02_01
class in the WMI Bridge Provider.
Refer to the sample scripts and usage instructions on the GitHub repository. These scripts work with all PowerShell versions and disk image formats.