One confusion around all of our extensions is: how are reboots handled? This varies by extension, but only VM Applications provide the option on how to handle them. It does this via the “scriptBehaviorAfterReboot” property.
“resources”: [
{
“type”: “Microsoft.Compute/galleries/applications/versions”,
“apiVersion”: “2024-03-03”,
“name”: “[concat(parameters(‘galleries_mygallery_name’), ‘/’, parameters(‘applicationDefinitionName’), ‘/’, parameters(‘version’))]”,
“location”: “[parameters(‘resourceLocation’)]”,
“properties”: {
“publishingProfile”: {
“source”: {
“mediaLink”: “[parameters(‘servicePackageLink’)]”
},
“manageActions”: {
“install”: “[parameters(‘installScript’)]”,
“remove”: “echo \”Done\””
},
“settings”: {
“packageFileName”: “[parameters(‘packageFileName’)]”,
“scriptBehaviorAfterReboot”:”Rerun”
},
“enableHealthCheck”: false,
“targetRegions”: “[parameters(‘replicationLocations’)]”,
“replicaCount”: 3,
“excludeFromLatest”: false,
“storageAccountType”: “Standard_ZRS”
},
“safetyProfile”: {
“allowDeletionOfReplicatedLocations”: true
}
}
}
]
Note that, as above, the API version used must be at least 2024-03-03 for this to work.
Valid values are:
Value | Action |
None | Take no action after a reboot |
Rerun | Run the script again after a reboot |
There are some things to keep in mind:
- This is currently only enabled for ARM templates. CLI and Powershell have not been updated yet.
- If the option “Rerun” is chosen, then it will apply to all scripts for the application – install, update, and remove.
- Your scripts must be idempotent if Rerun is chosen. We currently do not inform the script whether a reboot has just occurred.
- After three reboots, we will not execute the script again even if Rerun is specified. This is to prevent a non-idempotent script from continuously rebooting a machine.
0 comments
Be the first to start the discussion.