How can I set “Https only” for my Azure web app using an ARM template?

前提是你 提交于 2020-02-03 04:15:08

问题


I know how to set Https only manually in the Azure portal. Navigating to My Web Application > Custom domains in the Azure portal opens the Custom domains pane, which has an "Https Only" option. Setting this option to "On" enables the functionality I am looking for. I found how to do this manually on Benjamin Perkins Blog. Unfortunately, it does not contain a description of how to solve the problem in an automated way using ARM templates.

How can I set this "Https only" flag in my ARM template so that I can automate this setting in my deployment? Assume I have a working ARM deployment already, and just need to know where and what to add to the template specifically for this setting.

I would like to keep answers to an ARM template based approach.

Thanks for your time!


回答1:


Yes, it is possible. You could check this link. httpsOnly is a value in properties. For example:

{
    "apiVersion": "2015-08-01",
    "name": "[parameters('webSiteName')]",
    "type": "Microsoft.Web/sites",
    "location": "[resourceGroup().location]",
    "tags": {
        "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]": "Resource",
        "displayName": "Website"
    },
    "dependsOn": [
        "[concat('Microsoft.Web/serverfarms/', parameters('hostingPlanName'))]"
    ],
    "properties": {
        "name": "[parameters('webSiteName')]",
        "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingPlanName'))]",
        "httpsOnly": true
    }
}

ps. Template reference might contain error, use api reference (its not perfect, but its better).



来源:https://stackoverflow.com/questions/49445284/how-can-i-set-https-only-for-my-azure-web-app-using-an-arm-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!