question

LukeUhren-6505 avatar image
0 Votes"
LukeUhren-6505 asked Monalla-MSFT commented

run 2 custom script extensions linux scaleset

Is there a way to run 2 custom script extensions for a linux vm scaleset when deploying via ARM Template?

As of right now I can't as it give me the following error....

Showing 1 out of 1 error(s). Status Message: Multiple VMExtensions per handler not supported for OS type
| 'Linux'. VMExtension 'Microsoft.Azure.Extensions' with handler 'CustomScript' already added or specified in input.


The ARM code is example in the extensionProfile section

"extensionProfile": {
"extensions": [
{
"name": "script1",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"forceUpdateTag": "v1.0",
"settings": {
"fileUris": [
"[concat(parameters('scriptURL'), parameters('scriptName'))]"
]
},
"protectedSettings": {
"commandToExecute": "sh test.sh",
"storageAccountName": "[parameters('storageaccoutname')]",
"storageAccountKey": "[parameters('storageaccountkey')]"
}
}
},
{
"name": "script2",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"forceUpdateTag": "v1.1",
"settings": {
"fileUris": [
"[concat(parameters('scriptURL'), parameters('scriptName'))]"
]
},
"protectedSettings": {
"commandToExecute": "sh test2.sh",
"storageAccountName": "[parameters('storageaccoutname')]",
"storageAccountKey": "[parameters('storageaccountkey')]"
}
}
}
]
}

Referencing this page ...https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-linux

It says You can only have one version of an extension applied to the VM. In order to run a second custom script, you can update the existing extension with new configuration. Alternatively, you can remove the custom script extension and reapply it again with the updated script.

Which I don't really understand as that to me isn't possible to do while deploying via ARM template deployment that I am aware of... so I assume this means to update after the fact once it's deployed with just the 1 in the template.

If anyone can confirm that would be great


Thanks

azure-virtual-machines-extension
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

LukeUhren-6505 avatar image
0 Votes"
LukeUhren-6505 answered Monalla-MSFT commented

So far I think 2 extensions is not possible, but running 2 scripts in the same extension is. They seem to run sequential as well which is what I wanted, and not sure how to run in parallel if someone wanted though.

Example edit command to execute like

"commandToExecute": "[concat('sh ', variables('sshScript'), ' ', '&&', ' ', 'sh samloscotest.sh')]",

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @LukeUhren-6505 - Thank you for reaching out. I am looking into this and will get back to you shortly.

0 Votes 0 ·