Модуль DSC не найден в Azure Json - PullRequest
0 голосов
/ 12 января 2019

Я пытаюсь запустить файл 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 голосов
/ 12 января 2019

Я думаю, что он говорит, что вы называете его 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"
                }
            }
        }
    }
...