Bylaw

Gallery › Storage › Azure Landing Zones Library

Local users should be restricted for Storage Accounts

Converted Policy Audit Deny Disabled Mode All Version 1.0.0

Azure Storage accounts should disable local users for features like SFTP. Enforce this for increased data exfiltration protection.

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

Azure Policy JSONDeny-Storage-LocalUser.alz_policy_definition.json · 60 lines
{
  "name": "Deny-Storage-LocalUser",
  "properties": {
    "description": "Azure Storage accounts should disable local users for features like SFTP. Enforce this for increased data exfiltration protection.",
    "displayName": "Local users should be restricted for Storage Accounts",
    "metadata": {
      "alzCloudEnvironments": [
        "AzureCloud",
        "AzureChinaCloud",
        "AzureUSGovernment"
      ],
      "category": "Storage",
      "source": "https://github.com/Azure/Enterprise-Scale/",
      "version": "1.0.0"
    },
    "mode": "All",
    "parameters": {
      "effect": {
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Deny",
        "metadata": {
          "description": "Enable or disable the execution of the policy",
          "displayName": "Effect"
        },
        "type": "String"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "equals": "Microsoft.Storage/storageAccounts",
            "field": "type"
          },
          {
            "anyOf": [
              {
                "exists": "false",
                "field": "Microsoft.Storage/storageAccounts/isLocalUserEnabled"
              },
              {
                "field": "Microsoft.Storage/storageAccounts/isLocalUserEnabled",
                "notEquals": false
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "policyType": "Custom"
  },
  "type": "Microsoft.Authorization/policyDefinitions"
}
BylawDeny-Storage-LocalUser.bylaw.ps1 · 32 lines
# Converted from Deny-Storage-LocalUser.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-Storage-LocalUser' {

    Properties @{
        DisplayName = 'Local users should be restricted for Storage Accounts'
        Description = 'Azure Storage accounts should disable local users for features like SFTP. Enforce this for increased data exfiltration protection.'
        Category    = 'Storage'
        Version     = '1.0.0'
        Mode        = 'All'
        Metadata    = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Deny'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource 'Microsoft.Storage/storageAccounts' {

        Require 'isLocalUserEnabled exists' {
            Field isLocalUserEnabled | Must -Exist
        }

        Require 'isLocalUserEnabled is false' {
            Field isLocalUserEnabled | Must -Be $false
        }
    }

    Effect (Param Effect)
}

Source: policy_definitions/Deny-Storage-LocalUser.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.