How to delete a specific instance from a cloud service - PAAS V1

Special Thanks to my colleague Kevin Williamson for the idea and suggestion.

Please check this REST API command - delete Role Instances  https://msdn.microsoft.com/en-us/library/azure/dn469418.aspx
The API takes a specific role instance in the body. We can tell it to just delete a single instance.

<RoleInstances xmlns="https://schemas.microsoft.com/windowsazure" xmlns:i="https://www.w3.org/2001/XMLSchema-instance">
<Name>Role Instance name</Name>
</RoleInstances>

PAAS deployment with 3 instances -

paasv1deployment

POST - https://management.core.windows.net/\<subscription-id>/services/hostedservices/<cloudservice-name>/deployments/<deployment-name>/roleinstances/
URI Parameter - comp=delete

Note : You can use AzureTools to test the RESP API calls - https://blogs.msdn.microsoft.com/kwill/2013/08/26/azuretools-the-diagnostic-utility-used-by-the-windows-azure-developer-support-team/
You can navigate to the section in below screenshot, by clicking on “Misc tools” link after downloading the tool.

azurectstool_ink_ink_li

After the Delete API call, deployment has 2 instances -

paasv1deployment2