Tuesday, August 20, 2013

Azure role restart at role configuration update

I had a little trouble understanding what happens when Azure role configuration changes. According to the blog post I red, which comes first in the google search, instances should be recycled one by update domain, but I didn't see it happen. It was totally misleading.

Apperently, recycling is not the default behavior. You can only reboot if you subscribe to RoleEnvironment.Changing event and set RoleEnvironmentChangingEventArgs Cancel property to true. If there is no event handling, role keeps running.

It looked like recycling was default, because the code, that subscribed to RoleEnvironment.Changing and cancelling the event, was included into the role code template before SDK 1.3 as per this blog post.

What is more, there were no mentions in MSDN that default behavior is role recycling.

Lesson learned: be careful with blog posts :)