Modify the cscfg File While Deploying a Cloud Service with PowerShell

Often times you want to modify the contents of the configuration file to change a storage account connection string, value of a setting, or the thumbprint of a certificate. To make this easier we came up with the following PowerShell function. Enjoy.

Connection string
Change-Csfg -fileName c:\temp\mycscfg.cscfg -connString “connectionStringName” -UseSsl $true -AccountName “accountName” -AccountKey “acountKey”

Certificate Thumbprint
Change-Cscfg -FileName c:\temp\mycscfg.cscfg -Certificate “MyProperty” -Value “newValue”

Configuration Setting
Change-Cscfg -FileName c:\temp\mycscfg.cscfg -Config “MyProperty” -Value “newValue”

Leave a Reply