Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Build and Run from Source

Elliot Huffman edited this page May 29, 2022 · 5 revisions

To build the project from source, all you need is Node.JS installed.
If you want to generate the EXE and Linux binaries too, then you will also need the PKG package installed globally.

Quick Links:


Prep the Files

  1. Clone/Download the project
git clone https://github.com/microsoft/Privileged-Security-Management.git

or using GitHub Desktop:
Screenshot of GitHub Desktop's clone repo dialog box with the project's git URL in one of the text fields.

  1. Install the latest LTS build of Node.JS: https://nodejs.org/en/download/
  2. (Optional) Install PKG to be able to generate EXE/Linux Bin files:
npm install -g pkg

Build the Server

Since the server and UI are built in separate folders, you can technically run the API server without a UI. Because of this, there are extra build steps to follow to build the entire project as you will need to build the Server and the UI separately.
You can build the server or the UI in any order.

  1. Change your working directory to the Server directory:
cd /Server
  1. Install the dependencies:
npm install
  1. Compile the servers files:
npm run build

Now you can run the server 😎
You can start the server by running:

npm start

Build the UI

The user interface is a standalone API client. The server doesn't technically need one to operate. The server has been configured to serve a UI from the bin folder next to the server core API files.

  1. Change your working directory to the User-Interface directory:
cd /User-Interface
  1. Install the UI's dependencies:
npm install
  1. Compile the UI files:
npm run build

(Optional) Build the Windows Installers

The Windows installers are built using the Advanced Installer tool from Caphyon.
Advanced Installer Logo

An Enterprise or higher license is required as custom dialogs are used to keep the MSI and EXE installers on brand. Since this is an open-source project, Caphyon has very generously granted us an Architect license to build our installers via Ci/CD with GitHub Actions.

To Build the EXE and MSI installers, you can run the below CLI command in advanced installer.
The EXE version needs to be built first as the EXE build process will delete any existing MSI as an MSI object is generated as part of the EXE build process and subsequently deleted for resource clean up reasons. So, by building the EXE first then the MSI, you will have both in the dist folder.

Before building the Installers, the raw Windows EXE needs to be generated from PKG as the Advanced Installer system is configured to package it up.

Note: The Advanced Installer executables are located here by default on a 64-Bit Windows computer:
C:\Program Files (x86)\Caphyon\Advanced Installer 19.5\bin\x86

  1. Set the working directory to the Server folder:
cd /Server
  1. Build the raw EXE:
npx pkg .
  1. Set the working directory to the Project's Root:
cd ..
  1. Build the EXE Installer:
AdvancedInstaller.com /build ".\Privileged Security Management.aip" -buildslist "EXE"
  1. Build the MSI Installer:
AdvancedInstaller.com /build ".\Privileged Security Management.aip" -buildslist "MSI"

Final Remarks

You are done!
The UI and the server's files have been compiled and are ready to operate.
Starting the server will serve the UI at the servers root. You can start the server by running the below command in the Server directory:

npm start

Don't forget to configure the environmental variables if you are running without a Managed Identity as you will need to authenticate via an App Registration.

Clone this wiki locally