Gallery › Storage › Azure built-in policies
Configure secure transfer of data on a storage account
Converted Policy Disabled Modify Mode Indexed Version 1.0.0
Secure transfer is an option that forces storage account to accept requests only from secure connections (HTTPS). Use of HTTPS ensures authentication between the server and the service and protects data in transit from network layer attacks such as man-in-the-middle, eavesdropping, and session-hijacking
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONStorageAccountSecureTransfer_Modify.json · 79 lines
{
"properties": {
"displayName": "Configure secure transfer of data on a storage account",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Secure transfer is an option that forces storage account to accept requests only from secure connections (HTTPS). Use of HTTPS ensures authentication between the server and the service and protects data in transit from network layer attacks such as man-in-the-middle, eavesdropping, and session-hijacking",
"metadata": {
"version": "1.0.0",
"category": "Storage"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Modify",
"allowedValues": [
"Modify",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "The effect determines what happens when the policy rule is evaluated to match"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"anyOf": [
{
"allOf": [
{
"value": "[requestContext().apiVersion]",
"less": "2019-04-01"
},
{
"field": "Microsoft.Storage/storageAccounts/supportsHttpsTrafficOnly",
"exists": "false"
}
]
},
{
"field": "Microsoft.Storage/storageAccounts/supportsHttpsTrafficOnly",
"equals": "false"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"conflictEffect": "audit",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/17d1049b-9a84-46fb-8f53-869881c3d3ab"
],
"operations": [
{
"condition": "[greaterOrEquals(requestContext().apiVersion, '2019-04-01')]",
"operation": "addOrReplace",
"field": "Microsoft.Storage/storageAccounts/supportsHttpsTrafficOnly",
"value": true
}
]
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/f81e3117-0093-4b17-8a60-82363134f0eb",
"name": "f81e3117-0093-4b17-8a60-82363134f0eb"
}Bylawf81e3117-0093-4b17-8a60-82363134f0eb.bylaw.ps1 · 38 lines
# Converted from StorageAccountSecureTransfer_Modify.json by ConvertTo-Bylaw.
Policy 'f81e3117-0093-4b17-8a60-82363134f0eb' {
Properties @{
DisplayName = 'Configure secure transfer of data on a storage account'
Description = 'Secure transfer is an option that forces storage account to accept requests only from secure connections (HTTPS). Use of HTTPS ensures authentication between the server and the service and protects data in transit from network layer attacks such as man-in-the-middle, eavesdropping, and session-hijacking'
Version = '1.0.0'
Category = 'Storage'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('Modify', 'Disabled')
Default = 'Modify'
DisplayName = 'Effect'
Description = 'The effect determines what happens when the policy rule is evaluated to match'
}
Resource 'Microsoft.Storage/storageAccounts' {
Require 'supportsHttpsTrafficOnly is as required' {
AnyOf {
Arm '[requestContext().apiVersion]' | Must -BeGreaterOrEqual '2019-04-01'
Field supportsHttpsTrafficOnly | Must -Exist
}
}
Require 'supportsHttpsTrafficOnly is not false' {
Field supportsHttpsTrafficOnly | Must -Not -Be 'false' -IfPresent
}
}
Modify -Role 'Storage Account Contributor' -ConflictEffect Audit -Effect (Param Effect) {
Field supportsHttpsTrafficOnly | AddOrReplace $true -Condition (Arm '[greaterOrEquals(requestContext().apiVersion, ''2019-04-01'')]')
}
}Source: built-in-policies/policyDefinitions/Storage/StorageAccountSecureTransfer_Modify.json in Azure/azure-policy, under the MIT licence.
Bylaw