我需要保护的DSC配置参数(PSCredential的] RegistrationKey),所以我把它放在“settings.protectedSettings.configurationData”下这样的:ARM模板DSC:配置不“看” protectedSettings.configurationArguments
"protectedSettings": {
"configurationArguments": {
"RegistrationKey": {
"UserName": "PLACEHOLDER_DONOTUSE",
"Password": "[parameters('dscAutomationRegistrationKey')]"
}
},
"configurationUrlSasToken": "[parameters('artifactsLocationSasToken')]"
}
我得到的错误:
"VM has reported a failure when processing extension 'Microsoft.Powershell.DSC'. Error message: \"The DSC Extension failed to execute: Mandatory
parameter RegistrationKey is missing.
如果我提出RegistrationKey了“settings.protectedSettings.configurationArguments
”,走进“settings.configurationArguments
”,它的工作原理,因此,我认为没有什么不妥的语法,所以我相信这是与0123合作未包含在DSC配置中。
(我试图包括在PS1文件中的配置块,但是这引发了错误,这表明这不能完成)
现在我已经写了configurationdata的.psd1文件,包含以下内容:
$ConfigData = @{
AllNodes = @(
@{
NodeName = "*"
PsDscAllowPlainTextPassword = $true
}
)
}
并在settings.configurationdata.url
中引用它。
现在,这将导致相同的错误面前:VM报告出现了故障......
ARM的模板是从PowerShell中称为:
$oAutomationAccount = Get-AzureRmAutomationAccount -ResourceGroupName $AAresourceGroupName -Name $AutomationAccountName
$RegistrationInfo = $oAutomationAccount | Get-AzureRmAutomationRegistrationInfo
$DscRegKeyString = $RegistrationInfo.PrimaryKey
$ssDscAutomationRegistrationKey = (ConvertTo-SecureString -string $DscRegKeyString -AsPlainText -Force)
#Automation Account EndPoint Uri
$DscRegistrationUrl = $RegistrationInfo.Endpoint
$params = @{
artifactsLocationSasToken = $TemplateSas
vmName = "XYZ"
dscAutomationRegistrationKey = $ssDscAutomationRegistrationKey
dscAutomationRegistrationUrl = $DscRegistrationUrl
dscNodeConfigurationName = "CreateAFolder.localhost"
dscTimeStamp = (Get-Date -f "MM/dd/yyyy H:mm:ss tt") #"MM/dd/yyyy H:mm:ss tt"
dscResourceUrl = $DscResourceUrl
dscConfigurationUrl = $DscConfigurationUrl
dscResourceScript = $DscResourceScriptName
dscResourceFunction = "ConfigureLCMforAAPull"
#sequenceId = $sequenceId
}
New-AzureRmResourceGroupDeployment @params `
-Name "$TemplateInstance-$branch" `
-ResourceGroupName $DeploymentResourceGroup.ResourceGroupName `
-Mode Incremental `
-DeploymentDebugLogLevel All `
-TemplateUri $TemplateUri `
-Verbose
在哪里,我相信这些参数被作为传递正确的类型。
我在做什么错?
更新使用新的DSC模式:https://blogs.msdn.microsoft.com/powershell/2016/02/26/arm-dsc-extension-settings/