Skip to content

Instantly share code, notes, and snippets.

@Gyarbij
Created May 3, 2020 12:13
Show Gist options
  • Save Gyarbij/0340990dbfbd4574bfee1938f019a36c to your computer and use it in GitHub Desktop.
Save Gyarbij/0340990dbfbd4574bfee1938f019a36c to your computer and use it in GitHub Desktop.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"utcValue": {
"type": "string",
"defaultValue": "[utcNow()]",
"metadata": {
"description": "Returns the current (UTC) datetime value in the specified format. If no format is provided, the ISO 8601 (yyyyMMddTHHmmssZ) format is used"
}
},
"workspaceName": {
"type": "string",
"metadata": {
"description": "Name for the Log Analytics workspace used to aggregate data"
}
},
"pricingTier": {
"type": "string",
"allowedValues": [
"PerGB2018",
"Free",
"Standalone",
"PerNode",
"Standard",
"Premium"
],
"defaultValue": "PerGB2018",
"metadata": {
"description": "Pricing tier: pergb2018 or legacy tiers (Free, Standalone, PerNode, Standard or Premium) which are not available to all customers."
}
},
"dataRetention": {
"type": "int",
"defaultValue": 30,
"minValue": 7,
"maxValue": 730,
"metadata": {
"description": "Number of days of retention. Workspaces in the legacy Free pricing tier can only have 7 days."
}
},
"immediatePurgeDataOn30Days": {
"type": "bool",
"defaultValue": true,
"metadata": {
"description": "If set to true when changing retention to 30 days, older data will be immediately deleted. Use this with extreme caution. This only applies when retention is being set to 30 days."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
}
},
"variables": {
"uniqueWorkspace": "[concat(parameters('workspaceName'), uniquestring(resourceGroup().id, parameters('utcValue')))]"
},
"resources": [
{
"apiVersion": "2015-11-01-preview",
"type": "Microsoft.OperationalInsights/workspaces",
"name": "[variables('uniqueWorkspace')]",
"location": "[parameters('location')]",
"properties": {
"retentionInDays": "[parameters('dataRetention')]",
"features": {
"immediatePurgeDataOn30Days": "[parameters('immediatePurgeDataOn30Days')]"
},
"sku": {
"name": "[parameters('pricingTier')]"
}
}
}
],
"outputs": {
"workspaceName": {
"type": "string",
"value": "[variables('uniqueWorkspace')]"
},
"workspaceIdOutput": {
"type": "string",
"value": "[reference(resourceId('Microsoft.OperationalInsights/workspaces/', variables('uniqueWorkspace')), '2015-11-01-preview').customerId]"
},
"workspaceKeyOutput": {
"type": "string",
"value": "[listKeys(resourceId('Microsoft.OperationalInsights/workspaces/', variables('uniqueWorkspace')), '2015-11-01-preview').primarySharedKey]"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment