简体   繁体   English

如何检索和更新服务的Azure配置文件?

[英]How do I retrieve and update an azure configuration file for a service?

i am completely new to Azure. 我是Azure的新手。 I would like to be able to retrieve a services configuration file and then change the values within it. 我希望能够检索服务配置文件,然后更改其中的值。 I am stuck at the very start as i do not know how go about editing the config file when it has been retrieved or what type (XMLDocument etc) it has to be set as to edit it. 我一开始就被卡住了,因为我不知道如何在检索到配置文件时编辑该配置文件,或者将其设置为何种类型(XMLDocument等)进行编辑。 When i retrieve a services properties it returns the following XML 当我检索服务属性时,它将返回以下XML

<?xml version="1.0" encoding="utf-8"?>
<HostedService xmlns="http://schemas.microsoft.com/windowsazure">
  <Url>hosted-service-url</Url>
  <ServiceName>hosted-service-name</ServiceName>
  <HostedServiceProperties>
    <Description>description</Description>
    <Location>location</Location>
    <AffinityGroup>affinity-group</AffinityGroup>
    <Label>base-64-encoded-name-of-the-service</Label>
  </HostedServiceProperties>
  <Deployments>
    <Deployment>
      <Name>deployment-name</Name>
      <DeploymentSlot>deployment-slot</DeploymentSlot>
      <PrivateID>deployment-id</PrivateID>
      <Status>deployment-status</Status>
      <Label>base64-encoded-deployment-label</Label>
      <Url>deployment-url</Url>
      <Configuration>base-64-encoded-configuration-file</Configuration>
      <RoleInstanceList>
        <RoleInstance>
          <RoleName>role-name</RoleName>
          <InstanceName>role-instance-name</InstanceName>
          <InstanceStatus>instance-status</InstanceStatus>
        </RoleInstance>
      </RoleInstanceList>
      <UpgradeDomainCount>upgrade-domain-count</UpgradeDomainCount>
      <RoleList>
        <Role>
          <RoleName>role-name</RoleName>
          <OsVersion>operating-system-version</OsVersion>
        </Role>
      </RoleList>
      <SdkVersion>sdk-version-used-to-create-package</SdkVersion>
      <InputEndpointList>
         <InputEndpoint>
            <RoleName>role-name</RoleName>
            <Vip>virtual-ip-address</Vip>
            <Port>port-number</Port>
         </InputEndpoint>
         …
      </InputEndpointList>
      <Locked>deployment-write-allowed-status</Locked>
      <RollbackAllowed>rollback-operation-allowed</RollbackAllowed>
    </Deployment>
  </Deployments>
</HostedService>

So like i said,what i want to do is take the "base-64-encoded-configuration-file" from this XML and edit its values. 因此,就像我说的,我要做的是从此XML中获取“ base-64-encoded-configuration-file”并编辑其值。 But i cannot figure out how to take the configuration file out of the above XML. 但是我不知道如何从上述XML中提取配置文件。

Any help or even a point in the right direction would be greatly appreciated, cheers. 欢呼,我们将不胜感激任何帮助甚至正确方向的指点。

You could also use the Windows Azure Powershell Cmdlets . 您也可以使用Windows Azure Powershell Cmdlet

Executing a Set-DeploymentConfiguration would update the configuration values of your instance. 执行Set-DeploymentConfiguration将更新您实例的配置值。

You can find many tutorials on how to learn powershell online including: 您可以找到许多有关如何在线学习Powershell的教程,包括:

Download the source code for csmanage library. 下载csmanage库的源代码。 It has the examples and abstraction layers for working with the Azure Service Management API: http://code.msdn.microsoft.com/windowsazure/Windows-Azure-CSManage-e3f1882c 它具有用于Azure服务管理API的示例和抽象层: http : //code.msdn.microsoft.com/windowsazure/Windows-Azure-CSManage-e3f1882c

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从应用程序级别使用Azure中的服务配置? - How can I use service configuration in Azure from application level? 如何上传资源文件,然后在 Azure 云服务中访问该文件? - How do I upload a resource file and then access that file in an Azure Cloud Service? 如何使用自定义配置部分保存配置文件? - How do I save a configuration file with a custom configuration section? 如何记录和检索Azure Worker角色例外? - How do I log and retrieve Azure Worker role exceptions? 如何从我的 SQL Azure 应用服务 Web 应用写入日志文件? - How do I write a log file from my SQL Azure App Service Web App? 如何检索运行 Windows 服务的用户名? - How do I retrieve the username that a Windows service is running under? 如何在自定义配置部分中更新.NET配置? - How do I update .NET configuration in a custom config section? 如何以编程方式更新log4net配置文件? - How can I programmatically update log4net configuration file? 如果没有订阅者在一个月内没有检索消息,如何自动在Azure Service Bus中删除队列? - How to remove queue in Azure Service Bus automatically if no one subscriber do not retrieve messages during month? Azure中的WCF服务配置 - WCF Service configuration in Azure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM