Gallery › App Service › Azure built-in policies
App Service apps should disable SSH
Converted Policy Audit Deny Disabled Mode Indexed Version 1.1.0
Azure App Service allows you to open an SSH session to a container running in the service. This feature should be disabled to ensure that SSH is not inadvertently left open on App Service apps, reducing the risk of unauthorized access. Learn more at: https://aka.ms/app-service-ssh
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONWebApp_SshEnabled_Audit.json · 71 lines
{
"properties": {
"displayName": "App Service apps should disable SSH",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Azure App Service allows you to open an SSH session to a container running in the service. This feature should be disabled to ensure that SSH is not inadvertently left open on App Service apps, reducing the risk of unauthorized access. Learn more at: https://aka.ms/app-service-ssh",
"metadata": {
"version": "1.1.0",
"category": "App Service"
},
"version": "1.1.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Web/sites"
},
{
"anyOf": [
{
"field": "kind",
"contains": "linux"
},
{
"field": "kind",
"contains": "container"
}
]
},
{
"anyOf": [
{
"field": "Microsoft.Web/sites/sshEnabled",
"exists": "false"
},
{
"field": "Microsoft.Web/sites/sshEnabled",
"notEquals": "false"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.1.0",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/25255ddf-ef4f-4283-975a-5590ad111bba",
"name": "25255ddf-ef4f-4283-975a-5590ad111bba"
}Bylaw25255ddf-ef4f-4283-975a-5590ad111bba.bylaw.ps1 · 39 lines
# Converted from WebApp_SshEnabled_Audit.json by ConvertTo-Bylaw.
Policy '25255ddf-ef4f-4283-975a-5590ad111bba' {
Properties @{
DisplayName = 'App Service apps should disable SSH'
Description = 'Azure App Service allows you to open an SSH session to a container running in the service. This feature should be disabled to ensure that SSH is not inadvertently left open on App Service apps, reducing the risk of unauthorized access. Learn more at: https://aka.ms/app-service-ssh'
Version = '1.1.0'
Category = 'App Service'
PolicyVersion = '1.1.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Web/sites' {
When {
AnyOf {
Field kind | Must -ContainText 'linux'
Field kind | Must -ContainText 'container'
}
}
Require 'sshEnabled exists' {
Field sshEnabled | Must -Exist
}
Require 'sshEnabled is false' {
Field sshEnabled | Must -Be 'false'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/App Service/WebApp_SshEnabled_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw