gpt4 book ai didi

powershell - 为 Azure 资源管理器模板部署 DSC 扩展时出现问题

转载 作者:行者123 更新时间:2023-12-03 00:23:13 24 4
gpt4 key购买 nike

我正在尝试部署用于 Windows 虚拟机配置的 Azure 资源管理器模板。

目前,我正在将 IIS Powershell 脚本引导到 DSC 模块,以便为通过 ARM 配置的 Windows 虚拟机设置 IIS。

我不断收到与 WinRM 相关的错误:

New-AzureRmResourceGroupDeployment : 5:04:53 PM - Resource Microsoft.Compute/virtualMachines/extensions 'vmSVX-TESTAU-SQL1/dscExtension' failed with message '{
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'Failed'.",
"details": [
{
"code": "VMExtensionProvisioningError",
"message": "VM has reported a failure when processing extension 'dscExtension'. Error message: \"DSC Configuration 'vmDSC' completed with error(s).
Following are the first few: The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to
configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config.\"."
}
]
}
}'

与此 VM 的配置相关的 ARM 模板:

{
"apiVersion": "2016-03-30",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmNameSQL'), '/', 'dscExtension')]",
"location": "[variables('location')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmNameSQL'))]"
],
"properties": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "2.9",
"autoUpgradeMinorVersion": true,
"settings": {
"configuration": {
"url": "[variables('dscModulesUrl')]",
"script": "[concat(variables('dscFunction'),'.ps1')]",
"function": "[variables('dscFunction')]"
},
"configurationArguments": {
"nodeName": "[variables('vmNameSQL')]"
}
},
"protectedSettings": {
"configurationUrlSasToken": "[parameters('_artifactsLocationSasToken')]"
}
}
}

至于已引导的IIS powershell脚本:

Configuration WindowsFeatures
{
param ([string[]]$NodeName = 'localhost')

Node $NodeName
{
#Install the IIS Role
WindowsFeature IIS
{
Ensure = “Present”
Name = “Web-Server”
}

}
}

最佳答案

与各方讨论后,我们最终删除了

      "configurationArguments": {
"nodeName": "[variables('vmNameSQL')]"
}

从ARM模板中删除了

param ([string[]]$NodeName = 'localhost')

来自 DSC 配置。我们还将节点设置为“localhost”。

@iteong 能够测试这个新配置并且它有效。

要添加的另一点是完整的错误消息与上面显示的不同:

[ERROR] A parameter cannot be found that matches parameter name 'nodeName'.\n\nAnother common error is to specify parameters of type PSCredential without an explicit type.

关于powershell - 为 Azure 资源管理器模板部署 DSC 扩展时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44836776/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com