我的 Azure 自动化帐户上有以下工作流脚本作为 Runbook:
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"
}
}
运行此 RunBook 时出现以下错误:
Import-Module: The specified module 'PSDesiredStateConfiguration' was not loaded because it was not found in any module directory.
如何从 Azure Runbooks 运行 DSC 配置?甚至有可能还是我绝对需要使用 Windows PowerShell?