【问题标题】:Azure DSC upload a blob to Azure VMAzure DSC 将 Blob 上传到 Azure VM
【发布时间】:2021-01-11 02:45:37
【问题描述】:

我需要通过 azure DSC 将文件从 azure 存储帐户复制到 vm。

以下是我尝试过的

配置示例DSC { 安装模块-名称'xPSDesiredStateConfiguration'-force 导入-DscResource -Name 'xPSDesiredStateConfiguration'

Node localhost
{
    File CreateFolder
    {
        Type            = 'Directory'
        DestinationPath = 'C:\NewFolder'
        Ensure          = "Present"
    }

    xRemoteFile remotefile {
# for uri generate a sas token then copy the sas token url in the uri line below
          Uri             = "storageblob+SAS token"
          DestinationPath = "C:\NewFolder\"
          DependsOn       = "[File]CreateFolder"
          MatchSource     = $false 


}

}

但我遇到错误 - 请帮助

错误消息:“DSC 扩展收到错误的输入:发生错误时 执行脚本或模块'importcertificate.ps1':在 C:\Packages\Plugins\Microsoft.Powershell.DSC\2.80.1.0\DSCWork\importcertificate.1\importcertificate.ps1:4 char:6

  •  Import-DscResource -Name 'xPSDesiredStateConfiguration'
    

无法加载资源“xPSDesiredStateConfiguration”:找不到资源。 请更正输入并重试执行扩展。”

我应该只使用:安装 PSDesiredStateConfiguration 吗?

【问题讨论】:

    标签: powershell azure-resource-manager dsc


    【解决方案1】:

    xPSDesiredStateConfiguration 文件夹/模块是否在同一目录中?它不随 Windows 提供,因此您需要从 https://www.powershellgallery.com/packages/xPSDesiredStateConfiguration/8.10.0.0 获取它

    这是我一直在使用的版本,很好用。

    【讨论】:

      猜你喜欢
      • 2020-10-29
      • 2019-12-15
      • 1970-01-01
      • 1970-01-01
      • 2020-09-01
      • 1970-01-01
      • 2020-12-15
      • 2020-01-03
      • 2017-03-14
      相关资源
      最近更新 更多