【问题标题】:No module found DSC extension on Azure Json在 Azure Json 上找不到模块 DSC 扩展
【发布时间】:2019-01-12 02:36:33
【问题描述】:

我正在尝试在安装过程中运行 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"
            }

       }
    }

【问题讨论】:

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


    【解决方案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"
                    }
                }
            }
        }
    

    【讨论】:

    • 您好,来自 ARM 模板的 DSC 配置和参数文件在此链接中,但它们看起来是正确的,或者我弄错了pastebin.com/embed_js/E7Yv4aY4
    • 检查定义 dsc 扩展的正确方法
    • 谢谢,这很好,请问我是否有两个配置,“配置 IIS2”和“配置 IIS3”,我是否只需更改 "function": "function-name" .. 再次感谢您的帮助: )
    • 是的,您只需针对模板中的其他配置
    • @4c74356b41 ARM 模板之王 :-)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多