Private/Hide-SecretValue.ps1

FunctionHide-SecretValue{<#
.SYNOPSIS
Hide a secret value by converting it to "******"

.DESCRIPTION
Matches a pattern in a JSON formatted string which is expected to contain a secret value.
Replaces all secret values with "******", and returns a sanitised string.
Enables a request body to be included in debug/verbose streams without exposing secret values.

.PARAMETER InputValue
JSON body of API request

.PARAMETER SecretsToRemove
Any additional JSON properties which should be sanitised.