Add Azure Key Vault support and enhance credential handling in configuration data

This commit is contained in:
Torsten Brendgen
2026-07-03 10:34:25 +02:00
parent 9b36693444
commit 943894b8fe
8 changed files with 453 additions and 3 deletions

View File

@@ -25,6 +25,14 @@ function Register-DSCConfigurationDataCredentialProvider {
[hashtable]
$VaultParameters = @{},
[Parameter(Mandatory=$false)]
[string]
$SubscriptionId,
[Parameter(Mandatory=$false)]
[string]
$TenantId,
[Parameter(Mandatory=$false)]
[switch]
$RegisterVault,
@@ -239,6 +247,29 @@ function Register-DSCConfigurationDataCredentialProvider {
return $ProviderSettings
}
}
"AzureKeyVault" {
$ProviderSettings = [ordered]@{
AzureKeyVault = [ordered]@{
DefaultVault = $Vault
}
}
if(-not [string]::IsNullOrWhiteSpace($SubscriptionId)){
$ProviderSettings["AzureKeyVault"]["SubscriptionId"] = $SubscriptionId
}
if(-not [string]::IsNullOrWhiteSpace($TenantId)){
$ProviderSettings["AzureKeyVault"]["TenantId"] = $TenantId
}
if($PSCmdlet.ShouldProcess($SettingsPath, "Create provider settings for [$Provider]")){
Export-PowerShellDataFile -InputObject $ProviderSettings -Path $SettingsPath -Force:$Force
}
if($PassThru){
return $ProviderSettings
}
}
default {
throw "Provider [$Provider] does not provide an initialization implementation."
}