0
votes

Im using the below code in a dsc but it never compiles? I always get the message "Stop: The term 'xRemoteFile' is not recognized as the name of a cmdlet, function, script file, or operable program."

I need to copy a file from an azure storage account to a vm via azure DSC.

configuration A_FILE {

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


   

xRemoteFile Afile {  
    Uri             = "https://storageaccountname.file.core.windows.net/files/file1.txt"
    DestinationPath = "C:\files\"
    DependsOn       = "[File]SetupDir"
    MatchSource     = $false
}

 
}

}

1

1 Answers

0
votes

Ok i worked it out

ok i worked it out

configuration getfilefromazurestorage {

Import-DscResource -ModuleName xPSDesiredStateConfiguration

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

            


    xRemoteFile remotefile {
    # for uri generate a sas token then copy the sas token url in the uri line below
    Uri             = "https://storageaccountname.blob.core.windows.net/files/sastokendetails"
    DestinationPath = "C:\localfiles\AzureFile.txt"
    DependsOn       = "[File]SetupDir"
    MatchSource     = $false
}

 
}