如何将文件从Azure存储复制到VM

时间:2020-09-04 11:48:48

标签: azure automation dsc

我一直在寻找一种使用azure DSC将文件从azure存储复制到vm的方法,但是还没有找到解决方法

每次我运行dsc时,都会收到如下错误消息 “ PowerShell DSC资源MSFT_xRemoteFile无法执行带有错误消息的Set-TargetResource功能:调用Web请求失败,并显示错误。远程服务器返回错误:(403)禁止。” 使用自动化帐户,我已经添加了天蓝色的自动化ok,不确定是否禁止了什么?我已经生成了一个SAS令牌并按如下所示复制了URI,所以不确定我还需要做什么?

dsc如下

configuration dscfiletest

{

Import-DscResource -ModuleName xPSDesiredStateConfiguration

Node localhost
{
   
   
    File SetupDir {
    Type            = 'Directory'
    DestinationPath = 'C:\dsctest'
    Ensure          = "Present"    
     }
    
xRemoteFile Package {  
    Uri             = "https://dscfiles.blob.core.windows.net/dsctesting/dsctesting.zip?sastokenhere" 
    DestinationPath = "C:\dsctest"
    #DependsOn       = "[File]SetupDir"
    MatchSource     = $false
}
  

}

}

1 个答案:

答案 0 :(得分:0)

您是否尝试在PowerShell中使用Invoke-WebRequest来测试URI?我有这个,原来我是从错误的存储帐户生成SAS令牌的!!

相关问题