New-CertKitAppProxyIdentity
2.0.1
This script configures everything CertKit needs to deploy certificates to Microsoft Entra Application Proxy applications, following least privilege. It supports three authentication methods. Starting with version 2.0, certificate authentication is the default. Use -UseClientSecret for client secret authentication.
Certificate authentication (default):
- A dedicated a
Certificate authentication (default):
- A dedicated a
This script configures everything CertKit needs to deploy certificates to Microsoft Entra Application Proxy applications, following least privilege. It supports three authentication methods. Starting with version 2.0, certificate authentication is the default. Use -UseClientSecret for client secret authentication.
Certificate authentication (default):
- A dedicated app registration and service principal for CertKit.
- A self-signed certificate (RSA 2048, SHA256) with the subject 'CN=CertKit App Proxy Agent' and no subject alternative names, created in the local computer's personal store (Cert:\LocalMachine\My). The private key is non-exportable and is created in the TPM when one is available, otherwise by the Microsoft Software Key Storage Provider.
- The certificate has the Client Authentication EKU, or a custom EKU under your organization's IANA private enterprise number (PEN) when -CustomEku is specified.
- The public certificate is uploaded to the app registration, named 'CertKit Agent - <computer name>' so each server's certificates can be told apart.
- The script must run elevated on the server running the CertKit agent, because the private key can't leave the computer it was created on.
Client secret authentication (-UseClientSecret):
- A dedicated app registration and service principal for CertKit.
- A client secret, which is copied to the clipboard and never displayed on screen.
Managed identity authentication (-ManagedIdentityId):
- Uses an existing user-assigned or system-assigned managed identity attached to the server running the CertKit agent. The script doesn't create the managed identity, which is an Azure resource.
All methods:
- A custom Entra role that can only read Application Proxy settings and update the Application Proxy SSL certificate.
- The read-only Microsoft Graph application permission Application.Read.All, used by CertKit to find App Proxy applications.
- A tenant-wide assignment of the custom role to the CertKit identity, made directly or through Privileged Identity Management (PIM).
The script is safe to run more than once. Existing objects with the same names are reused, and existing role and permission assignments are not duplicated. A new certificate or client secret is created on every run. Expired certificates and client secrets are always removed from the app registration, and expired CertKit certificates are removed from the local computer's store. Use -RemoveExistingCertificates or -RemoveExistingSecrets to also remove older credentials that are still valid.
Show more
Certificate authentication (default):
- A dedicated app registration and service principal for CertKit.
- A self-signed certificate (RSA 2048, SHA256) with the subject 'CN=CertKit App Proxy Agent' and no subject alternative names, created in the local computer's personal store (Cert:\LocalMachine\My). The private key is non-exportable and is created in the TPM when one is available, otherwise by the Microsoft Software Key Storage Provider.
- The certificate has the Client Authentication EKU, or a custom EKU under your organization's IANA private enterprise number (PEN) when -CustomEku is specified.
- The public certificate is uploaded to the app registration, named 'CertKit Agent - <computer name>' so each server's certificates can be told apart.
- The script must run elevated on the server running the CertKit agent, because the private key can't leave the computer it was created on.
Client secret authentication (-UseClientSecret):
- A dedicated app registration and service principal for CertKit.
- A client secret, which is copied to the clipboard and never displayed on screen.
Managed identity authentication (-ManagedIdentityId):
- Uses an existing user-assigned or system-assigned managed identity attached to the server running the CertKit agent. The script doesn't create the managed identity, which is an Azure resource.
All methods:
- A custom Entra role that can only read Application Proxy settings and update the Application Proxy SSL certificate.
- The read-only Microsoft Graph application permission Application.Read.All, used by CertKit to find App Proxy applications.
- A tenant-wide assignment of the custom role to the CertKit identity, made directly or through Privileged Identity Management (PIM).
The script is safe to run more than once. Existing objects with the same names are reused, and existing role and permission assignments are not duplicated. A new certificate or client secret is created on every run. Expired certificates and client secrets are always removed from the app registration, and expired CertKit certificates are removed from the local computer's store. Use -RemoveExistingCertificates or -RemoveExistingSecrets to also remove older credentials that are still valid.
Installation Options
Owners
Copyright
Copyright (C) 2026 Richard M. Hicks Consulting, Inc. All Rights Reserved.
Package Details
Author(s)
- Richard Hicks
Tags
CertKit Entra EntraID AppProxy ApplicationProxy Certificate TLS SSL MicrosoftGraph Graph ServicePrincipal PIM LeastPrivilege TPM
Functions
Invoke-GraphRequestWithRetry Test-CredentialExpired Test-CertKitCertificate Remove-LocalCertificate
Dependencies
-
- Microsoft.Graph.Authentication (>= 2.0.0)
FileList
- New-CertKitAppProxyIdentity.nuspec
- New-CertKitAppProxyIdentity.ps1