{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.41.2.15936",
      "templateHash": "5447232409825387172"
    },
    "description": "EasyLife 365, audit/audit-workspace v1: a Log Analytics workspace for the audit log. Give access with the grant script afterwards, once per EasyLife 365 product."
  },
  "parameters": {
    "workspaceName": {
      "type": "string",
      "minLength": 4,
      "maxLength": 63,
      "metadata": {
        "description": "The workspace: 4 to 63 letters, digits and hyphens, starting and ending with a letter or digit."
      }
    },
    "region": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "The Azure region of the workspace. Default: the region of the resource group."
      }
    }
  },
  "resources": [
    {
      "type": "Microsoft.OperationalInsights/workspaces",
      "apiVersion": "2023-09-01",
      "name": "[parameters('workspaceName')]",
      "location": "[parameters('region')]",
      "properties": {
        "sku": {
          "name": "PerGB2018"
        },
        "retentionInDays": 30
      }
    }
  ],
  "outputs": {
    "workspaceResourceId": {
      "type": "string",
      "value": "[resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspaceName'))]"
    }
  }
}