Self destroy linux instance in Azure Virtual Machine Scale Sets
To use this script, first you need to create an Azure Service Principal through Azure CLI or Azure portal.
Define the following environment variables
Inside the Dockerfile or use the -e option
TENANT_ID = {Directory Id}
CLIENT_ID = {Serivce Principal Id}
CLIENT_SECRET = {Service Principal Secret}
SUBSCRIPTION_ID = {Subscripton Id}
RESOURCE_GROUP = {Resource group name} // Until it will be included in the VM Instance metadata
export TENANT_ID = {Directory Id}
export CLIENT_ID = {Serivce Principal Id}
export CLIENT_SECRET = {Service Principal Secret}
export SUBSCRIPTION_ID = {Subscripton Id}
export RESOURCE_GROUP = {Resource group name} // Until it will be included in the VM Instance metadata