lacework-global-580
9.2 Ensure Web App Redirects All HTTP traffic to HTTPS in Azure App Service (Automated)
Profile Applicability
• Level 1
Description
Azure Web Apps allows sites to run under both HTTP and HTTPS by default. Web apps can be accessed by anyone using non-secure HTTP links by default. Non-secure HTTP requests can be restricted and all HTTP requests redirected to the secure HTTPS port. It is recommended to enforce HTTPS-only traffic.
Rationale
Enabling HTTPS-only traffic will redirect all non-secure HTTP requests to HTTPS ports. HTTPS uses the TLS/SSL protocol to provide a secure connection which is both encrypted and authenticated. It is therefore important to support HTTPS for the security benefits.
Impact
When it is enabled, every incoming HTTP request is redirected to the HTTPS port. This means an extra level of security will be added to the HTTP requests made to the app.
Audit
From Azure Portal
- Login to Azure Portal using https://portal.azure.com
- Go to
App Services
- Click on each App
- Under
Setting
section, click onTLS/SSL settings
- Under the
Bindings
pane, ensure thatHTTPS Only
set toOn
underProtocol Settings
From Azure CLI
To check HTTPS-only traffic value for an existing app, run the following command,
az webapp show --resource-group <RESOURCE_GROUP_NAME> --name <APP_NAME> --query httpsOnly
The output should return true
if HTTPS-only traffic value is set to On
.
From Azure Powershell
List all the web apps configured within the subscription.
Get-AzWebApp | Select-Object ResourceGroup, Name, HttpsOnly
For each web app review the HttpsOnly
setting and make sure it is set to True
.
Remediation
From Azure Portal
- Login to Azure Portal using https://portal.azure.com
- Go to
App Services
- Click on each App
- Under
Setting
section, Click onTLS/SSL settings
- Under the
Bindings
pane, setHTTPS Only
toOn
underProtocol Settings
section
From Azure CLI
To set HTTPS-only traffic value for an existing app, run the following command:
az webapp update --resource-group <RESOURCE_GROUP_NAME> --name <APP_NAME> --set httpsOnly=true
From Azure Powershell
Set-AzWebApp -ResourceGroupName <RESOURCE_GROUP_NAME> -Name <APP_NAME> -HttpsOnly $true
References
https://docs.microsoft.com/en-us/security/benchmark/azure/security-controls-v3-data-protection#dp-3-encrypt-sensitive-data-in-transit
https://docs.microsoft.com/en-us/powershell/module/az.websites/set-azwebapp?view=azps-8.1.0