Search code examples
azureazure-cloud-services

Deploy an azure cloud service automatically - not within Visual Studio/VSTS -


I have created in my VS2015 an azure cloud service with a worker role. These are 2 projects.

I want to know how can I pack and then publish this cloud service with a tool/cli?

When I google for 'deploy azure cloud service' I get only result saying to do it within Visual Studio or Visual Studio Team System.

This is NOT what I want!


Solution

  • We can use the cspack command line tool to package a cloud service. If the application only contains worker role, you could refer to the following command.

    cspack D:\xxx\xxx\ServiceDefinition.csdef /role:WorkerRole1;D:\xxx\WorkerRole1\bin;D:\xxx\WorkerRole1\bin\Debug\WorkerRole1.dll
    

    And you could refer to the PublishCloudService.ps1 script template in this article.

    cspack could not be found in the powershell commandlets

    The cspack could run in Windows PowerShell on my side. I add C:\Program Files\Microsoft SDKs\Azure\.NET SDK\[sdk-version]\bin in Path system environment variables, and I could run the following command to package a cloud service.

    enter image description here