{ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "apiProfile": "2018-03-01-hybrid", "parameters": { "vmName": { "type": "string", "metadata": { "description": "Name of the existing VM to apply the custom script to" }, "defaultvalue": "[substring(concat('simplewinvm',resourceGroup().Name),0,12)]" } }, "variables": { }, "resources": [ { "type": "Microsoft.Compute/virtualMachines/extensions", "name": "[concat(parameters('vmName'),'/CustomScriptExtension')]", "location": "[resourceGroup().location]", "properties": { "publisher": "Microsoft.Compute", "type": "CustomScriptExtension", "typeHandlerVersion": "1.8", "autoUpgradeMinorVersion": "true", "settings": { "commandToExecute": "powershell -ExecutionPolicy Unrestricted Set-DnsClientServerAddress -InterfaceAlias (Get-NetAdapter).Name -ServerAddresses 192.168.100.2, 8.8.8.8" } } } ], "outputs": {} }