【问题标题】:Compiling multiple DSC configurations on Azure Automation Account in parallel在 Azure 自动化帐户上并行编译多个 DSC 配置
【发布时间】:2016-11-11 16:33:04
【问题描述】:

我的自动化帐户上有多个 DSC 配置。当我分别编译它们时,一切都很好,但是如果我同时运行 2 个或更多编译,则某些编译会失败并出现类似以下的不同错误:

运行命令停止,因为首选项变量“ErrorActionPreference”或公共参数设置为停止:找不到路径 'C:\Users\Client\Temp\tempconfig\946ab078-a97f-45ee-b6a5-5d24bd76489d\',因为它不存在。

集合已修改;枚举操作可能无法执行。 (集合已修改;可能无法执行枚举操作。)

无法索引到空数组。 (无法索引到空数组。)

我的配置就这么简单:

Configuration TempConfig
{
    Import-DscResource -ModuleName PSDesiredStateConfiguration

    Node 'localhost' {
        WindowsFeature InstallDotNetFrameworkCore
        {
            Ensure = 'Present'
            Name = 'NET-Framework-Core'
        }
    }
}

当我多次编译相同的配置以及编译不同的多个配置时会出现问题(但与上面的一样简单)。 真的没有规则,我随机得到这些错误。 这是 Azure 的某种限制还是我做错了什么?

【问题讨论】:

  • 我认为您需要向 Azure 自动化团队提出这个问题 ;) 或者希望他们中的一些人会找到这个问题 ;)
  • 是的,我已经联系了 Azure 支持,他们正在努力解决这个问题,但希望有人已经遇到过这个问题。

标签: powershell azure dsc


【解决方案1】:

@Loku,

您是否在配置中使用集合?

当您同时多次编译相同的配置时,您是否遇到这些错误?

集合已修改;枚举操作可能无法执行。 (集合已修改;可能无法执行枚举操作。)

无法索引到空数组。 (无法索引到空数组。)

您是否可以提供配置脚本(没有任何秘密)?

【讨论】:

  • 我更新了我的帖子。简而言之 - 它在两种情况下都会发生(多次编译相同的配置并同时编译不同的配置)而且我的配置非常简单,与集合无关。
【解决方案2】:

我也遇到了这个问题,解决办法是使用配置资源中的dependsOn属性来有效地将它们链接在一起,因为它们是串行而不是并行执行的。

这是一个例子

    {
      "name": "[variables('dscConfigurations').DomainJoinConfig.name]",
      "type": "configurations",
      "apiVersion": "2015-10-31",
      "location": "[variables('location')]",
      "dependsOn": [
        "[variables('AutomationAccountName')]",
        "dscDomainAdmin"
      ],
      "properties": {
        "state": "Published",
        "overwrite": "true",
        "source": {
          "type": "uri",
          "value": "[concat(parameters('_artifactsLocation'), variables('dscConfigurations').DomainJoinConfig.script, parameters('_artifactsLocationSasToken'))]"
        }
      }
    },
    {
      "name": "[variables('dscConfigurations').AddServerRolesAndFeaturesArchive.name]",
      "type": "configurations",
      "apiVersion": "2015-10-31",
      "location": "[variables('location')]",
      "dependsOn": [
        "[variables('AutomationAccountName')]",
        "[variables('dscResources').xPendingReboot.name]",
        "[variables('dscConfigurations').DomainJoinConfig.name]"
      ],
      "properties": {
        "state": "Published",
        "overwrite": "true",
        "source": {
          "type": "uri",
          "value": "[concat(parameters('_artifactsLocation'), variables('dscConfigurations').AddServerRolesAndFeaturesArchive.script, parameters('_artifactsLocationSasToken'))]"
        }
      }
    },
    {
      "name": "[variables('dscConfigurations').AddServerRoleAndFeaturesContent.name]",
      "type": "configurations",
      "apiVersion": "2015-10-31",
      "location": "[variables('location')]",
      "dependsOn": [
        "[variables('AutomationAccountName')]",
        "[variables('dscResources').xPendingReboot.name]",
        "[variables('dscConfigurations').AddServerRolesAndFeaturesArchive.name]"
      ],
      "properties": {
        "state": "Published",
        "overwrite": "true",
        "source": {
          "type": "uri",
          "value": "[concat(parameters('_artifactsLocation'), variables('dscConfigurations').AddServerRoleAndFeaturesContent.script, parameters('_artifactsLocationSasToken'))]"
        }
      }
    },

【讨论】:

    猜你喜欢
    • 2017-09-16
    • 2018-10-13
    • 1970-01-01
    • 2020-12-07
    • 1970-01-01
    • 2018-10-25
    • 2017-02-01
    • 2021-05-30
    • 1970-01-01
    相关资源
    最近更新 更多