简体   繁体   中英

Azure Policy to turn Firewall on

There is a requirement where I need to write a policy to turn Firewall ON for DataLake Store. this policy should be written in JSON and need to deploy on Azure.

Anyone, who can help me on JSON part.

To enable firewall when creating the DataLake Store , you could refer to my sample policy, it works fine on my side.

{
  "if": {
    "allOf": [
      {
        "field": "type",
        "equals": "Microsoft.DataLakeStore/accounts"
      },
      {
        "field": "Microsoft.DataLakeStore/accounts/firewallState",
        "equals": "Disabled"
      }
    ]
  },
  "then": {
    "effect": "deny"
  }
}

You need to use Append mode in effect to change the value.

{
   "if": {
      "field": "Microsoft.DataLakeStore/accounts/firewallState",
      "equals": "Disabled"
   },
   "then": {
      "effect": "append",
      "details": [
         {
            "field": "Microsoft.DataLakeStore/accounts/firewallState",
            "value": "Enabled"
         }
      ]
   }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM