# Function to download a self-signed certificate and save it as a PEM file
function Get-SelfSignedCertAsPem {
param (
[Parameter(Mandatory=$true)]
[Uri]$Uri, # The internal domain URL (e.g., https://internal.domain.com)
[string]$OutputPath = "C:\Temp\certificate.pem" # Where to save the PEM file
)
# Ensure the URI uses HTTPS