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

Expose Microsoft.Network/virtualNetworks/subnets/resourceNavigationLinks/linkedResourceType for NSG Deployment Policy

Open RichShillingtonMSFT opened this issue 7 years ago • 1 comments

Scenario

We need to ensure that all ASEs created have a specific NSG applied to them. We want to use a deployIfNotExists policy to achieve this. This should be exposed in all clouds, in both Public and Government Clouds.

Alias

The property we would need to expose is Microsoft.Network/virtualNetworks/subnets/resourceNavigationLinks/linkedResourceType.

We would check for the value of Microsoft.Web/hostingEnvironments in linkedResourceType. If this is true, then we would deploy a specific NSG.

Example policy definition

This is a sample audit policy for what we are looking to evaluate. { "mode": "all", "policyRule": { "if": { "allOf": [ { "field": "type", "equals": "Microsoft.Network/virtualNetworks/subnets" }, {

            "field": "Microsoft.Network/virtualNetworks/subnets/resourceNavigationLinks/linkedResourceType",
            "equals": "Microsoft.Web/hostingEnvironments"
        }
    ]
},
"then": {
    "effect": "audit"
    }
}

}

RichShillingtonMSFT avatar Apr 25 '19 10:04 RichShillingtonMSFT

Full set of aliases for Microsoft.Networks/virtualNetworks/subnets (including resourceNavigationLinks/linkedResourceType) has been publised to public cloud and government cloud.

mentat9 avatar May 03 '19 19:05 mentat9