Bylaw

Gallery › Monitoring › Azure built-in policies

[Deprecated]: Legacy - Enable Azure Monitor for Virtual Machine Scale Sets

Converted Initiative Version 1.2.0-deprecated Deprecated

Legacy - Enable Azure Monitor for the Virtual Machine Scale Sets 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 VMSS with Azure Monitoring Agent(AMA). Note: if your scale set upgradePolicy is set to Manual, you need to apply the extension to the all VMs in the set by calling upgrade on them. In CLI this would be az vmss update-instances.

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

Azure Policy JSONAzureMonitor_VMSS.json · 84 lines
{
  "properties": {
    "displayName": "[Deprecated]: Legacy - Enable Azure Monitor for Virtual Machine Scale Sets",
    "policyType": "BuiltIn",
    "description": "Legacy - Enable Azure Monitor for the Virtual Machine Scale Sets 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 VMSS with Azure Monitoring Agent(AMA). Note: if your scale set upgradePolicy is set to Manual, you need to apply the extension to the all VMs in the set by calling upgrade on them. In CLI this would be az vmss update-instances.",
    "metadata": {
      "version": "1.2.0-deprecated",
      "category": "Monitoring",
      "deprecated": true
    },
    "version": "1.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_VMSS_Deploy",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/3be22e3b-d919-47aa-805e-8985dbeb0ad9",
        "definitionVersion": "3.*.*",
        "parameters": {
          "listOfImageIdToInclude": {
            "value": "[parameters('listOfImageIdToInclude_windows')]"
          }
        }
      },
      {
        "policyDefinitionReferenceId": "DependencyAgentExtension_Linux_VMSS_Deploy",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/765266ab-e40e-4c61-bcb2-5a5275d0b7c0",
        "definitionVersion": "5.*.*",
        "parameters": {
          "listOfImageIdToInclude": {
            "value": "[parameters('listOfImageIdToInclude_linux')]"
          }
        }
      },
      {
        "policyDefinitionReferenceId": "DependencyAgent_OSImage_VMSS_Audit",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/e2dd799a-a932-4e9d-ac17-d473bc3c6c10",
        "definitionVersion": "2.*.*",
        "parameters": {
          "listOfImageIdToInclude_windows": {
            "value": "[parameters('listOfImageIdToInclude_windows')]"
          },
          "listOfImageIdToInclude_linux": {
            "value": "[parameters('listOfImageIdToInclude_linux')]"
          }
        }
      }
    ],
    "versions": [
      "1.2.0",
      "1.1.0",
      "1.0.2"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policySetDefinitions/75714362-cae7-409e-9b99-a8e5075b7fad",
  "name": "75714362-cae7-409e-9b99-a8e5075b7fad"
}
Bylaw75714362-cae7-409e-9b99-a8e5075b7fad.bylaw.ps1 · 60 lines
# Converted from AzureMonitor_VMSS.json by ConvertTo-Bylaw.
Initiative '75714362-cae7-409e-9b99-a8e5075b7fad' {

    Properties @{
        DisplayName   = '[Deprecated]: Legacy - Enable Azure Monitor for Virtual Machine Scale Sets'
        Description   = 'Legacy - Enable Azure Monitor for the Virtual Machine Scale Sets 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 VMSS with Azure Monitoring Agent(AMA). Note: if your scale set upgradePolicy is set to Manual, you need to apply the extension to the all VMs in the set by calling upgrade on them. In CLI this would be az vmss update-instances.'
        Version       = '1.2.0-deprecated'
        Category      = 'Monitoring'
        Deprecated    = $true
        PolicyVersion = '1.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          = '3be22e3b-d919-47aa-805e-8985dbeb0ad9'
        ReferenceId = 'DependencyAgentExtension_Windows_VMSS_Deploy'
        Version     = '3.*.*'
        Parameters  = @{
            listOfImageIdToInclude = (Param ListOfImageIdToInclude_windows)
        }
    }

    PolicyDefinition @{
        Id          = '765266ab-e40e-4c61-bcb2-5a5275d0b7c0'
        ReferenceId = 'DependencyAgentExtension_Linux_VMSS_Deploy'
        Version     = '5.*.*'
        Parameters  = @{
            listOfImageIdToInclude = (Param ListOfImageIdToInclude_linux)
        }
    }

    PolicyDefinition @{
        Id          = 'e2dd799a-a932-4e9d-ac17-d473bc3c6c10'
        ReferenceId = 'DependencyAgent_OSImage_VMSS_Audit'
        Version     = '2.*.*'
        Parameters  = [ordered]@{
            listOfImageIdToInclude_windows = (Param ListOfImageIdToInclude_windows)
            listOfImageIdToInclude_linux   = (Param ListOfImageIdToInclude_linux)
        }
    }
}

Members (3)

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