boot diagnostics policy enable by default and remediate with enabling if not enabled

Peter Wu 1 Reputation point
2020-04-02T01:09:45.443+00:00

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?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,205 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. bryanhaslip 26 Reputation points Microsoft Employee
    2020-04-02T06:15:50.577+00:00

    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.

    https://github.com/krnese/azure-policy-samples/tree/master/samples/Monitoring/audit-diagnostic-setting

    1 person found this answer helpful.
    0 comments No comments

  2. 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.

    0 comments No comments

  3. 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

    0 comments No comments