In all of our previous examples, CustomScriptExtension has been a child resource of a virtual machine or created as a nested resource. It is possible, however, to declare the customscriptextensions resource as a separate resource outside of a virtual machine. The difference in declaring customscriptextension as a separate resource allows you to create reusable modular ARM templates even when the extension resource has been defined in a different ARM template file.
While declaring customscriptextension as a separate resource, there are changes to be noted in the way both the name and type properties are assigned. The name property should be qualified with the name of the virtual machine, and the type property should be a complete property with virtualmachines included as part of it.
The following snippet is an example of customscriptextension...