简体   繁体   中英

Programmatically updating cscfg for Azure Cloud Service

Does anyone know if this is possible - and if so how it can be done? I need to be able to update the settings stored in the .cscfg file on a fairly regular basis and wondered whether this can be done from code. ie Without uploading a new .cscfg file to Azure each time. Many thanks

Configuration file changes are accomplished via Change Deployment Configuration REST API operation, so it is possible to update the config file programmatically. Do take a look at Azure Management Library or Azure PowerShell Cmdlets as both of them have implementation for this operation. However you can't update just one config setting by this operation. You would need to download the config file, update the setting and then reupload the config file through this operation.

Now I realize that messing with XML file can be error prone. What you could do is create an application which parses this configuration file and present various elements of the XML file in an easy to use UI (do take a look at how it is done in Azure Portal). Once you have made the changes, you can recreate the XML file from the data and then reupload the file. However please note that with this, you won't be able to add new settings. To add new setting, the setting must be added in both cscfg and csdef file and for that you would have to redeploy your application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM