1

I'm having azure worker role project. below is a code from my configuration (.cscfg).

c# (FLAG = 1;) Through c# code i want to change this value.

Is there any way for dynamically changing value of an azure service configuration?

Please instruct me how to do it.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
TATAS
  • 67
  • 7

1 Answers1

0

Simple answer is that you can't change the value of just one setting through code as RoleEnvironment class only exposes a Get method and there's no Set method.

A convoluted approach would be to invoke Service Management API, read the configuration settings file using Get Deployment operation, change the XML file and the call Change Deployment Configuration operation. Not sure how this would work out if you're changing the configuration from the same role though.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • 1
    Another thing to note is that even if you could modify this via code on the instance itself, unless the change was made to the configuration stored for the deployment as Gaurav has indicated, the change would be lost if you had a restart for any reason. – MikeWo Oct 28 '13 at 12:49
  • This can be done from the Role itself, as Gaurav has mentioned. You'll need to deploy a management certificate (private .PFX) to all of instances in the role in order to talk to this API. – Igorek Oct 28 '13 at 16:00