简体   繁体   中英

Azure DSC Configuration from Runbooks

I have the following Workflow script as a Runbook on my Azure Automation account:

workflow Configure-VM
{
    $DSCConfigPath = "C:\DSCConfigs\TestConfiguration"
    inlinescript
    {
        Import-Module PSDesiredStateConfiguration
        Configuration TestConfiguration
        {
            Node "ak-testvm-001" {
                WindowsFeature IIS {
                    Ensure = "Present"
                    Name = "Web-Server"
                }
            }
        }

        Write-Output "INFO: Creating the DSC Configuration"
        TestConfiguration -NodeName "ak-testvm-001" -OutputPath $Using:DSCConfigPath

        Write-Output "INFO: Deploying DSC Configuration"
        Start-DscConfiguration -Path $Using:DSCConfigPath -Force -Wait -Verbose
        Write-Output "INFO: DSC Configuration Finished"

        Write-Output "INFO: END OF RUNBOOK"
    }
}

I get the following error when I run this RunBook:

Import-Module: The specified module 'PSDesiredStateConfiguration' was not loaded because it was not found in any module directory.

How can I run a DSC Configuration from Azure Runbooks? Is it even possible or do I absolutely need to use the Windows PowerShell?

PowerShell Desired State Configuration support was added to Azure Automation in limited preview in May. You can read more on how to manage DSC nodes using Azure Automation here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM