Update Azure Service Configuration File using Powershell
- by David Osborn
I'm trying to write a powershell script that updats each of the DiagnosticsConnectionString and DataConnectionString values below, but I can't seem to find each individual Role node using
$serviceconfig.ServiceConfiguration.SelectSingleNode("Role[@name='MyService_WorkerRole']")
doing echo $serviceconfig.ServiceConfiguration.Role lists out both Role nodes for me so I know it is working up to that point, but after that I am not having much success.
where $serviceConfig contains the below XML:
<?xml version="1.0"?>
<ServiceConfiguration serviceName="MyService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
<Role name="MyService_WorkerRole">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="DiagnosticsConnectionString" value="really long string" />
<Setting name="DataConnectionString" value="really long string 2" />
</ConfigurationSettings>
</Role>
<Role name="MyService_WebRole">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="DiagnosticsConnectionString" value="really long string 3" />
<Setting name="DataConnectionString" value="really long string 4" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>