Skip to content

Instantly share code, notes, and snippets.

View jcoehoorn's full-sized avatar

jcoehoorn

  • York University
  • York NE
View GitHub Profile
@jcoehoorn
jcoehoorn / PfxToApacheCertsAndKey.ps1
Last active October 3, 2025 14:08
Create Linux Apache certs/key from a password protected Windows pfx with only Powershell 5 (no openssl or .Net Core)
# This may need to run as administrator.
<#
The idea here is avoiding tools that cannot be assumed to be available,
especially tools that are not serviced/patched **as a matter of course.**
For example, this could be much simplier with OpenSSL. The two functions below, along with a couple dozen lines that use
them, would then reduce to a single openssl call, with maybe a handful of lines of extra work around making the call.
However, the point of this process is improving automation.
OpenSSL, particularly, needs regular service updates/patches to avoid publishing certificates that may continue
to have vulnerabilities over time. Adding openssl here in a way that is not serviced as a matter of course
#Copyright 2015 Joel Coehoorn.
# This script is provided under the CC BY 2.0 license. https://creativecommons.org/licenses/by/2.0/
#Acknowledgements:
# This script was original based on the work by Johan Dahlbom located here:
# http://365lab.net/2014/04/15/office-365-assign-licenses-based-on-groups-using-powershell/#comment-4353
# However, it has been almost completely re-written twice since then, and boasts significant added functionality.
#This script syncs Office 365 license assignments from group membership in the Azure Active Directory Tenant.
# Adjust the variable assignments in the first section to match your environment.