Hi All,
<Couldnt find and DSC Forum so , Posting in PowerShell. Experts out their, need your help >
Our deployment goes like this, From TFS drops location we Invoke RM client with the activity -> Using PS/DSC, where I invoke a PS script to upload binaries to BLOB and copies binaries from Blob to destination folder of Azure VM .
The major challenge was with respect to Web.config transformations, since these are VNext deployments we are using DSC script to transform Web.config files.
http://www.donovanbrown.com/post/2014/09/05/Tokenization-for-DSC
https://gallery.technet.microsoft.com/xReleaseManagement-db1baef1
Below is the DSC :
Question 1 ) I have 5 Web.config files from 5 folders of TFS build drop loc,how do I transformation the changes with DSC before copying to the destination folder of Azure VM.
My Web.config files would reside like Folder1\Web.config
Folder2\Web.config .. etc
How can I transform the same ?
My DSC looks like below :
$ConfigData = @{
AllNodes = @(
@{
NodeName = "localhost";
SourcePath = "$($PSScriptRoot)\tokenfile_drop\";
DestinationPath = "$($PSScriptRoot)\tokenfile_target\";
Tokens = @{Database="db02"};
SearchPattern = "*.config"
}
)
}
Configuration TokenizeFiles
{
# You have to import the xReleaseManagement resource before
# you can use it in your configuration
Import-DscResource -ModuleName xReleaseManagement
# Node is read from ConfigData defined above
Node $AllNodes.NodeName
{
# Use the built in File resource to copy files
File CopyBits
{
Ensure = "Present"
Force = $true
Recurse = $true
Type = "Directory"
SourcePath = $Node.SourcePath
DestinationPath = $Node.DestinationPath
}
# Use the xTokenize resource to transform your web.config files
xTokenize WebConfigs
{
dependsOn = "[File]CopyBits"
recurse = $true
useTokenFiles = $true
tokens = $Node.Tokens
path = $Node.DestinationPath
searchPattern = $Node.SearchPattern
}
}
}
TokenizeFiles -ConfigurationData $ConfigData
Start-DscConfiguration -Wait -Verbose -Path .\TokenizeFiles -Force
------------------------------------------------------------------------------------------------------------------------------------------------------
Could you please help me here ?
Thanks,
Abraham Dhanyaraj