Reputation: 1985
Ive been looking for a way to copy files from an azure storage to a vm using azure DSC but havent found any solutions
every time i run the dsc i get an error message as follows "PowerShell DSC resource MSFT_xRemoteFile failed to execute Set-TargetResource functionality with error message: Invoking web request failed with error. The remote server returned an error: (403) Forbidden." Using automation account I have added the azure automation ok , not sure what is forbidden?? I have generated a SAS token and copied the URI as below so not sure what else i need to do???
the dsc is as below
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
}
}
}
Upvotes: 0
Views: 545
Reputation: 1
Have you tried using Invoke-WebRequest in PowerShell to test the URI? I had this, turns out I was generating a SAS Token from the wrong storage account!
Upvotes: 0