Bylaw

Gallery › Guest Configuration › Azure built-in policies

[Deprecated]: Audit Windows VMs that have not restarted within the specified number of days

Converted Initiative Version 1.0.0-deprecated Deprecated

This initiative deploys the policy requirements and audits Windows virtual machines that have not restarted within the specified number of days. For more information on Guest Configuration policies, please visit https://aka.ms/gcpol

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

Azure Policy JSONMachineLastBootUpTime.json · 45 lines
{
  "properties": {
    "displayName": "[Deprecated]: Audit Windows VMs that have not restarted within the specified number of days",
    "policyType": "BuiltIn",
    "description": "This initiative deploys the policy requirements and audits Windows virtual machines that have not restarted within the specified number of days. For more information on Guest Configuration policies, please visit https://aka.ms/gcpol",
    "metadata": {
      "version": "1.0.0-deprecated",
      "category": "Guest Configuration",
      "deprecated": true
    },
    "version": "1.0.0",
    "parameters": {
      "NumberOfDays": {
        "type": "string",
        "metadata": {
          "displayName": "Number of days",
          "description": "The number of days without restart until the machine is considered non-compliant"
        },
        "defaultValue": "12"
      }
    },
    "policyDefinitions": [
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/f4b245d4-46c9-42be-9b1a-49e2b5b94194",
        "definitionVersion": "1.*.*",
        "policyDefinitionReferenceId": "Deploy_MachineLastBootUpTime",
        "parameters": {
          "NumberOfDays": {
            "value": "[parameters('NumberOfDays')]"
          }
        }
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/7e84ba44-6d03-46fd-950e-5efa5a1112fa",
        "definitionVersion": "1.*.*",
        "policyDefinitionReferenceId": "Audit_MachineLastBootUpTime"
      }
    ],
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policySetDefinitions/b8b5b0a8-b809-4e5d-8082-382c686e35b7",
  "name": "b8b5b0a8-b809-4e5d-8082-382c686e35b7"
}
Bylawb8b5b0a8-b809-4e5d-8082-382c686e35b7.bylaw.ps1 · 31 lines
# Converted from MachineLastBootUpTime.json by ConvertTo-Bylaw.
Initiative 'b8b5b0a8-b809-4e5d-8082-382c686e35b7' {

    Properties @{
        DisplayName   = '[Deprecated]: Audit Windows VMs that have not restarted within the specified number of days'
        Description   = 'This initiative deploys the policy requirements and audits Windows virtual machines that have not restarted within the specified number of days. For more information on Guest Configuration policies, please visit https://aka.ms/gcpol'
        Version       = '1.0.0-deprecated'
        Category      = 'Guest Configuration'
        Deprecated    = $true
        PolicyVersion = '1.0.0'
    }

    Parameter NumberOfDays @{
        Type        = 'string'
        Default     = '12'
        DisplayName = 'Number of days'
        Description = 'The number of days without restart until the machine is considered non-compliant'
        JsonName    = 'NumberOfDays'
    }

    PolicyDefinition @{
        Id          = 'f4b245d4-46c9-42be-9b1a-49e2b5b94194'
        ReferenceId = 'Deploy_MachineLastBootUpTime'
        Version     = '1.*.*'
        Parameters  = @{
            NumberOfDays = (Param NumberOfDays)
        }
    }

    PolicyDefinition -Id '7e84ba44-6d03-46fd-950e-5efa5a1112fa' -ReferenceId 'Audit_MachineLastBootUpTime' -Version '1.*.*'
}

Members (2)

Source: built-in-policies/policySetDefinitions/Guest Configuration/MachineLastBootUpTime.json in Azure/azure-policy, under the MIT licence.