Need help in tokenizing Web.config files with DSC in RM 2013.4


hi all,

<couldnt find , dsc forum , posting in powershell. experts out their, need >

our deployment goes this, tfs drops location invoke rm client activity -> using ps/dsc, invoke ps script upload binaries blob , copies binaries blob destination folder of azure vm . 

the major challenge respect web.config transformations, since these vnext deployments using dsc script transform web.config files. 

http://www.donovanbrown.com/post/2014/09/05/tokenization-for-dsc

https://gallery.technet.microsoft.com/xreleasemanagement-db1baef1

below dsc : 

question 1 ) have 5 web.config files 5 folders of tfs build drop loc,how transformation changes dsc before copying destination folder of azure vm. 

my web.config files reside folder1\web.config 

      folder2\web.config .. etc 

how can transform same ? 

my dsc looks below : 

$configdata = @{
   allnodes = @(
      @{
         nodename = "localhost";
         sourcepath = "$($psscriptroot)\tokenfile_drop\";
         destinationpath = "$($psscriptroot)\tokenfile_target\";
         tokens = @{database="db02"};
         searchpattern = "*.config"
      }
   )
}

configuration tokenizefiles
{
   # have import xreleasemanagement resource before
   # can use in configuration
   import-dscresource -modulename xreleasemanagement
    
   # node read configdata defined above
   node $allnodes.nodename
   {
      # use built in file resource copy files
      file copybits
      {
         ensure = "present"
         force = $true
         recurse = $true
         type = "directory"
         sourcepath = $node.sourcepath
         destinationpath = $node.destinationpath
      }

      # use xtokenize resource transform 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 please me here ?

thanks,


abraham dhanyaraj

note "x" indicates "experimental" , supported users have created dsc modules.  yu best post in q&a or in blog.


\_(ツ)_/



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Event ID 64,77,1008 Certificates Events Windows Server 2008, 2008R2