Hi Godugu, Loka
Please try with below producer:
To disable the feature of redirecting all HTTP traffic to HTTPS in Azure Web App service using Azure Policy, you can create a custom policy definition with the following JSON policy rule:
{
"mode": "Indexed",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Web/sites/config"
},
{
"field": "Microsoft.Web/sites/config/web.redirectHttpToHttps",
"equals": true
}
]
},
"then": {
"effect": "deny"
}
},
"parameters": {}
}
This policy rule checks if the redirectHttpToHttps property is set to true in the Microsoft.Web/sites/config resource type. If the property is set to true, the policy denies the deployment of the resource.
To apply this policy to Function App or Logic App services, you can use the Microsoft.Web/sites/config resource type in the policy definition. Here's an example policy definition that applies this policy to Function App or Logic App services:
{
"mode": "All",
"displayName": "Disable redirecting all HTTP traffic to HTTPS in Function App or Logic App services",
"description": "This policy disables the feature of redirecting all HTTP traffic to HTTPS in Function App or Logic App services.",
"metadata": {
"category": "Web"
},
"parameters": {},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"in": [
"Microsoft.Web/sites",
"Microsoft.Logic/workflows"
]
},
{
"field": "Microsoft.Web/sites/siteConfig.redirectHttpToHttps",
"equals": true
}
]
},
"then": {
"effect": "deny",
"details": {
"message": "The feature of redirecting all HTTP traffic to HTTPS is disabled in this subscription."
}
}
}
}
This policy definition applies the policy rule to the Microsoft.Web/sites and Microsoft.Logic/workflows resource types. The Microsoft.Web/sites/siteConfig/redirectHttpToHttps property is used to check if the feature of redirecting all HTTP traffic to HTTPS is enabled. If the property is set to true.
Please let me know if anything required.