Search This Blog

Thursday, February 18, 2021

MSIX Modern Packaging – Part 2

clip_image001

Introduction

In the last “MSIX Modern Packaging – Part 1” I showed you how to get a virtual environment to start creating MSIX.

For MSIX to work we need to sign our packages, and this is typically where we say "ok, I give up". At least back in the days when I heard about certificates I got tired right there. Don't be, it is cool and it is easy once you get the pattern.

In this chapter I will show you how to get a certificate (PFX) ready to use for packaging. How cool is that. Just follow the steps and you are soon to begin packaging your very own packages.

Requirements

  • Hyper-V
  • PKI

Setup your PKI

Let’s start by creating a new template for your endpoint

clip_image003

 

Right click and Manage your certificate templates

clip_image005

 

Choose Code Signing and Duplicate Template

clip_image007

 

On Compatibility choose the minimum compatible you need.

clip_image009

 

Go to security tab and add Domain Computers.

Tick Enroll

clip_image011

 

On the General tab give it name MSIX Template

Template name: MSIX_Template

Validity period: whatever your security requires.

clip_image013

 

Go to Request Handling and allow private key to be exported

clip_image015

 

Go to Extensions

Choose Basic Constraints

Edit

Enable this extension

clip_image017

 

Go to Subject Name

Choose Supply in the request (This will make sure we can insert a common name when we request the certificate)

Ok

clip_image019

 

Now we will make the template available for the client devices on the domain

clip_image021

 

Find MSIX Template

Click OK

clip_image023

Now everything we need, to be able to sign our packages, is ready.

Because we build the certificate on a root authority that we trust, no other certificates need to be installed into our environment for our MSIX packages to work.

Export PFX for MSIX packaging

Let’s start on a client that is in our environment.

Go to the start menu and open a CMD with elevated permissions

clip_image025

 

Click Yes

clip_image027

 

Type “MMC”

clip_image029

 

Choose File and “Add/Remove Snap-in”

clip_image031

 

Choose Certificates and click Add>

clip_image033

 

Choose My user account

Finish

ok

clip_image035

 

Choose Personal – Certificates

All Tasks -> Request New Certificate..

clip_image037

 

Next

clip_image039

 

Next

clip_image041

 

Mark the template and click the blue text

clip_image043

 

Choose “Common name”

Value: Mindlab (type your own)

Add

ok

clip_image045

 

Enroll

clip_image047

 

Finish

clip_image049

 

Export the certificate

clip_image051

 

Next

clip_image053

 

Yes, export the private key

Next

clip_image055

 

Next

clip_image057

 

Set password. (You need to remember it when we create MSIX package with it, we will be asked for the pw)

Encryption AES256-SHA256

Next

clip_image059

 

Browse

clip_image061

 

Save it to a central location (I prefer together with source files you need to package)

clip_image063

 

Next

clip_image065

 

Finish

clip_image067

 

OK

clip_image069

Save the certificate to a central location. Could be wise to gather all your source and stuff you need for packaging.

 

You can delete the cert from your store now. As it is not needed.

clip_image071

 

Now that we package apps with that certificate, we will see this sign when executing it on a device trusting our CA:
clip_image073

 

And on a device that are not trusting our CA, you don’t get to install this package.

clip_image075

Summary

By now we know how to build a virtual environment for our app automation through MSIX.

We also know how to create a template in our PKI and export that certificate for use when we develop MSIX packages. This is the foundation of app automation.

Stay tuned for part 3 where we will start developing a simple package: Notepad++

4 comments:

  1. this is so great.

    my msix enviroment doesnt have Certification Authority. any idea why that would be

    ReplyDelete
    Replies
    1. Yeah I believe you need to setup a PKI environment first :) I have a complete PKI environment attached to a domain where this guide builds upon.

      Delete