Gallery › Storage › Azure Community Policy
Storage Account - TLS Setting DENY
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
This Azure Policy denies the deployment of an Azure Storage Account when the 'Minimum TLS version' setting is not set to 'Version 1.2'.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 53 lines
{
"name": "1f4647c2-f143-42c8-9e91-5896bc132120",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Storage Account - TLS Setting DENY",
"description": "This Azure Policy denies the deployment of an Azure Storage Account when the 'Minimum TLS version' setting is not set to 'Version 1.2'.",
"metadata": {
"version": "1.0.0",
"category": "Storage"
},
"mode": "All",
"parameters": {
"tlsVersionRequired": {
"type": "String",
"metadata": {
"displayName": "Required TLS Version",
"description": "The TLS version that should be configured on the Storage Account"
},
"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": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"field": "Microsoft.Storage/storageAccounts/minimumTlsVersion",
"notEquals": "[parameters('tlsVersionRequired')]"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw1f4647c2-f143-42c8-9e91-5896bc132120.bylaw.ps1 · 32 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '1f4647c2-f143-42c8-9e91-5896bc132120' {
Properties @{
DisplayName = 'Storage Account - TLS Setting DENY'
Description = 'This Azure Policy denies the deployment of an Azure Storage Account when the ''Minimum TLS version'' setting is not set to ''Version 1.2''.'
Version = '1.0.0'
Category = 'Storage'
Mode = 'All'
}
Parameter TlsVersionRequired @{
Default = 'TLS1_2'
DisplayName = 'Required TLS Version'
Description = 'The TLS version that should be configured on the Storage Account'
}
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 TlsVersionRequired parameter' {
Field minimumTlsVersion | Must -Be (Param TlsVersionRequired)
}
}
Effect (Param Effect)
}Source: policyDefinitions/Storage/storage-account-tls-setting-deny/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw