Bylaw

Gallery › Monitoring › Azure built-in policies

Workbooks should be saved to storage accounts that you control

Converted Policy Audit Deny Disabled Mode Indexed Version 1.1.0

With bring your own storage (BYOS), your workbooks are uploaded into a storage account that you control. That means you control the encryption-at-rest policy, the lifetime management policy, and network access. You will, however, be responsible for the costs associated with that storage account. For more information, visit https://aka.ms/workbooksByos

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONWorkbooks_BYOSEnabled_Audit.json · 53 lines
{
  "properties": {
    "displayName": "Workbooks should be saved to storage accounts that you control",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "With bring your own storage (BYOS), your workbooks are uploaded into a storage account that you control. That means you control the encryption-at-rest policy, the lifetime management policy, and network access. You will, however, be responsible for the costs associated with that storage account. For more information, visit https://aka.ms/workbooksByos",
    "metadata": {
      "version": "1.1.0",
      "category": "Monitoring"
    },
    "version": "1.1.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Audit, Deny, or Disable the execution of this policy"
        },
        "allowedValues": [
          "deny",
          "Deny",
          "audit",
          "Audit",
          "disabled",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "microsoft.insights/workbooks"
          },
          {
            "field": "microsoft.insights/workbooks/storageUri",
            "exists": "false"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.1.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/6fc8115b-2008-441f-8c61-9b722c1e537f",
  "name": "6fc8115b-2008-441f-8c61-9b722c1e537f"
}
Bylaw6fc8115b-2008-441f-8c61-9b722c1e537f.bylaw.ps1 · 28 lines
# Converted from Workbooks_BYOSEnabled_Audit.json by ConvertTo-Bylaw.
Policy '6fc8115b-2008-441f-8c61-9b722c1e537f' {

    Properties @{
        DisplayName   = 'Workbooks should be saved to storage accounts that you control'
        Description   = 'With bring your own storage (BYOS), your workbooks are uploaded into a storage account that you control. That means you control the encryption-at-rest policy, the lifetime management policy, and network access. You will, however, be responsible for the costs associated with that storage account. For more information, visit https://aka.ms/workbooksByos'
        Version       = '1.1.0'
        Category      = 'Monitoring'
        PolicyVersion = '1.1.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('deny', 'Deny', 'audit', 'Audit', 'disabled', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Audit, Deny, or Disable the execution of this policy'
    }

    Resource 'microsoft.insights/workbooks' {

        Require 'storageUri exists' {
            Field storageUri | Must -Exist
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Monitoring/Workbooks_BYOSEnabled_Audit.json in Azure/azure-policy, under the MIT licence.