Azure DSC - 使用SAS从存储帐户复制文件 - 错误“不支持相对路径”

时间:2017-07-26 12:30:17

标签: azure powershell-dsc

当我尝试使用DSC将网站(甚至是单个文件)复制到VM时,使用以下配置:

    File WebSiteContent {
        Ensure = "Present"              
        SourcePath = "https://MYBLOB.blob.core.windows.net/prod/index.html?sv=2016-05-31&ss=b&srt=s&sp=rl&se=2017-11-29T21:47:36Z&st=2017-07-26T13:47:36Z&spr=https&sig=SIG_HERE"
        DestinationPath = "C:\inetpub\backend\app_data" 
        Type = "Directory"
    }

我收到错误:

[ERROR] Relative path is not supported. The related file/directory is: https://MYBLOB.blob.core.windows.net/prod/index.html?sv=2016-05-31&ss=b&srt=s&sp=rl&se=2017-11-29T21:47:36Z&st=2017-07-26T13:47:36Z&spr=https&sig=SIG_HERE. \r\n

不确定是什么原因,因为这是文件的绝对路径。任何使其成功的建议都值得赞赏:)

1 个答案:

答案 0 :(得分:3)

您需要使用xPSDesiredConfiguration模块中的xRemoteFile

    File SetupDir {
        Type            = 'Directory'
        DestinationPath = 'c:\Setup'
        Ensure          = "Present"    
    }

    xRemoteFile SQLServerMangementPackage {  
        Uri             = "http://go.microsoft.com/fwlink/?LinkID=824938"
        DestinationPath = "c:\Setup\SSMS-Setup-ENU.exe"
        DependsOn       = "[File]SetupDir"
        MatchSource     = $false
    }