Microsoft Azure 雲端服務
組態架構

雲端服務使用兩個主要的設定檔來組態服務功能，一個是服務定義檔 (ServiceDefinition.csdef)，它定義了一個雲端服務要使用到的雲端基礎資源，包含使用的虛擬機器角色類型 (Web Role 或 Worker Role)、虛擬機器的大小、使用的網路組態、負載平衡器組態、憑證資訊、使用的組態項目、IIS 使用的網站繫結資訊等，這些資訊在部署雲端服務之後不可改變。例如下列 XML：
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="AzureWebFarm.Example.Cloud" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-10.1.8">
  <LoadBalancerProbes>
    <LoadBalancerProbe name="WebDeploy" protocol="http" port="80" path="Probe.aspx" intervalInSeconds="5" timeoutInSeconds="100" />
  </LoadBalancerProbes>
  <WebRole name="AzureWebFarm.Example.Web" vmsize="Small">
    <Runtime executionContext="elevated" />
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="HttpIn" endpointName="HttpIn" />
          <Binding name="HttpsIn" endpointName="HttpsIn" />
        </Bindings>
      </Site>
    </Sites>
    <Endpoints>
      <InputEndpoint name="HttpIn" protocol="http" port="80" localPort="80" />
      <InputEndpoint name="HttpsIn" protocol="https" port="443" localPort="443" certificate="HTTPS" />
      <InputEndpoint name="Microsoft.WindowsAzure.Plugins.WebDeploy.InputEndpoint" protocol="tcp" port="8172" localPort="8172" loadBalancerProbe="WebDeploy" />
      <!-- unused, just there so instance discovery works -->
      <InternalEndpoint name="UnusedInternal" protocol="http" port="88" />
    </Endpoints>
    <Imports>
      <Import moduleName="Diagnostics" />
      <Import moduleName="RemoteAccess" />
      <Import moduleName="RemoteForwarder" />
      <Import moduleName="WebDeploy" />
    </Imports>
    <LocalResources>
      <LocalStorage name="Sites" cleanOnRoleRecycle="true" sizeInMB="2500" />
      <LocalStorage name="TempSites" cleanOnRoleRecycle="true" sizeInMB="2500" />
      <LocalStorage name="Execution" cleanOnRoleRecycle="true" sizeInMB="2500" />
      <LocalStorage name="Config" cleanOnRoleRecycle="true" sizeInMB="10" />
    </LocalResources>
    <ConfigurationSettings>
      <Setting name="DataConnectionString" />
      <Setting name="SyncEnabled" />
      <Setting name="SitesContainerName" />
      <Setting name="DirectoriesToExclude" />
      <Setting name="SyncIntervalInSeconds" />
    </ConfigurationSettings>
    <Certificates>
      <Certificate name="HTTPS" storeLocation="LocalMachine" storeName="My" />
    </Certificates>
  </WebRole>
</ServiceDefinition>
另一個是服務組態檔 (ServiceConfiguration.cscfg)，用來設定使用的 VM 作業系統類型與版本、虛擬機器數量、角色的設定值、憑證的使用等，這些設定在服務部署後仍然可以修改。如下列XML：
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="AzureWebFarm.Example.Cloud" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="3" osVersion="*" schemaVersion="2012-10.1.8">
  <Role name="AzureWebFarm.Example.Web">
    <Instances count="2" />
    <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
      <Setting name="DataConnectionString" value="UseDevelopmentStorage=true" />
      <Setting name="SyncEnabled" value="true" />
      <Setting name="SitesContainerName" value="sites" />
      <Setting name="DirectoriesToExclude" value="App_Data/TEMP;TEMP" />
      <Setting name="SyncIntervalInSeconds" value="60" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="admin" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="MIIBnQYJKoZIhvcNAQcDoIIBjjCCAYoCAQAxggFOMIIBSgIBADAyMB4xHDAaBgNVBAMME1dpbmRvd3MgQXp1cmUgVG9vbHMCEEF7rZmMJyaEREi+EJC4WpUwDQYJKoZIhvcNAQEBBQAEggEAQrruo8G67TRXvYsMWJQsLywZTz1X7KvEeyrCH2OtgmAzw/LoNrrD8xZMCuTcExlueCsiMjCn1utf3/Zvs+6CnyeZCpRfE3Px8giMEg2qDLJYY9Q85qnSYaU8Z1VEwZLtWH2FG9lgsXYaGyd2/GWeITCFOiPjBvRheB6dfG2LMXaj7gYe0MOinqqTpAbsdE1yRsU55iUmCpTbuGjXpQzUsOQtW5ZriQR3JfSEtXVWBhWnRVRVInCtxI/vlAHiLbtjwOiyCQOTlgjOvnz2ovb1Ykzi9dzrLGEMYTldeJffKD/OzJHdGBIkdjW/4BJORc7ZO4+7tLXqe7h9MBzaw2AEATAzBgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECDHnafJ4LBBbgBBpTi79EDhW34Woo0JED7Xx" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2013-01-30T23:59:59.0000000-08:00" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
    </ConfigurationSettings>
    <Certificates>
      <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="B6E8A99CB3B0174C053DAF5A48DACB504C5889EC" thumbprintAlgorithm="sha1" />
      <Certificate name="HTTPS" thumbprint="B6E8A99CB3B0174C053DAF5A48DACB504C5889EC" thumbprintAlgorithm="sha1" />
    </Certificates>
  </Role>
</ServiceConfiguration>