As you can see I am always using the latest API version. This approach is a bit risky, because things in the template can get broken quickly with an newly API version released on the Azure platform. So the latest API version right now is 2017-04-26-preview and this version works without any issues.

Beside the API version you also have to modify name, dependsOn and targetResourceId to get it running in your ARM template.

Name is the name of the resource as shown in the Azure portal or through API calls after the resource is successfully deployed.

Last but not least, we need dependsOn to specify the dependency on the VM. So the VM will be deployed first before we start the configuration. The targetResourceId directly links to the VM we would like to configure with the auto-shutdown feature.