function Assert-ConfigurationDataSecretReference { [CmdletBinding()] Param( [Parameter(Mandatory=$true)] [string] $Name, [Parameter(Mandatory=$true)] [ValidateSet("credential", "securestring")] [string] $TypeName, [Parameter(Mandatory=$true)] $Value ) if(-not (Test-ConfigurationDataMap -Value $Value)){ return } if(-not (Test-ConfigurationDataMapContainsKey -Map $Value -Key "Provider")){ throw "Parameter [$Name] uses type [$TypeName] and a secret reference, but [Provider] is not defined." } if(-not (Test-ConfigurationDataMapContainsKey -Map $Value -Key "Name")){ throw "Parameter [$Name] uses type [$TypeName] and a secret reference, but [Name] is not defined." } $Provider = [string](Get-ConfigurationDataMapValue -Map $Value -Key "Provider") if([string]::IsNullOrWhiteSpace($Provider)){ throw "Parameter [$Name] secret reference [Provider] must not be empty." } $SecretName = [string](Get-ConfigurationDataMapValue -Map $Value -Key "Name") if([string]::IsNullOrWhiteSpace($SecretName)){ throw "Parameter [$Name] secret reference [Name] must not be empty." } switch($Provider.ToLowerInvariant()){ "keepass" { return } default { throw "Parameter [$Name] uses unsupported secret provider [$Provider]." } } }