azurepowershell-dsc

Azure DSC - copying files from Storage Account with SAS - error "Relative path is not supported"


When I try to copy website (even a single file) to VM with DSC, with the following configuration:

    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"
    }

I get an error:

[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

Not sure what is the reason, since this is an absolute path to the file. Any suggestions to make it work are appreciated :)


Solution

  • You need to use xRemoteFile from the xPSDesiredConfiguration module

        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
        }