TMA-AZURE-COMPUTE-2.2.7
Ensure 'HTTPS Only' is set to 'On'
Description
Azure App Service allows deployment slots to run under both HTTP and HTTPS by default. Deployment slots 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. 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.
How it is checked
Audit method: Manual review
This recommendation cannot be checked automatically. A scan lists it with these instructions when you pass --include-manual.
Audit from Azure Portal 1. Go to App Services. 2. Click the name of an app. 3. Under Deployment, click Deployment slots. 4. Click the name of a deployment slot. 5. Under Settings, click Configuration. 6. In the General settings tab, under Platform settings, ensure that HTTPS Only is set to On. 7. Repeat steps 1-6 for each app and deployment slot. Audit from Azure CLI Run the following command to list apps: az webapp list For each app, run the following command to list deployment slots: az webapp deployment slot list --resource-group <resource-group-name> --name <app-name> For each deployment slot, ensure that httpsOnly is set to true. Audit from PowerShell Run the following command to list apps: Get-AzWebApp Run the following command to list deployment slots for an app: Get-AzWebAppSlot -ResourceGroupName <resource-group-name> -Name <app-name> Run the following command to get the deployment slot with a given name: $slot = Get-AzWebAppSlot -ResourceGroupName <resource-group-name> -Name <app- name> -Slot <deployment-slot-name> Run the following command to get the HTTPS setting for the deployment slot: $slot.httpsOnly Ensure that the command returns True. Repeat for each app and de...
How it is fixed
Fix method: Guidance or infrastructure patch
Remediate from Azure Portal 1. Go to App Services. 2. Click the name of an app. 3. Under Deployment, click Deployment slots. 4. Click the name of a deployment slot. 5. Under Settings, click Configuration. 6. In the General settings tab, under Platform settings, next to HTTPS Only, select the radio button next to On. 7. Click Save. 8. Click Continue. 9. Repeat steps 1-8 for each app and deployment slot requiring remediation. Remediate from Azure CLI For each deployment slot requiring remediation, run the following command to enable HTTPS Only: az resource update --resource-group <resource-group-name> --name <app- name>/slots/<deployment-slot-name> --resource-type "Microsoft.Web/sites" -- set properties.httpsOnly=true Remediate from PowerShell For each deployment slot requiring remediation, run the following command to enable HTTPS Only: Set-AzWebAppSlot -ResourceGroupName <resource-group-name> -Name <app-name> - Slot <deployment-slot-name> -HttpsOnly $true
Properties
- Operating systems
- Any
- Tags
- azurecloudcompute
- Reference
- CIS Microsoft Azure Compute Services Benchmark v2.0.0 - 2.2.7 Ensure 'HTTPS Only' is set to 'On'