Bylaw

Gallery › Mission › Azure built-in policies

Control the use of Storage Accounts for Cloud in Mission Platforms

Converted Initiative Version 1.0.0

This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. This initiative deploys Azure policies for Storage Accounts ensuring boundary protection of this resource while it operates within the logically separated enclaves.

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

Azure Policy JSONStorageInitiative.json · 157 lines
{
  "properties": {
    "displayName": "Control the use of Storage Accounts for Cloud in Mission Platforms",
    "policyType": "BuiltIn",
    "description": "This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. This initiative deploys Azure policies for Storage Accounts ensuring boundary protection of this resource while it operates within the logically separated enclaves.",
    "metadata": {
      "version": "1.0.0",
      "category": "Mission"
    },
    "version": "1.0.0",
    "parameters": {
      "allowedAddressRanges": {
        "type": "Array",
        "metadata": {
          "description": "The list of allowed IP address ranges (Allowed internet address ranges can be provided using CIDR notation in the form 10.0.0.0/24 or as individual IP addresses like 10.0.0.4)",
          "displayName": "Allowed Address Ranges"
        },
        "defaultValue": []
      },
      "allowedVirtualNetworks": {
        "type": "Array",
        "metadata": {
          "description": "The list of allowed Virtual Networks (Allowed Virtual Networks can be provided in Resource ID format)",
          "displayName": "Allowed Virtual Networks"
        },
        "defaultValue": []
      },
      "restrictExternalPeSa_excludedSubscriptionIDs": {
        "type": "Array",
        "metadata": {
          "description": "The list of excluded Subscription Ids",
          "displayName": "Excluded Subscription Ids"
        },
        "defaultValue": []
      },
      "restrictSaRepltargets_storageAccountTargets": {
        "type": "Array",
        "metadata": {
          "displayName": "Restrict storage account replication targets",
          "description": "Specify the enforcement to restrict storage account replication targets"
        },
        "defaultValue": [
          {
            "saName": "",
            "sourceSAs": [],
            "destSAs": []
          }
        ]
      }
    },
    "policyDefinitions": [
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/7809fda1-ba27-48c1-9c63-1f5aee46ba89",
        "policyDefinitionReferenceId": "StorageAccountShouldRestrictPublicAccess",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/41a72361-06e3-4e80-832a-690bd0708bc1",
        "policyDefinitionReferenceId": "StorageAccountShouldHaveRestrictedPublicAccess",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/404c3081-a854-4457-ae30-26a93ef643f9",
        "policyDefinitionReferenceId": "StorageAccountShouldUseHttpsTrafficOnly",
        "definitionVersion": "2.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/fe83a0eb-a853-422d-aac2-1bffd182c5d0",
        "policyDefinitionReferenceId": "StorageAccountShouldUseTls12",
        "definitionVersion": "1.*.*",
        "parameters": {
          "minimumTlsVersion": {
            "value": "TLS1_2"
          }
        }
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/13502221-8df0-4414-9937-de9c5c4e396b",
        "policyDefinitionReferenceId": "StorageAccountShouldDisablePublicBlobAccess",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/b5ec538c-daa0-4006-8596-35468b9148e8",
        "policyDefinitionReferenceId": "StorageAccountShouldUseCmkForEncryptionScopes",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/7c322315-e26d-4174-a99e-f49d351b4688",
        "policyDefinitionReferenceId": "StorageAccountShouldUseCmkForTableEncryption",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/f0e5abd0-2554-4736-b7c0-4ffef23475ef",
        "policyDefinitionReferenceId": "StorageAccountShouldUseCmkForQueueEncryption",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/6edd7eda-6dd8-40f7-810d-67160c639cd9",
        "policyDefinitionReferenceId": "StorageAccountShouldUsePrivateLink",
        "definitionVersion": "2.*.*"
      },
      {
        "policyDefinitionReferenceId": "StorageAllowedIPRules",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/d66025f8-6cad-476a-bbfb-3b66ae33f6ff",
        "definitionVersion": "1.*.*",
        "parameters": {
          "allowedAddressRanges": {
            "value": "[parameters('allowedAddressRanges')]"
          },
          "allowedVirtualNetworks": {
            "value": "[parameters('allowedVirtualNetworks')]"
          }
        }
      },
      {
        "policyDefinitionReferenceId": "StorageDisableExternalReplication",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/6bebaf3c-2420-4459-b512-c0f77f3d0afb",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionReferenceId": "StorageEncryptWithCMK",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/e089ecb6-8b98-4b7b-b26b-9bbee7385395",
        "definitionVersion": "1.*.*"
      },
      {
        "policyDefinitionReferenceId": "StorageResticExternalPrivateEndPoint",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/ead83ca5-588e-4a27-9d7c-f4df41484dd4",
        "definitionVersion": "1.*.*",
        "parameters": {
          "excludedSubscriptionIDs": {
            "value": "[parameters('restrictExternalPeSa_excludedSubscriptionIDs')]"
          }
        }
      },
      {
        "policyDefinitionReferenceId": "StorageRestricReplicationTargets",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/0191f0f3-c1e5-4891-a2b4-908bb77b3c29",
        "definitionVersion": "1.*.*",
        "parameters": {
          "storageAccountTargets": {
            "value": "[parameters('restrictSaRepltargets_storageAccountTargets')]"
          }
        }
      },
      {
        "policyDefinitionReferenceId": "storageAccountShouldRestrictNetworkAccessBenchMark",
        "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/34c877ad-507e-4c82-993e-3452a6e0ad3c",
        "definitionVersion": "1.*.*"
      }
    ],
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policySetDefinitions/6954187c-f07c-4ed9-b292-96e32d1e36e5",
  "name": "6954187c-f07c-4ed9-b292-96e32d1e36e5"
}
Bylaw6954187c-f07c-4ed9-b292-96e32d1e36e5.bylaw.ps1 · 135 lines
# Converted from StorageInitiative.json by ConvertTo-Bylaw.
Initiative '6954187c-f07c-4ed9-b292-96e32d1e36e5' {

    Properties @{
        DisplayName   = 'Control the use of Storage Accounts for Cloud in Mission Platforms'
        Description   = 'This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. This initiative deploys Azure policies for Storage Accounts ensuring boundary protection of this resource while it operates within the logically separated enclaves.'
        Version       = '1.0.0'
        Category      = 'Mission'
        PolicyVersion = '1.0.0'
    }

    Parameter AllowedAddressRanges @{
        Type        = 'Array'
        Default     = @()
        DisplayName = 'Allowed Address Ranges'
        Description = 'The list of allowed IP address ranges (Allowed internet address ranges can be provided using CIDR notation in the form 10.0.0.0/24 or as individual IP addresses like 10.0.0.4)'
    }
    Parameter AllowedVirtualNetworks @{
        Type        = 'Array'
        Default     = @()
        DisplayName = 'Allowed Virtual Networks'
        Description = 'The list of allowed Virtual Networks (Allowed Virtual Networks can be provided in Resource ID format)'
    }
    Parameter RestrictExternalPeSa_excludedSubscriptionIDs @{
        Type        = 'Array'
        Default     = @()
        DisplayName = 'Excluded Subscription Ids'
        Description = 'The list of excluded Subscription Ids'
    }
    Parameter RestrictSaRepltargets_storageAccountTargets @{
        Type        = 'Array'
        Default     = @([ordered]@{ saName = ''; sourceSAs = @(); destSAs = @() })
        DisplayName = 'Restrict storage account replication targets'
        Description = 'Specify the enforcement to restrict storage account replication targets'
    }

    PolicyDefinition @{
        Id          = '7809fda1-ba27-48c1-9c63-1f5aee46ba89'
        ReferenceId = 'StorageAccountShouldRestrictPublicAccess'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = '41a72361-06e3-4e80-832a-690bd0708bc1'
        ReferenceId = 'StorageAccountShouldHaveRestrictedPublicAccess'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = '404c3081-a854-4457-ae30-26a93ef643f9'
        ReferenceId = 'StorageAccountShouldUseHttpsTrafficOnly'
        Version     = '2.*.*'
    }

    PolicyDefinition @{
        Id          = 'fe83a0eb-a853-422d-aac2-1bffd182c5d0'
        ReferenceId = 'StorageAccountShouldUseTls12'
        Version     = '1.*.*'
        Parameters  = @{
            minimumTlsVersion = 'TLS1_2'
        }
    }

    PolicyDefinition @{
        Id          = '13502221-8df0-4414-9937-de9c5c4e396b'
        ReferenceId = 'StorageAccountShouldDisablePublicBlobAccess'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = 'b5ec538c-daa0-4006-8596-35468b9148e8'
        ReferenceId = 'StorageAccountShouldUseCmkForEncryptionScopes'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = '7c322315-e26d-4174-a99e-f49d351b4688'
        ReferenceId = 'StorageAccountShouldUseCmkForTableEncryption'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = 'f0e5abd0-2554-4736-b7c0-4ffef23475ef'
        ReferenceId = 'StorageAccountShouldUseCmkForQueueEncryption'
        Version     = '1.*.*'
    }

    PolicyDefinition @{
        Id          = '6edd7eda-6dd8-40f7-810d-67160c639cd9'
        ReferenceId = 'StorageAccountShouldUsePrivateLink'
        Version     = '2.*.*'
    }

    PolicyDefinition @{
        Id          = 'd66025f8-6cad-476a-bbfb-3b66ae33f6ff'
        ReferenceId = 'StorageAllowedIPRules'
        Version     = '1.*.*'
        Parameters  = [ordered]@{
            allowedAddressRanges   = (Param AllowedAddressRanges)
            allowedVirtualNetworks = (Param AllowedVirtualNetworks)
        }
    }

    PolicyDefinition @{
        Id          = '6bebaf3c-2420-4459-b512-c0f77f3d0afb'
        ReferenceId = 'StorageDisableExternalReplication'
        Version     = '1.*.*'
    }

    PolicyDefinition -Id 'e089ecb6-8b98-4b7b-b26b-9bbee7385395' -ReferenceId 'StorageEncryptWithCMK' -Version '1.*.*'

    PolicyDefinition @{
        Id          = 'ead83ca5-588e-4a27-9d7c-f4df41484dd4'
        ReferenceId = 'StorageResticExternalPrivateEndPoint'
        Version     = '1.*.*'
        Parameters  = @{
            excludedSubscriptionIDs = (Param RestrictExternalPeSa_excludedSubscriptionIDs)
        }
    }

    PolicyDefinition @{
        Id          = '0191f0f3-c1e5-4891-a2b4-908bb77b3c29'
        ReferenceId = 'StorageRestricReplicationTargets'
        Version     = '1.*.*'
        Parameters  = @{
            storageAccountTargets = (Param RestrictSaRepltargets_storageAccountTargets)
        }
    }

    PolicyDefinition @{
        Id          = '34c877ad-507e-4c82-993e-3452a6e0ad3c'
        ReferenceId = 'storageAccountShouldRestrictNetworkAccessBenchMark'
        Version     = '1.*.*'
    }
}

Members (15)

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