How to set the Role when I deploy using the Azure Cloud services and changing the variable based on it


I have 2 different projects (Web and worker) that are deployed using the Azure cloud services. I have set a variable set for defining the Azure Cloud services based on the environment but I also need this values to be changed for the type of role. I cannot see any place to set the Role when I deploy using the Deploy Azure Cloud services in octopus deploy server.


Azure Cloud services Name: Dev (Environment) - Web (Role) : dev-web
Dev (Environment) - worker (Role) : dev-worker

Azure Cloud services Name: QA (Environment) - Web (Role) : qa-web
QA (Environment) - worker (Role) : qa-worker

Azure Cloud services Name: live (Environment) - Web (Role) : live-web
live (Environment) - worker (Role) : live-worker

So, basically, I will have 6 variable in the variable set which changes based on the environment and the role.

Please give your thoughts and suggestions about this, much appreciated.



Thanks for getting in touch! I think you’re right on the money with having variables scoped to both environment and role. This should differentiate your cloud services based on where they’re deploying, as each variable will be very specifically scoped. It’s exactly what I would have suggested. :slight_smile:

Let me know how you go and if you have any further questions going forward.

Best regards,


Hi Kenny,

Thanks for the suggestion. Yes, having variables scoped for both environment and role is a good option. My question was how to set the roles for to Deploy to cloud services step. Please guide me.


Hi Vimal,

Thanks for following up! You can assign a role to a cloud region, then set your cloud services step to Run on server on behalf of role. Then scope the step to the various roles assigned to those cloud regions, which should achieve what you’ve described. :slight_smile:

Let me know how you go and if you have any further questions!

Best regards,


Yes, Thanks for the input. Much appreciated.