azure-policy icon indicating copy to clipboard operation
azure-policy copied to clipboard

Alias request: "Microsoft.Web/sites/functions/config[*].bindings[*].type"

Open pbillany opened this issue 7 years ago • 2 comments

Scenario

What are you trying to achieve using Azure Policy? Customer wants to restrict use of function app triggers to Trigger or HTTP only. This ought to be possible via the Microsoft.Web/sites/functions/config alias but I can't extract relevant information from current alias.

Alias

Include details about the alias being requested. Details on aliases are available here.

  • What resource provider and resource type is involved?

Resource Provider:

Microsoft.Web

Resource type:

"sites/functions"

  • What property on that resource type do you wish to expose?

Microsoft.Web/sites/functions/config[].bindings[].type

Example policy definition

Please include a sample policy definition that shows how you would like to use this new alias.

Example policy:-

"parameters": { "effect": { "type": "String", "metadata": { "displayName": "effect", "description": "Enable Audit, AuditIfNotExists, Deny or Disable the execution of the policy" }, "allowedValues": [ "Audit", "AuditIfNotExists", "Disabled" ], "defaultValue": "AuditIfNotExists" }, "PreApprovedTriggers": { "type": "Array", "metadata": { "displayName": "PreApprovedTriggers", "description": "This is a list of preapproved Function Triggers. This has been preapproved by the Security Team" }, "allowedValues": [ "httpTrigger" ], "defaultValue": [ "httpTrigger" ] } }, "policyRule": { "if": { "allOf": [ { "field": "type", "equals": "Microsoft.Web/sites" }, { "anyOf": [ { "field": "kind", "equals": "functionapp" }, { "field": "kind", "equals": "functionapp,linux" }, { "field": "kind", "equals": "functionapp,linux,container" } ] } ] }, "then": { "effect": "[parameters('effect')]", "details": { "type": "Microsoft.Web/sites/functions", "existenceCondition": { "anyOf": [ { "not": { "field": "Microsoft.Web/sites/functions/config{].bindings[].type", "notIn": "[parameters('PreApprovedTriggers')]" } } ] } } } } },

pbillany avatar Jul 01 '19 14:07 pbillany

Sorry we can't help with this @pbillany. The Microsoft.Web resource provider does not publish anything below Microsoft.Web/sites/functions/config in their Open API spec, so we can't make this alias. You need to take this request to the Microsoft.Web team, either by submitting or upvoting a User Voice idea here: https://feedback.azure.com/forums/169385-web-apps or by opening a support ticket here: https://azure.microsoft.com/support/create-ticket/.

mentat9 avatar Jul 11 '19 01:07 mentat9

Thanks for checking this out @mentat9 - will take the action you suggest.

pbillany avatar Jul 11 '19 14:07 pbillany