在Azure Json上找不到模块DSC扩展

时间:2019-01-12 02:36:34

标签: azure powershell arm-template dsc azure-template

我正在尝试在安装过程中运行DSC文件,并且它在昨天和今天都可以正常工作,但出现以下错误:

       "code": "VMExtensionProvisioningError",
        "message": "VM has reported a failure when processing extension 'IIS2'. Error message: \"The DSC Extension received an incorrect input: An error occurred while executing script or module 'configuration':  
The specified module 'configuration' was not loaded because no valid module file was found in any module directory..\nPlease correct the input and retry executing the extension.\"."

我认为没有人对此感到困惑,但是我花了数小时试图弄清楚问题可能是什么,希望能得到一些想法,如果任何东西都能看到我可能错过的任何东西。

DSC文件为:

configuration IIS2
    {

    Import-DscResource -ModuleName xActiveDirectory, xStorage, xNetworking, PSDesiredStateConfiguration, xPendingReboot, xDnsServer

        Node localhost
        {
            LocalConfigurationManager
            {
                RebootNodeIfNeeded = $true
            }

            xWaitforDisk Disk2
            {
                DiskId = 2
                RetryIntervalSec =$RetryIntervalSec
                RetryCount = $RetryCount
            }

            xDisk ADDataDisk {
                DiskId = 2
                DriveLetter = "F"
                DependsOn = "[xWaitForDisk]Disk2"
            }

            WindowsFeature Failover-Clustering
            {
                Ensure = "Present"
                Name = "Failover-Clustering"
            }

            WindowsFeature Web-Server
            {
                Ensure = "Present"
                Name = "Web-Server"
            }

       }
    }

1 个答案:

答案 0 :(得分:1)

我认为您所说的是configuration,实际上是IIS2(我是从ARM模板中获取)的意思。

{
    "name": "System_PowerShell_DSC",
    "properties": {
        "publisher": "Microsoft.Powershell",
        "type": "DSC",
        "typeHandlerVersion": "2.19",
        "autoUpgradeMinorVersion": true,
        "settings": {
            "configuration": {
                "url": "url",
                "script": "file-name.ps1",
                "function": "function-name" # IIS2 in your case
            }
        },
        "protectedSettings": {
            "configurationArguments": {
                "sfCert": {
                    "userName": "yyy",
                    "password": "xxx"
                }
            }
        }
    }