Create hot-swappable Cloud Service (extended support) with definition schema

67 Views Asked by At

I am working on migrating from Cloud Services (classic) to Cloud Services (extended support). The cloud service contains a web-role that uses a definition schema to specify the sites, endpoints, ...

I can create a new Cloud Service (extended support) using the New-AzCloudService command and specify the package, cloud service definition and cloud service configuration files. This works fine, but I can't set SlotType and SwappableCloudService.Id parameters of the network-profile. It will create the cloud service, but I can't use it to swap it with the production service.

To be able to allow the Cloud Service to swap with the production Cloud Service, both the SlotType and SwappableCloudService.Id should be set during creation. There is a New-AzCloudService command that accepts the -NetworkProfile parameter. Unfortunately, this command doesn't support to specify a definition schema. It requires the role to be set via the -RoleProfile parameter, but this parameter only seems to support the basic role parameters and not the complete definition schema.

So, what I actually want is to create a Cloud Service with a .csdef file and swap it with the production version. Just for reference, I have the following content in my CSDEF file:

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="CrossPoint.Azure.AnalyticsWeb" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
  <WebRole name="ExampleRole" vmsize="Standard_A2_v2">
    <!--
      Overview of the sites in the service
      -->
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="EndpointHttp" endpointName="EndpointHttp" />
          <Binding name="EndpointHttps" endpointName="EndpointHttps" />
        </Bindings>
      </Site>
    </Sites>
    <!--
      Define the endpoints of the website.
      -->
    <Endpoints>
      <InputEndpoint name="EndpointHttp" protocol="http" port="80" />
      <InputEndpoint name="EndpointHttps" protocol="https" port="443" certificate="example.com" />
    </Endpoints>
    <!-- 
      Install certificates in the worker role. This only specifies the name and
      location of the certificates. The actual certificate that are used are
      defined in the .cscfg file.
      -->
    <Certificates>
      <Certificate name="example.com" storeLocation="LocalMachine" storeName="My" />
    </Certificates>
    <!--
      This part runs separate scripts to install additional features. The
      logfiles that will be created from the separate scripts can be found at
      
        C:\Resources\Directory\[DeploymentID]\[Logfolder]
        -->
    <Startup>
      <!--
        InstallAgent takes care of installing the following features:
         1) Provide enhanced information for AppInsights dependency tracking
        -->
      <Task commandLine="RoleStart\InstallAgent.cmd" executionContext="elevated" taskType="simple">
        <Environment>
          <Variable name="ApplicationInsightsAgent.DownloadLink" value="http://go.microsoft.com/fwlink/?LinkID=522371" />
          <Variable name="RoleEnvironment.IsEmulated">
            <RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
          </Variable>
        </Environment>
      </Task>
    </Startup>
    <!--
      Configure the local storage resources to store data for this instance of
      the worker role. Note that this information is not persisted and should
      only be used for logfiles or other disposable data.
      -->
    <LocalResources>
      <LocalStorage name="Logs" cleanOnRoleRecycle="false" sizeInMB="16384" />
    </LocalResources>

    <!-- 
      Configuration settings (actual values defined in the .cscfg file)
    -->
    <ConfigurationSettings>
      <Setting name="myapp.sslBindings" />
    </ConfigurationSettings>
  </WebRole>
</ServiceDefinition>

Does anyone know how to create a cloud service that uses a .csdef file and can be swapped?

0

There are 0 best solutions below