We have a solution running on some 140vms in an Azure VMSS.
How do I enable any of these memory dump options through the ARM Template?
Barring that, how could I enable it with a PowerShell script?
We have a solution running on some 140vms in an Azure VMSS.
How do I enable any of these memory dump options through the ARM Template?
Barring that, how could I enable it with a PowerShell script?
Yes, you can add the information to your ARM Template using DSC or CSE but the ksy is what in the script. Below is sample information that should be in the script, enableDump.ps1
# Setup the Guest OS to collect a kernel dump on an OS crash event
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl' -name CrashDumpEnabled -Type DWord -force -Value 2
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl' -name DumpFile -Type ExpandString -force -Value "%SystemRoot%\MEMORY.DMP"
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl' -name NMICrashDump -Type DWord -force -Value 1
Reference to values in script; https://support.microsoft.com/en-us/help/254649/overview-of-memory-dump-file-options-for-windows
CustomScript setting in Arm Template can be as simple as;
{
"type": "extensions",
"name": "CustomScriptExtension",
"apiVersion": "2017-03-30",
"location": "[parameters('location')]",
"dependsOn": [
"[variables('vmName')]"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.8",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"https://xxxxxxx.blob.core.windows.net/buildServer1/enableDump.ps1"
],
"commandToExecute": "powershell -ExecutionPolicy Unrestricted -File ./EnableCrashDump.ps1"
}
}
}
Hope this helps.
You cant do that with ARM Template, you can, however, use script or powershell dsc extension (as part of the arm template) to configure that. examples of those extensions:
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'),'/installcustomscript')]",
"apiVersion": "2015-05-01-preview",
"location": "[parameters('location')]",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"[concat(parameters('_artifactsLocation'), '/scripts/hello.sh')]"
],
"commandToExecute": "[parameters('commandToExecute')]"
}
}
},
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('vmName'),'/enabledsc')]",
"location": "[parameters('location')]",
"properties": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "2.0",
"settings": {
"Mode": "[parameters('mode')]",
"FileUri": "[parameters('fileUri')]"
},
"protectedSettings": {
"StorageAccountName": "[parameters('storageAccountName')]",
"StorageAccountKey": "[parameters('storageAccountKey')]",
"RegistrationUrl": "[parameters('registrationUrl')]",
"RegistrationKey": "[parameters('registrationKey')]"
}
}
}
Reading:
https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-windows
https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/dsc-overview