This is done through Azure policy. Please leverage this built in policy and target Microsoft.Compute virtualMachines. You will create a deployIfNotExists as a part of the policy definition. If not the default will audit and enforce for new resources.
boot diagnostics policy enable by default and remediate with enabling if not enabled
How to enable boot diagnostics to troubleshoot virtual machines through policy and remediate with enabling if not enabled?
I know there is the documentation to enable boot diagnostics: https://learn.microsoft.com/en-us/azure/virtual-machines/troubleshooting/boot-diagnostics
but how can we enforce this feature by default?
3 answers
Sort by: Most helpful
-
bryanhaslip 26 Reputation points Microsoft Employee
2020-04-02T06:15:50.577+00:00 -
EDDY GARCIA GALDAMES 1 Reputation point
2021-05-12T21:37:03.23+00:00 @bryanhaslip I don't see how Microsoft.Insights/diagnosticSettings is the same as Microsoft.Compute/virtualMachines/diagnosticsProfile.bootDiagnostics?
What this policy enables is Monitoring Insights, providing Platform logs. Where as Boot Diagnostics provides screenshots of the splash screen and serial console information. I understand this can be deployed via the portal or via powershell. https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/boot-diagnostics#enable-boot-diagnostics-on-existing-virtual-machine
However, I would also like to deploy this via a policy. I stumbled across what seemed like a gem. https://github.com/Azure/azure-policy/issues/154
Alas, I'm unable to fully understand if what is required is simply the storage account name or the storage account URI. Specially when wanting to use a storage account in a different subscription.
-
Naveen Begur nagaraj 121 Reputation points
2021-06-11T06:50:44.877+00:00 I tried the policy, but it is not worked as expected