如何通过ARM模板为Azure Web App配置Https Only
Enable HTTPS Only via ARM Template for Azure Web Apps
To configure the HTTPS Only setting for your Azure Web App in an ARM template, you need to add the httpsOnly property within the properties section of your Microsoft.Web/sites resource definition.
Step-by-Step Configuration
- Locate the
Microsoft.Web/sitesresource block in your existing ARM template. - Within the
propertiesobject of this resource, add or update thehttpsOnlyattribute totrue.
Example Resource Snippet
Here's how the relevant part of your template should look:
{ "type": "Microsoft.Web/sites", "apiVersion": "2022-09-01", "name": "[parameters('webAppName')]", "location": "[parameters('location')]", "properties": { "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]", "httpsOnly": true, // This line enables the HTTPS Only enforcement // Keep your existing properties here... }, "dependsOn": [ "[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]" ] }
Quick Notes
- If the
httpsOnlyproperty already exists in your template, just toggle its value totrueinstead of adding a new line. - This setting will automatically redirect all HTTP requests to HTTPS, identical to the manual toggle you set in the Azure portal.
内容的提问来源于stack exchange,提问作者James Comstock
相关产品推荐
相关产品推荐

