Gallery › Security Center › Azure built-in policies
[Deprecated]: [Deprecated]: Audit Web Sockets state for an API App
Converted Policy AuditIfNotExists Disabled Mode All Version 1.0.0-deprecated Deprecated
The Web Sockets protocol is vulnerable to different types of security threats. Use of Web Sockets within an API app must be carefully reviewed.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONASC_DisableWebSockets_ApiApp_Audit_Deprecated.json · 69 lines
{
"properties": {
"displayName": "[Deprecated]: [Deprecated]: Audit Web Sockets state for an API App",
"policyType": "BuiltIn",
"mode": "All",
"description": "The Web Sockets protocol is vulnerable to different types of security threats. Use of Web Sockets within an API app must be carefully reviewed.",
"metadata": {
"version": "1.0.0-deprecated",
"category": "Security Center",
"deprecated": true
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "AuditIfNotExists",
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allof": [
{
"field": "type",
"equals": "microsoft.Web/sites"
},
{
"anyof": [
{
"field": "kind",
"equals": "api"
},
{
"field": "kind",
"equals": "apiApp"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Security/complianceResults",
"name": "DisableWebSockets",
"existenceCondition": {
"field": "Microsoft.Security/complianceResults/resourceStatus",
"in": [
"OffByPolicy",
"Healthy"
]
}
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/b48334a4-911b-4084-b1ab-3e6a4e50b951",
"name": "b48334a4-911b-4084-b1ab-3e6a4e50b951"
}Bylawb48334a4-911b-4084-b1ab-3e6a4e50b951.bylaw.ps1 · 38 lines
# Converted from ASC_DisableWebSockets_ApiApp_Audit_Deprecated.json by ConvertTo-Bylaw.
Policy 'b48334a4-911b-4084-b1ab-3e6a4e50b951' {
Properties @{
DisplayName = '[Deprecated]: [Deprecated]: Audit Web Sockets state for an API App'
Description = 'The Web Sockets protocol is vulnerable to different types of security threats. Use of Web Sockets within an API app must be carefully reviewed.'
Version = '1.0.0-deprecated'
Category = 'Security Center'
Deprecated = $true
PolicyVersion = '1.0.0'
Mode = 'All'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'microsoft.Web/sites' {
Require 'kind is not api' {
Field kind | Must -Not -Be 'api' -IfPresent
}
Require 'kind is not apiApp' {
Field kind | Must -Not -Be 'apiApp' -IfPresent
}
}
AuditIfNotExists 'Microsoft.Security/complianceResults' -Name 'DisableWebSockets' -Effect (Param Effect) {
Require 'resourceStatus is one of 2 values' {
Field resourceStatus | Must -BeIn @('OffByPolicy', 'Healthy')
}
}
}Source: built-in-policies/policyDefinitions/Security Center/ASC_DisableWebSockets_ApiApp_Audit_Deprecated.json in Azure/azure-policy, under the MIT licence.
Bylaw