You can invoke and configure Microsoft Azure boot diagnostics from an Azure instance in a cloud template. In addition you can also configure log analytics for an Azure virtual machine instance. Boot diagnostics is a debugging feature for Azure virtual machines that facilitates diagnostics for virtual machine boot failures. Using boot diagnostics, a user can monitor the state of a virtual machine as it is booting up by collecting serial log information and screenshots.

Boot Diagnostics

Boot diagnostics captures serial log information and screenshots and these needs to be saved to the disk. The disk can be of two types, Azure Managed Disk or Unmanaged Disk.

The bootDiagnostics YAML property is supported in Azure cloud templates. When this property is set to true, boot diagnostics are enabled on the applicable Azure virtual machine deployment.

The following YAML snippet shows an example of how the bootDiagnostics property is used.
formatVersion: 1
inputs: {}
resources:
  Cloud_Azure_Machine_1:
    type: Cloud.Azure.Machine
    metadata:
      layoutPosition:
        - 0
        - 0
    properties:
      image: ubuntu
      flavor: small
      bootDiagnostics: true

Boot diagnostics can also be invoked on a deployed Azure virtual machine as a day 2 operation. Navigate to the Deployments page in Automation Assembler and select the Azure deployment. The Actions menu on this page enables you to toggle between Enable Boot Diagnostics and Disable Boot Diagnostics.

After you have deployed a cloud template with boot diagnostics enabled, the Automation Assembler Deployments page for the deployment will indicate that boot diagnostics are enabled. If you want to disable boot diagnostics, click the Actions menu on the Deployments page and select Disable Boot Diagnostics.

Log Analytics

Log Analytics enables you to edit and run log queries on data collected by Azure Monitor Logs, and then interactively analyze the results. You can use Log Analytics queries to retrieve records that match specific criteria to help identify trends and patterns and provide a variety of data insights. By enabling Log Analytics on a Azure virtual machine, that machine will act as a data source.

Before you can configure log analytics in an Automation Assembler cloud template, you must create and configure an Azure Log Analytics workspace. You can do this using the Virtual Machines option in the Azure Monitor menu. See the Microsoft Azure documentation for more information.

To configure log analytics, you must have the Azure Workspace ID and Workspace Key. You can find these on the Agent Management tab in Azure under the Log Analytics Workspace.

The following cloud template example shows how log analytics can be configured using extensions.

formatVersion: 1
inputs: {}
resources:
  Cloud_Azure_Machine_1:
    type: Cloud.Azure.Machine
    properties:
      image: ubuntu
      flavor: small
      extensions:
        - autoUpgradeMinorVersion: true
          name: test-loga
          protectedSettings:
            workspaceKey: xxxxxxxxx
          publisher: Microsoft.EnterpriseCloud.Monitoring
          settings:
            workspaceId: aaaaaaaaa
          type: OmsAgentForLinux
          typeHandlerVersion: '1.0'

After you have deployed a cloud template with Log Analytics enabled, you can enable or disable it using the Actions menu options on the Automation Assembler Deployments page for the deployment.