I will describe how this schema works for single VM with running Linux/Jelastic. So first of all let check that do we have for that VM by using Get-AzureDeployment command and then let go deep that happened inside that file

PS C:\> Switch-AzureMode -Name AzureServiceManagement
PS C:\> Get-AzureDeployment -ServiceName "abokov-jelastic"
VERBOSE: 11:12:40 - Begin Operation: Get-AzureDeployment
VERBOSE: 11:12:45 - Completed Operation: Get-AzureDeployment

SdkVersion :
RollbackAllowed : False
Slot : Production
Name : abokov-jelastic
DeploymentName : abokov-jelastic
Url : http://abokov-jelastic.cloudapp.net/
Status : Running
CurrentUpgradeDomain : 0
CurrentUpgradeDomainState :
UpgradeType :
RoleInstanceList : {abokov-jelastic}
Configuration             : <ServiceConfiguration xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns=”http://schemas.microsoft.com/ServiceHosting/2008/
10/ServiceConfiguration”>
<Role name=”abokov-jelastic”>
<Instances count=”1″ />
</Role>
</ServiceConfiguration>
DeploymentId : e3161b202bae4d989e79eee6aeb46fdb
Label : abokov-jelastic
VNetName : Group Group abokov-jelastic
DnsSettings :
OSVersion :
RolesConfiguration : {[abokov-jelastic, Microsoft.WindowsAzure.Commands.ServiceManagement.Model.RoleConfiguration]}
VirtualIPs : {abokov-jelasticContractContract}
ReservedIPName :
CreatedTime : 05.05.2015 15:32:11
LastModifiedTime : 07.05.2015 11:12:43
Locked : False
InternalLoadBalancerName :
LoadBalancers : {}
ServiceName : abokov-jelastic
OperationDescription : Get-AzureDeployment
OperationId : de6cbffc-6f27-906d-8688-14d082706bc6
OperationStatus : Succeeded

 

So now let’s get configuration field from that output and save it to file

PS C:\> $deployment = Get-AzureDeployment -ServiceName "abokov-jelastic"
VERBOSE: 11:41:24 - Begin Operation: Get-AzureDeployment
VERBOSE: 11:41:29 - Completed Operation: Get-AzureDeployment
PS C:\> $configuration = [xml]$deployment.Configuration
PS C:\> $configuration.Save("c:\tools\projects\my_service.cscfg")
PS C:\> more C:\tools\projects\my_service.cscfg
<ServiceConfiguration xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns=”http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration”>
<Role name=”abokov-jelastic”>
<Instances count=”1″ />
</Role>
</ServiceConfiguration>

 

 

This example is quite simple and related to VM, but commonly said structure of that file looks like that

<ServiceConfiguration serviceName=”<service-name>” osFamily=”<osfamily-number>” osVersion=”<os-version>” schemaVersion=”<schema-version>”>
<Role …>

</Role>
<NetworkConfiguration>

</NetworkConfiguration>
</ServiceConfiguration>

 

Let’s go deeper in RoleElement
<ServiceConfiguration>
  <Role name="<role-name>" vmName="<vm-name>">
    <Instances count="<number-of-instances>"/>    
    <ConfigurationSettings>
      <Setting name="<setting-name>" value="<setting-value>" />
    </ConfigurationSettings>
    <Certificates>
      <Certificate name="<certificate-name>" thumbprint="<certificate-thumbprint>" thumbprintAlgorithm="<algorithm>"/>
    </Certificates>  
  </Role>
</ServiceConfiguration>

 

So cscfg file (Azure Service Configuration file ) can be user for scale-up/down cloud service changing “Instance count” value.

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<ServiceConfiguration xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="2" osVersion="*" serviceName="AzureDeploymentProject">
<Role name="WorkerRole1" vmName="my-super-service">
<Instances count="1"/>
<ConfigurationSettings>
<Setting name="my_settings" value="test"/>
</ConfigurationSettings>
<Certificates>
<Certificate name="cert_name" thumbprint="CertThumbprint" thumbprintAlgorithm="sha1"/>
</Certificates>
</Role>
</ServiceConfiguration>

Leave a Reply