Share via

Policy evaluation problems

Frank 1 Reputation point
2021-12-28T16:53:18.327+00:00

A policy based on the below rule is evaluated/triggered when adding a service endpoint from settings/service endpoints. It does not seem to be evaluated/triggered when adding a service endpoint from settings/subnets/<subnet>. Is this correct or a bug?

"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/virtualNetworks"
},
{
"count": {
"field": "Microsoft.Network/virtualNetworks/subnets[].serviceEndpoints[]"
},
"greaterOrEquals": 1
}
]
}

Azure Policy
Azure Policy

An Azure service that is used to implement corporate governance and standards at scale for Azure resources.


1 answer

Sort by: Most helpful
  1. SwathiDhanwada-MSFT 19,088 Reputation points Moderator
    2022-01-11T08:24:21.017+00:00

    @Frank The policy you have provided wouldn't work as "Microsoft.Network/virtualNetworks/subnets[].serviceEndpoints[]" alias isn't supported. To check the list of aliases that are supported for subnets, you can check using below command.

    (Get-AzPolicyAlias -Namespace "Microsoft.NetworK" -ResourceType "virtualNetworks/subNets").Aliases.Name  
    

    163796-image.png

    You can request new alias by raising a request here : https://github.com/Azure/azure-policy/issues

    Was this answer helpful?

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.