New Params
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High', DefaultParameterSetName = 'CreateNewApp')]
param(
# REGION: New App param set
[Parameter(
ParameterSetName = 'CreateNewApp',
Mandatory = $true,
HelpMessage = 'The prefix used to initialize the Graph Email App. 2-4 characters letters and numbers only.'
)]
[ValidatePattern('^[A-Z0-9]{2,4}$')]
[string]
$AppPrefix,
[Parameter(
ParameterSetName = 'CreateNewApp',
Mandatory = $true,
HelpMessage = 'The username of the authorized sender.'
)]
[ValidatePattern('^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$')]
[string]
$AuthorizedSenderUserName,
[Parameter(
ParameterSetName = 'CreateNewApp',
Mandatory = $true,
HelpMessage = 'The Mail Enabled Sending Group.'
)]
[ValidatePattern('^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$')]
[string]
$MailEnabledSendingGroup,
# REGION: Existing App param set
[Parameter(
ParameterSetName = 'UseExistingApp',
Mandatory = $true,
HelpMessage = 'The AppId of the existing App Registration to which you want to attach a certificate.'
)]
[ValidatePattern('^[0-9a-fA-F-]{36}$')] # or just a string
[string]
$ExistingAppId,
# REGION: Shared parameters
[Parameter(
Mandatory = $false,
HelpMessage = 'The thumbprint of the certificate to be retrieved or created.'
)]
[ValidatePattern('^[A-Fa-f0-9]{40}$')]
[string]
$CertThumbprint,
[Parameter(
Mandatory = $false,
HelpMessage = 'Key export policy for the certificate.'
)]
[ValidateSet('Exportable', 'NonExportable')]
[string]
$KeyExportPolicy = 'NonExportable',
[Parameter(
Mandatory = $false,
HelpMessage = 'If specified, use a custom vault name. Otherwise, use the default.'
)]
[string]
$VaultName = 'GraphEmailAppLocalStore',
[Parameter(
Mandatory = $false,
HelpMessage = 'If specified, overwrite the vault secret if it already exists.'
)]
[switch]
$OverwriteVaultSecret,
[Parameter(
Mandatory = $false,
HelpMessage = 'Return the parameter splat for use in other functions.'
)]
[switch]
$ReturnParamSplat
)
New Params