-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
az policy
auditIfNotExists
vnetRouteAllEnabled
. Compliance scan fails when WEBSITE_VNET_ROUTE_ALL=1
#16269
Comments
policy |
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @aperezcloud, @kenieva. Issue DetailsResource Provider
Description of Feature or Work Requested An ARM Policy deployed with BackgroundIn Azure App Services, you can force a Web App to route its outbound traffic through a VNet (as opposed to Internet) by setting an App Setting (environment variable) App Services team have submitted a PR to expose this property via ARM: Add vnetRouteAllEnabled and vnetPrivatePortsCount to Microsoft.Web/sites/config swagger #11152. We now need this property to be effective for ARM Policy compliance scans. Minimum API Version Required Not sure. Swagger Link Add vnetRouteAllEnabled and vnetPrivatePortsCount to Microsoft.Web/sites/config swagger #11152 Target Date ASAP.
|
Investigating.. |
Hi @DanielLarsenNZ, it seems that this is a known issue by that RP: https://github.com/Azure/azure-policy#resource-type-query-results-incomplete-missing-or-non-standard-format |
If they have added the change into swagger, the only action on the policy side would be to create aliases. But per our discussion, it seems that the aliases are exposed. |
Here is where the property was added to rest-api-specs by the Web team. Apparently it's available as of version |
Policy operates on the latest version so the property should have been added. So the alias has been updated and exposed, but is it still not working as required? |
Hi @kenieva, I have just tested this again and it is still not working from my perspective. Here are my steps to reproduce: This will deploy a test App Service with the This will deploy the policy to the resource group that the App Service is deployed into. When the scan completes* you will see that the audit policy is non compliant. My expectation is that the policy would report the resource as compliant. *You can trigger the scan on the Resource Group with this command: |
Hi Daniel, from this policy: https://github.com/DanielLarsenNZ/azure-policy/blob/master/samples/WebApp/web-app-vnet-route-all-enabled/azurepolicy.json the existence condition reads if the Microsoft.Web/sites/config/vnetRouteAllEnabled equals true then audit as non-compliant. I believe the logic you are looking for is if Microsoft.Web/sites/config/vnetRouteAllEnabled equals false. |
Hi @kenieva, this is the rule I am using (the logic is identical): azurepolicy.rules.json. The effect is Never the less, I tried your suggestion and the policy does go compliant, but it is also compliant when the |
Thanks to @kahawai-sre I finally got this to work. The For this policy to take effect:
"resources": [
{
"type": "Microsoft.Web/sites",
"apiVersion": "2020-09-01",
"name": "[parameters('appName')]",
"location": "[parameters('location')]",
"kind": "app",
"dependsOn": [
],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverFarms', parameters('appServicePlanName'))]",
"siteConfig": {
"vnetRouteAllEnabled": true
}
}
}
] |
Resource Provider
Microsoft.Web/sites
Description of Feature or Work Requested
An ARM Policy deployed with
az policy definition create
andaz policy assignment create
with an effect ofauditIfNotExists
that tests for the presence ofMicrosoft.Web/sites/config/vnetRouteAllEnabled = true
will report failed when App Services App SettingWEBSITE_VNET_ROUTE_ALL=1
.Background
In Azure App Services, you can force a Web App to route its outbound traffic through a VNet (as opposed to Internet) by setting an App Setting (environment variable)
WEBSITE_VNET_ROUTE_ALL
: Regional VNet Integration.App Services team have submitted a PR to expose this property via ARM: Add vnetRouteAllEnabled and vnetPrivatePortsCount to Microsoft.Web/sites/config swagger #11152.
We now need this property to be effective for ARM Policy compliance scans.
Minimum API Version Required
Not sure.
Swagger Link
Add vnetRouteAllEnabled and vnetPrivatePortsCount to Microsoft.Web/sites/config swagger #11152
Target Date
ASAP.
The text was updated successfully, but these errors were encountered: