Decrypting Windows Azure Package (CSPKG) in Windows Azure SDK

When you build your Windows Azure Application the final
products is a CSPKG file which is uploaded to Windows Azure portal along with ServiceConfiguration.cscfg.
The CSPKG file actually a ZIP file which consist your whole solution along with
configuration needed to deploy your solution in Windows Azure.

If you look inside the CSPKG file you will see a file with
extension CSSX name as Your_Role_Name_GUID.cssx and this file also is a ZIP
file however this file is initially encrypted by MSBuild process. You can decrypt
this file if you wish to do so by using any of the below described method:

1: Modifying MSBuild properties for “CorePublish” target and CPACK command (Applicable
to Windows Azure SDK 1.3)

  1. Go to C:\Program Files (x86)\MSBuild\Microsoft\Cloud
    Service\1.0\Visual Studio 10.0
  2. Open Microsoft.CloudService.targets in any text Editor
  3. Look for the target names as CorePublish and setup
    NoEncryptPackage property to “True” as below inside the CSPACK Command within
    the target


Completed “CorePublish” target should look like as below:




Text=”CorePublish: PackageWebRole = $(PackageWebRole)” />

Text=”Publishing starting…” />

Text=”RolePlugins       is
@(RoleProperties->’%(RolePlugins)’)” />

Text=”Publishing to ‘$(OutDir)Publish'” />

Directories=” $(OutDir)Publish ” />

Text=”ServiceDefinitionCopy is @(ServiceDefinitionCopy)” />

Text=”ServiceConfigurationCopy is @(ServiceConfigurationCopy)”

Text=”Roles is @(Roles)” />











    <!– Copy service
configuration to output directory –>

Text=”Copying the service configuration file.” />

DestinationFolder=”$(OutDir)Publish” />

Text=”DiagnosticsFilesCreated is @(DiagnosticsFilesCreated)” />

Files=”@(DiagnosticsFilesCreated)” ContinueOnError=”true”

Text=”Publishing process has completed.”/>




2: Setting Up Environment Variable (Applicable to all Windows Azure SDK)

You can set environment variable _CSPACK_FORCE_NOENCRYPT_ to “true”
which will force the build system to generate an unencrypted package. This method
applies for Windows Azure SDK 1.2 and 1.3. 



Comments (1)

  1. Prateek says:

    Hi Avkash,i followed the stepus you mentioned and was successful in decrypting the package.Now my question is,where can i find the service definition file(.csdef) in the service package file that has been decompressed??