Azure DevTest Labs
An Azure service that is used for provisioning development and test environments.
263 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
If you past the supplied json file into the template, it will not validate and reports multiple errors:
In {
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "az104-08-vm1/customScriptExtension",
"apiVersion": "2018-06-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"az104-08-vm1"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.7",
"autoUpgradeMinorVersion": true,
"settings": {
"commandToExecute": "powershell.exe Install-WindowsFeature -name Web-Server -IncludeManagementTools && powershell.exe remove-item 'C:\\inetpub\\wwwroot\\iisstart.htm' && powershell.exe Add-Content -Path 'C:\\inetpub\\wwwroot\\iisstart.htm' -Value $($env:computername)"
}
}
},, the save bubble, block the end of the script, so you can't see how should be terminated
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "az104-08-vm1/customScriptExtension",
"apiVersion": "2018-06-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"az104-08-vm1"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.7",
"autoUpgradeMinorVersion": true,
"settings": {
"commandToExecute": "powershell.exe Install-WindowsFeature -name Web-Server -IncludeManagementTools && powershell.exe remove-item 'C:\\inetpub\\wwwroot\\iisstart.htm' && powershell.exe Add-Content -Path 'C:\\inetpub\\wwwroot\\iisstart.htm' -Value $($env:computername)"
}
}
},
There are duplicated JSON listed, was there a reason for this?
The provided JSON is missing some required elements for an Azure VM ARM template, which could be the reason for its failure. To further diagnose the issue, we would need the specific error message. Below is a more complete example with additional adjustments:
\\
).Updated example:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "az104-08-vm1/customScriptExtension",
"apiVersion": "2018-06-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"az104-08-vm1"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.7",
"autoUpgradeMinorVersion": true,
"settings": {
"commandToExecute": "powershell.exe Install-WindowsFeature -name Web-Server -IncludeManagementTools && powershell.exe remove-item 'C:\\inetpub\\wwwroot\\iisstart.htm' && powershell.exe Add-Content -Path 'C:\\inetpub\\wwwroot\\iisstart.htm' -Value $($env:computername)"
}
}
}
],
"outputs": {}
}