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.
Hi Joseph,
Thanks for this detailed explanation of the scriptBehaviorAfterReboot feature - it addresses exactly the challenge we're facing with VM Applications and domain joining scenarios.
I wanted to ask about the roadmap for broader tooling support. You mentioned that "CLI and PowerShell have not been updated yet" - are there any updates on when Azure CLI might support this property? Also, do you know if there are plans to expose this in the underlying REST API endpoints that third-party tools like the Terraform AzureRM provider rely on? Currently HashiCorp's provider doesn't support this property, presumably because it's not available in...