Bylaw

Gallery › Monitoring › Azure built-in policies

[Deprecated]: Legacy - Enable Azure Monitor for VMs

Converted Initiative Version 2.2.0-deprecated Deprecated

Legacy - Enable Azure Monitor for the virtual machines (VMs) in the specified scope (management group, subscription or resource group). Takes Log Analytics workspace as parameter. Use the new initiative named: Enable Azure Monitor for VMs with Azure Monitoring Agent(AMA)

ConvertTo-Bylaw converted this initiative, and proved that the file compiles back to the same definition.

Azure Policy JSONAzureMonitor_VM.json · 94 lines
{
  "properties": {
    "displayName": "[Deprecated]: Legacy - Enable Azure Monitor for VMs",
    "policyType": "BuiltIn",
    "description": "Legacy - Enable Azure Monitor for the virtual machines (VMs) in the specified scope (management group, subscription or resource group). Takes Log Analytics workspace as parameter. Use the new initiative named: Enable Azure Monitor for VMs with Azure Monitoring Agent(AMA)",
    "metadata": {
      "version": "2.2.0-deprecated",
      "category": "Monitoring",
      "deprecated": true
    },
    "version": "2.2.0",
    "parameters": {
      "logAnalytics_1": {
        "type": "String",
        "defaultValue": "",
        "metadata": {
          "displayName": "Log Analytics workspace",
          "description": "Select Log Analytics workspace from dropdown list. If this workspace is outside of the scope of the assignment you must manually grant 'Log Analytics Contributor' permissions (or similar) to the policy assignment's principal ID.",
          "strongType": "omsWorkspace",
          "deprecated": true
        }
      },
      "listOfImageIdToInclude_windows": {
        "type": "Array",
        "defaultValue": [],
        "metadata": {
          "displayName": "Optional: List of VM images that have supported Windows OS to add to scope",
          "description": "Example value: '/subscriptions/<subscriptionId>/resourceGroups/YourResourceGroup/providers/Microsoft.Compute/images/ContosoStdImage'",
          "deprecated": true
        }
      },
      "listOfImageIdToInclude_linux": {
        "type": "Array",
        "defaultValue": [],
        "metadata": {
          "displayName": "Optional: List of VM images that have supported Linux OS to add to scope",
          "description": "Example value: '/subscriptions/<subscriptionId>/resourceGroups/YourResourceGroup/providers/Microsoft.Compute/images/ContosoStdImage'"
        }
      }
    },
    "policyDefinitions": [
      {
        "policyDefinitionReferenceId": "DependencyAgentExtension_Windows_HybridVM_Deploy",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/91cb9edd-cd92-4d2f-b2f2-bdd8d065a3d4",
        "definitionVersion": "2.*.*"
      },
      {
        "policyDefinitionReferenceId": "DependencyAgentExtension_Windows_VM_Deploy",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/1c210e94-a481-4beb-95fa-1571b434fb04",
        "definitionVersion": "3.*.*",
        "parameters": {
          "listOfImageIdToInclude": {
            "value": "[parameters('listOfImageIdToInclude_windows')]"
          }
        }
      },
      {
        "policyDefinitionReferenceId": "DependencyAgentExtension_Linux_HybridVM_Deploy",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/deacecc0-9f84-44d2-bb82-46f32d766d43",
        "definitionVersion": "2.*.*"
      },
      {
        "policyDefinitionReferenceId": "DependencyAgentExtension_Linux_VM_Deploy",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/4da21710-ce6f-4e06-8cdb-5cc4c93ffbee",
        "definitionVersion": "5.*.*",
        "parameters": {
          "listOfImageIdToInclude": {
            "value": "[parameters('listOfImageIdToInclude_linux')]"
          }
        }
      },
      {
        "policyDefinitionReferenceId": "DependencyAgent_OSImage_Audit",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/11ac78e3-31bc-4f0c-8434-37ab963cea07",
        "definitionVersion": "2.*.*",
        "parameters": {
          "listOfImageIdToInclude_windows": {
            "value": "[parameters('listOfImageIdToInclude_windows')]"
          },
          "listOfImageIdToInclude_linux": {
            "value": "[parameters('listOfImageIdToInclude_linux')]"
          }
        }
      }
    ],
    "versions": [
      "2.2.0",
      "2.1.0",
      "2.0.1"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policySetDefinitions/55f3eceb-5573-4f18-9695-226972c6d74a",
  "name": "55f3eceb-5573-4f18-9695-226972c6d74a"
}
Bylaw55f3eceb-5573-4f18-9695-226972c6d74a.bylaw.ps1 · 72 lines
# Converted from AzureMonitor_VM.json by ConvertTo-Bylaw.
Initiative '55f3eceb-5573-4f18-9695-226972c6d74a' {

    Properties @{
        DisplayName   = '[Deprecated]: Legacy - Enable Azure Monitor for VMs'
        Description   = 'Legacy - Enable Azure Monitor for the virtual machines (VMs) in the specified scope (management group, subscription or resource group). Takes Log Analytics workspace as parameter. Use the new initiative named: Enable Azure Monitor for VMs with Azure Monitoring Agent(AMA)'
        Version       = '2.2.0-deprecated'
        Category      = 'Monitoring'
        Deprecated    = $true
        PolicyVersion = '2.2.0'
    }

    Parameter LogAnalytics_1 @{
        Default     = ''
        DisplayName = 'Log Analytics workspace'
        Description = 'Select Log Analytics workspace from dropdown list. If this workspace is outside of the scope of the assignment you must manually grant ''Log Analytics Contributor'' permissions (or similar) to the policy assignment''s principal ID.'
        Metadata    = [ordered]@{ strongType = 'omsWorkspace'; deprecated = $true }
    }
    Parameter ListOfImageIdToInclude_windows @{
        Type        = 'Array'
        Default     = @()
        DisplayName = 'Optional: List of VM images that have supported Windows OS to add to scope'
        Description = 'Example value: ''/subscriptions/<subscriptionId>/resourceGroups/YourResourceGroup/providers/Microsoft.Compute/images/ContosoStdImage'''
        Metadata    = [ordered]@{ deprecated = $true }
    }
    Parameter ListOfImageIdToInclude_linux @{
        Type        = 'Array'
        Default     = @()
        DisplayName = 'Optional: List of VM images that have supported Linux OS to add to scope'
        Description = 'Example value: ''/subscriptions/<subscriptionId>/resourceGroups/YourResourceGroup/providers/Microsoft.Compute/images/ContosoStdImage'''
    }

    PolicyDefinition @{
        Id          = '91cb9edd-cd92-4d2f-b2f2-bdd8d065a3d4'
        ReferenceId = 'DependencyAgentExtension_Windows_HybridVM_Deploy'
        Version     = '2.*.*'
    }

    PolicyDefinition @{
        Id          = '1c210e94-a481-4beb-95fa-1571b434fb04'
        ReferenceId = 'DependencyAgentExtension_Windows_VM_Deploy'
        Version     = '3.*.*'
        Parameters  = @{
            listOfImageIdToInclude = (Param ListOfImageIdToInclude_windows)
        }
    }

    PolicyDefinition @{
        Id          = 'deacecc0-9f84-44d2-bb82-46f32d766d43'
        ReferenceId = 'DependencyAgentExtension_Linux_HybridVM_Deploy'
        Version     = '2.*.*'
    }

    PolicyDefinition @{
        Id          = '4da21710-ce6f-4e06-8cdb-5cc4c93ffbee'
        ReferenceId = 'DependencyAgentExtension_Linux_VM_Deploy'
        Version     = '5.*.*'
        Parameters  = @{
            listOfImageIdToInclude = (Param ListOfImageIdToInclude_linux)
        }
    }

    PolicyDefinition @{
        Id          = '11ac78e3-31bc-4f0c-8434-37ab963cea07'
        ReferenceId = 'DependencyAgent_OSImage_Audit'
        Version     = '2.*.*'
        Parameters  = [ordered]@{
            listOfImageIdToInclude_windows = (Param ListOfImageIdToInclude_windows)
            listOfImageIdToInclude_linux   = (Param ListOfImageIdToInclude_linux)
        }
    }
}

Members (5)

Source: built-in-policies/policySetDefinitions/Monitoring/AzureMonitor_VM.json in Azure/azure-policy, under the MIT licence.