All posts by Jos

The importance of source OS when creating CIM images

When creating a CIM image for MSIX app attach, make sure that you’re using a lower or equal OS version than your target OS in e.g. Azure Virtual Desktop. If you use Windows 11 to create a CIM file and try to mount this on Windows 10, the result will be one of the following.

Azure Portal:

ActivityId: 1ef4d1ad-e4af-42d1-b6fa-139c45775efb Error: The MSIX Application metadata expand request failed on all Session Hosts that it was sent to. Session Host: xxxx1, Error: Native error when mounting CIM, HResult -2147024809, ErrorCode 87.. (Code: 400)

Using the CimDiskImage PS module:

Mount-CimDiskimage : Mounting xxxxx.cim to volume failed with Error:'The operation completed successfully Errorcode:0'
Mount-CimDiskimage : Mounting xxxx.cim to volume failed with Error:'Too many posts were made to a semaphore ErrorCode:298'

The mysterious X-MS-Forest header

When working with the API, I noticed that the MS portal uses an X-MS-Forest header.

At first, ignoring this went fine as doing GET calls to this api didn’t seem to require it. But, of course the moment I wanted more, it suddenly WAS required (PUT/POST).

The question was; how does the portal determine the value for this header and how do we replicate that? Well, that wasn’t difficult: apparently a call to suffices and returns the value for the X-MS-Forest header for the tenant identified in your token. Example:

    $headers = Get-GraphToken -tenantid $tenantId -scope ""
    #get the correct forest
    $tenantInfo = Invoke-RestMethod -Method GET -uri "" -UseBasicParsing -ContentType "application/json" -Headers $headers
    #add the X-MS-Forest header (required) for subsequent calls
    $headers["X-MS-Forest"] = $tenantInfo.serviceDiscovery.Headers.'X-MS-Forest'

Adding a font to an MSIX

My friends at Advanced Installer have an excellent article (actually the only authority on the subject) describing how to add a font to an MSIX.

However, I kept getting an invalid manifest 0x80080204 error when trying to save the manifest after adding the extension section while creating an MSIX for Visual Studio Code (which needs a specific font or icons won’t show).

I then noticed there was no xmlns link at the top of the package for uap4 🙂

Replace the following in your manifest:

<Package xmlns="" xmlns:uap="" xmlns:uap2="" xmlns:uap3="" xmlns:uap10="" xmlns:rescap="" IgnorableNamespaces="uap uap2 uap3 uap10 rescap">

with this (or just add uap4):

<Package xmlns="" xmlns:uap="" xmlns:uap2="" xmlns:uap3="" xmlns:uap4="" xmlns:uap10="" xmlns:rescap="" IgnorableNamespaces="uap uap2 uap3 uap4 uap10 rescap">

And it should work 🙂