我已创建一个Azure的VM采用ARM模板,并希望VM部署后运行在同一个虚拟机VM 2个脚本扩展。
我如何能实现使用ARM的模板?
{
"apiVersion": "[variables('resourceDeploymentApiVersion')]",
"name": "[variables('vmTemplateName')]",
"type": "Microsoft.Resources/deployments",
"resourceGroup": "[parameters('vmGroupName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('vmTemplateURL')]"
},
"parameters": {},
}
}
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'),'/install-script')]",
"apiVersion": "[variables('computeApiVersion')]",
"location": "[variables('location')]",
"dependsOn": [
"[resourceId('Microsoft.Resources/deployments', variables('vmTemplateName'))]"
],
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"forceUpdateTag": "v.1.0",
"settings": {
"fileUris": ["[variables('installScript')]"]
},
"protectedSettings":{
"commandToExecute": "[concat('bash config.sh', ' ', parameters('key'))]"
}
}
},
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'),'/install-script')]",
"apiVersion": "[variables('computeApiVersion')]",
"location": "[variables('location')]",
"dependsOn": [
"[resourceId('Microsoft.Resources/deployments', variables('vmTemplateName'))]"
],
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"forceUpdateTag": "v.1.1",
"settings": {
"fileUris": ["[variables('installScript1')]"]
},
"protectedSettings":{
"commandToExecute": "[concat('bash config1.sh', ' ', parameters('key1'))]"
}
}
},
更新: -
目前,我正在运行,如下图所示相同的扩展config.sh和config1.sh。 但它运行了一个又一个。 我想这两个config.sh和config1.sh在同一时间使用扩展开始。
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'),'/install-script')]",
"apiVersion": "[variables('computeApiVersion')]",
"location": "[variables('location')]",
"dependsOn": [
"[resourceId('Microsoft.Resources/deployments', variables('vmTemplateName'))]"
],
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"forceUpdateTag": "v.1.1",
"settings": {
"fileUris": ["[variables('installScript1')]"]
},
"protectedSettings":{
"commandToExecute": "[concat('bash config1.sh', ' ', parameters('key1'), ' ', '&&', ' ', 'bash config.sh', ' ', parameters('key'))]"
}
}
},