Add Azure Key Vault support and enhance credential handling in configuration data
This commit is contained in:
@@ -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."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user