Update Azure Service Configuration File using Powershell

Posted by David Osborn on Stack Overflow See other posts from Stack Overflow or by David Osborn
Published on 2010-03-18T02:12:59Z Indexed on 2010/03/18 2:21 UTC
Read the original article Hit count: 245

Filed under:
|
|

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>

© Stack Overflow or respective owner

Related posts about powershell

Related posts about Xml