Gallery › Storage › Azure Community Policy
Storage accounts should be have minimal TLS version 1.2
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
This policy enforce storage minimal tls version.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 66 lines
{
"name": "6c286ca4-40db-4f55-9e98-1d88bb21ea9f",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Storage accounts should be have minimal TLS version 1.2",
"description": "This policy enforce storage minimal tls version.",
"metadata": {
"category": "Storage",
"version": "1.0.0"
},
"mode": "Indexed",
"parameters": {
"tlsVersion": {
"type": "String",
"metadata": {
"description": "The TLS version to require",
"displayName": "TLS Version"
},
"allowedValues": [
"TLS1_0",
"TLS1_1",
"TLS1_2"
],
"defaultValue": "TLS1_2"
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Deny, Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.Storage/storageAccounts",
"field": "type"
},
{
"anyOf": [
{
"field": "Microsoft.Storage/storageAccounts/minimumTlsVersion",
"notEquals": "[parameters('tlsVersion')]"
},
{
"exists": "false",
"field": "Microsoft.Storage/storageAccounts/minimumTlsVersion"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw6c286ca4-40db-4f55-9e98-1d88bb21ea9f.bylaw.ps1 · 37 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '6c286ca4-40db-4f55-9e98-1d88bb21ea9f' {
Properties @{
DisplayName = 'Storage accounts should be have minimal TLS version 1.2'
Description = 'This policy enforce storage minimal tls version.'
Category = 'Storage'
Version = '1.0.0'
Mode = 'Indexed'
}
Parameter TlsVersion @{
AllowedValues = @('TLS1_0', 'TLS1_1', 'TLS1_2')
Default = 'TLS1_2'
DisplayName = 'TLS Version'
Description = 'The TLS version to require'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Deny, Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.Storage/storageAccounts' {
Require 'minimumTlsVersion is the TlsVersion parameter' {
Field minimumTlsVersion | Must -Be (Param TlsVersion)
}
Require 'minimumTlsVersion exists' {
Field minimumTlsVersion | Must -Exist
}
}
Effect (Param Effect)
}Source: policyDefinitions/Storage/storage-accounts-should-be-have-minimal-tls-version-1.2/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw