简体   繁体   English

Azure DSC,无法加载模块 xPSDesiredStateConfiguration

[英]Azure DSC, cannot load module xPSDesiredStateConfiguration

I'm trying to write a DSC configuration for an Azure VM that I am creating using Resource Manager.我正在尝试为我使用资源管理器创建的 Azure VM 编写 DSC 配置。 I want to use xRemoteFile, so I try to import the xPSDesiredStateConfiguration module, but when I deploy it is not found.我想使用xRemoteFile,所以我尝试导入xPSDesiredStateConfiguration 模块,但是在我部署时找不到它。

I searched the web, and learned that I need to install the xPSDesiredStateConfiguration module before I deploy.我在网上搜索,了解到我需要在部署之前安装 xPSDesiredStateConfiguration 模块。 How do I do that when I just created the VM on Azure?当我刚刚在 Azure 上创建 VM 时,我该怎么做?

Start of configuration file:配置文件开头:

Configuration Main
{
Param ( [string] $nodeName )

Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -Name MSFT_xRemoteFile -ModuleName xPSDesiredStateConfiguration

The error message:错误信息:

08:56:12 - [ERROR] + Import-DscResource -Name MSFT_xRemoteFile -ModuleName xPSDesiredState ...
08:56:12 - [ERROR] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
08:56:12 - [ERROR] The DSC engine could not load the module 'xPSDesiredStateConfiguration'. It 
08:56:12 - [ERROR] was not found on the system.".

If you create the zip file for the DSC extension using the Publish-AzureVMDscConfiguration cmdlet and you run that cmdlet on a machine that has the xPSDesiredStateConfiguration resource in the PSModulePath, the cmdlet will pick up that resource and stuff it into the zip file for you - then when the DSC extension runs on the VM it will pull the resource from your zip and install it.如果您使用发布-AzureVMDscConfiguration cmdlet将创建为DSC扩展zip文件运行具有xPSDesiredStateConfiguration资源在PSModulePath的机器上该cmdlet,cmdlet将拿起资源和东西成zip文件为你-然后当 DSC 扩展在 VM 上运行时,它将从您的 zip 中提取资源并安装它。

If you have the xPSDesiredStateConfiguration somewhere other than the PSModulePath, use the -AdditionalPath parameter on the cmdlet to point to wherever that resource is...如果您在 PSModulePath 以外的其他地方有 xPSDesiredStateConfiguration,请使用 cmdlet 上的 -AdditionalPath 参数来指向该资源所在的位置...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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