1
votes

To deploy my infrastructure I need to deploy a VM with a custom script extension. The only purpose of the VM, is to execute the script. After the execution of the script the VM should be deleted automatically.

How can this be done?

Additional information:

  • This is an azure resource manager deployment
  • the deletion should work in the azure marketplace environment as well.
1
You can take a look at Use Azure Container Instances as a Jenkins build agent. It will delete the ACI when the job finishes, but the Jenkins server will not delete. - Charles Xu
This is not supported in the marketplace (we won't allow you to provision compute and then delete it). - bmoore-msft

1 Answers

1
votes

this probably means you are doing something wrong, you can use Azure Container Instance to run the script and shutdown. it should work with marketplace as well (as far as I know you can have custom container in marketplace offerings).

Marketplace only allows you to use arm templates to deploy stuff, so you cannot really do what you are asking with an arm template. well, you might be able to hack something like that with nested deployments and complete mode, but I doubt that will pass moderation in marketplace.

technically, you can make vm delete itself as a part of the script. again, not something I would advise.