Bylaw

Gallery › Guest Configuration › Azure built-in policies

[Deprecated]: Audit Windows VMs that do not have the specified Windows PowerShell execution policy

Converted Initiative Version 1.0.0-deprecated Deprecated

This initiative deploys the policy requirements and audits Windows virtual machines where Windows PowerShell is not configured to use the specified PowerShell execution policy. 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 JSONWindowsPowerShellExecutionPolicy.json · 53 lines
{
  "properties": {
    "displayName": "[Deprecated]: Audit Windows VMs that do not have the specified Windows PowerShell execution policy",
    "policyType": "BuiltIn",
    "description": "This initiative deploys the policy requirements and audits Windows virtual machines where Windows PowerShell is not configured to use the specified PowerShell execution policy. 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": {
      "ExecutionPolicy": {
        "type": "string",
        "metadata": {
          "displayName": "PowerShell Execution Policy",
          "description": "The expected PowerShell execution policy."
        },
        "allowedValues": [
          "AllSigned",
          "Bypass",
          "Default",
          "RemoteSigned",
          "Restricted",
          "Undefined",
          "Unrestricted"
        ]
      }
    },
    "policyDefinitions": [
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/e0efc13a-122a-47c5-b817-2ccfe5d12615",
        "definitionVersion": "1.*.*",
        "policyDefinitionReferenceId": "Deploy_WindowsPowerShellExecutionPolicy",
        "parameters": {
          "ExecutionPolicy": {
            "value": "[parameters('ExecutionPolicy')]"
          }
        }
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/f8036bd0-c10b-4931-86bb-94a878add855",
        "definitionVersion": "1.*.*",
        "policyDefinitionReferenceId": "Audit_WindowsPowerShellExecutionPolicy"
      }
    ],
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policySetDefinitions/f000289c-47af-4043-87da-91ba9e1a2720",
  "name": "f000289c-47af-4043-87da-91ba9e1a2720"
}
Bylawf000289c-47af-4043-87da-91ba9e1a2720.bylaw.ps1 · 35 lines
# Converted from WindowsPowerShellExecutionPolicy.json by ConvertTo-Bylaw.
Initiative 'f000289c-47af-4043-87da-91ba9e1a2720' {

    Properties @{
        DisplayName   = '[Deprecated]: Audit Windows VMs that do not have the specified Windows PowerShell execution policy'
        Description   = 'This initiative deploys the policy requirements and audits Windows virtual machines where Windows PowerShell is not configured to use the specified PowerShell execution policy. 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 ExecutionPolicy @{
        Type          = 'string'
        AllowedValues = @('AllSigned', 'Bypass', 'Default', 'RemoteSigned', 'Restricted', 'Undefined', 'Unrestricted')
        DisplayName   = 'PowerShell Execution Policy'
        Description   = 'The expected PowerShell execution policy.'
        JsonName      = 'ExecutionPolicy'
    }

    PolicyDefinition @{
        Id          = 'e0efc13a-122a-47c5-b817-2ccfe5d12615'
        ReferenceId = 'Deploy_WindowsPowerShellExecutionPolicy'
        Version     = '1.*.*'
        Parameters  = @{
            ExecutionPolicy = (Param ExecutionPolicy)
        }
    }

    PolicyDefinition @{
        Id          = 'f8036bd0-c10b-4931-86bb-94a878add855'
        ReferenceId = 'Audit_WindowsPowerShellExecutionPolicy'
        Version     = '1.*.*'
    }
}

Members (2)

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