ARM template automation

84 views Asked by At

I am working with VS to build out ARM templates as well as the associated DSC scripts needed. I have everything working but noticed that anytime I make a change to my DSC script, I need to manually copy it over to my DSC resources folder before deploying.

With that in mind, is there a way within VS to automatically copy over the .ps1 into the needed directory before deploying?

Thanks,

1

There are 1 answers

2
4c74356b41 On BEST ANSWER

I don't work with VS, but I have a workflow to work with DSC, basically I have a directory with DSC zip files and directory with dsc configuration files and when I'm ready to deploy i run a powershell script that among all other things updates DSC zip files and uplaods them.

Get-ChildItem "%path%" -File -Filter *.zip | ForEach-Object {
    Compress-Archive -Path "%path\$($_.BaseName).ps1" -DestinationPath $_.FullName -Update
    Set-AzureStorageBlobContent -Context $StorageAccount.Context -Container 'packages' -File $_.FullName -Force -ErrorAction Stop | Out-Null
}

This needs Powershell 5+, but you can add file to zip archive using windows native methods in any Powershell