Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Consolidating Log Analytics References & Definitions (#1679)
Browse files Browse the repository at this point in the history
* Consolidating Log Analytics References & Definitons.

* Updating variable name.

* Adding vm insights var name.

* removing bad files.

* Bad file.

* Fixing var.

* Adding new variables for all resources names.

* Removing autoscale changes.

Co-authored-by: Hayley Call <Hayley.Call@microsoft.com>
  • Loading branch information
nharper285 and hayleycall authored Mar 28, 2022
1 parent 24454e3 commit 5e31ba5
Showing 1 changed file with 73 additions and 75 deletions.
148 changes: 73 additions & 75 deletions src/deployment/azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
"variables": {
"autoscale_name": "[concat('onefuzz-autoscale-', uniquestring(resourceGroup().id))]",
"log_retention": 30,
"monitorAccountName": "[concat('logs-wb-', uniquestring(resourceGroup().id))]",
"appInsightsName": "[parameters('name')]",
"functionAppName": "[parameters('name')]",
"serverFarmName": "[parameters('name')]",
"monitorAccountName": "[parameters('name')]",
"vmInsightsName": "[concat('VMInsights', '(', variables('monitorAccountName'), ')')]",
"scaleset_identity": "[concat(parameters('name'), '-scalesetid')]",
"signalr-name": "[concat('onefuzz-', uniquestring(resourceGroup().id))]",
"storage_account_sas": {
Expand Down Expand Up @@ -125,7 +129,7 @@
"tenantId": "[subscription().tenantId]",
"accessPolicies": [
{
"objectId": "[reference(resourceId('Microsoft.Web/sites', parameters('name')), '2019-08-01', 'full').identity.principalId]",
"objectId": "[reference(resourceId('Microsoft.Web/sites', variables('functionAppName')), '2019-08-01', 'full').identity.principalId]",
"tenantId": "[subscription().tenantId]",
"permissions": {
"secrets": [
Expand All @@ -149,7 +153,7 @@
},
{
"apiVersion": "2018-11-01",
"name": "[parameters('name')]",
"name": "[variables('functionAppName')]",
"type": "Microsoft.Web/sites",
"kind": "functionapp,linux",
"location": "[resourceGroup().location]",
Expand All @@ -158,8 +162,8 @@
},
"dependsOn": [
"[resourceId('Microsoft.SignalRService/SignalR', variables('signalr-name'))]",
"[resourceId('microsoft.insights/components/', parameters('name'))]",
"[resourceId('Microsoft.Web/serverFarms', parameters('name'))]",
"[resourceId('microsoft.insights/components/', variables('appInsightsName'))]",
"[resourceId('Microsoft.Web/serverFarms', variables('serverFarmName'))]",
"[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
"[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountNameFunc'))]"
],
Expand All @@ -173,7 +177,7 @@
"name": "logs",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Web/sites/', parameters('name'))]",
"[concat('Microsoft.Web/sites/', variables('functionAppName'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountNameFunc'))]"
],
"properties": {
Expand All @@ -188,7 +192,7 @@
}
],
"properties": {
"name": "[parameters('name')]",
"name": "[variables('functionAppName')]",
"siteConfig": {
"appSettings": [
{
Expand All @@ -205,11 +209,11 @@
},
{
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
"value": "[reference(resourceId('microsoft.insights/components/', parameters('name')), '2015-05-01').InstrumentationKey]"
"value": "[reference(resourceId('microsoft.insights/components/', variables('appInsightsName')), '2015-05-01').InstrumentationKey]"
},
{
"name": "APPINSIGHTS_APPID",
"value": "[reference(resourceId('microsoft.insights/components/', parameters('name')), '2015-05-01').AppId]"
"value": "[reference(resourceId('microsoft.insights/components/', variables('appInsightsName')), '2015-05-01').AppId]"
},
{
"name": "ONEFUZZ_TELEMETRY",
Expand Down Expand Up @@ -289,21 +293,21 @@
"isAadAutoProvisioned": false
}
},
"serverFarmId": "[resourceId('Microsoft.Web/serverFarms', parameters('name'))]",
"serverFarmId": "[resourceId('Microsoft.Web/serverFarms', variables('serverFarmName'))]",
"hostingEnvironment": "",
"clientAffinityEnabled": false,
"httpsOnly": true
}
},
{
"apiVersion": "2018-02-01",
"name": "[parameters('name')]",
"name": "[variables('serverFarmName')]",
"type": "Microsoft.Web/serverFarms",
"location": "[resourceGroup().location]",
"kind": "linux",
"dependsOn": [],
"properties": {
"name": "[parameters('name')]",
"name": "[variables('serverFarmName')]",
"reserved": true
},
"sku": {
Expand All @@ -323,12 +327,12 @@
"type": "microsoft.insights/autoscalesettings",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/serverFarms', parameters('name'))]"
"[resourceId('Microsoft.Web/serverFarms', variables('serverFarmName'))]"
],
"properties": {
"name": "[variables('autoscale_name')]",
"enabled": true,
"targetResourceUri": "[resourceId('Microsoft.Web/serverFarms/', parameters('name'))]",
"targetResourceUri": "[resourceId('Microsoft.Web/serverFarms/', variables('serverFarmName'))]",
"profiles": [
{
"name": "Auto scale condition",
Expand All @@ -348,7 +352,7 @@
"metricTrigger": {
"metricName": "CpuPercentage",
"metricNamespace": "microsoft.web/serverfarms",
"metricResourceUri": "[resourceId('Microsoft.Web/serverFarms/', parameters('name'))]",
"metricResourceUri": "[resourceId('Microsoft.Web/serverFarms/', variables('serverFarmName'))]",
"operator": "GreaterThanOrEqual",
"statistic": "Average",
"threshold": 20,
Expand All @@ -369,7 +373,7 @@
"metricTrigger": {
"metricName": "CpuPercentage",
"metricNamespace": "microsoft.web/serverfarms",
"metricResourceUri": "[resourceId('Microsoft.Web/serverFarms/', parameters('name'))]",
"metricResourceUri": "[resourceId('Microsoft.Web/serverFarms/', variables('serverFarmName'))]",
"operator": "LessThan",
"statistic": "Average",
"threshold": 20,
Expand All @@ -391,52 +395,6 @@
}
},

{
"type": "Microsoft.OperationalInsights/workspaces",
"apiVersion": "2020-08-01",
"name": "[parameters('name')]",
"location": "[resourceGroup().location]",
"properties": {}
},

{
"apiVersion": "2020-02-02-preview",
"name": "[parameters('name')]",
"type": "microsoft.insights/components",
"location": "[resourceGroup().location]",
"kind": "",
"properties": {
"ApplicationId": "[parameters('name')]",
"Application_Type": "other",
"RetentionInDays": "[variables('log_retention')]",
"WorkspaceResourceId" : "[resourceId('Microsoft.OperationalInsights/workspaces', parameters('name'))]"
},
"tags": {
"OWNER": "[parameters('owner')]"
},
"dependsOn" : [
"[resourceId('Microsoft.OperationalInsights/workspaces', parameters('name'))]"
],
"resources": [
{
"name": "df20765c-ed5b-46f9-a47b-20f4aaf7936d",
"type": "microsoft.insights/workbooks",
"location": "[resourceGroup().location]",
"apiVersion": "2018-06-17-preview",
"dependsOn": [
"[resourceId('microsoft.insights/components', parameters('name'))]"
],
"kind": "shared",
"properties": {
"displayName": "LibFuzzer Job Dashboard",
"serializedData": "[parameters('workbookData').libFuzzerJob]",
"version": "1.0",
"sourceId": "[resourceId('microsoft.insights/components', parameters('name'))]",
"category": "tsg"
}
}
]
},
{
"type": "Microsoft.OperationalInsights/workspaces",
"name": "[variables('monitorAccountName')]",
Expand All @@ -457,7 +415,7 @@
{
"apiVersion": "2015-11-01-preview",
"location": "[resourceGroup().location]",
"name": "[concat('VMInsights', '(', variables('monitorAccountName'), ')')]",
"name": "[variables('vmInsightsName')]",
"type": "Microsoft.OperationsManagement/solutions",
"dependsOn": [
"[resourceId('Microsoft.OperationalInsights/workspaces', variables('monitorAccountName'))]"
Expand All @@ -466,7 +424,7 @@
"workspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces', variables('monitorAccountName'))]"
},
"plan": {
"name": "[concat('VMInsights', '(', variables('monitorAccountName'), ')')]",
"name": "[variables('vmInsightsName')]",
"publisher": "Microsoft",
"product": "[Concat('OMSGallery/', 'VMInsights')]",
"promotionCode": ""
Expand Down Expand Up @@ -584,6 +542,46 @@
}
]
},

{
"apiVersion": "2020-02-02-preview",
"name": "[variables('appInsightsName')]",
"type": "microsoft.insights/components",
"location": "[resourceGroup().location]",
"kind": "",
"properties": {
"ApplicationId": "[variables('appInsightsName')]",
"Application_Type": "other",
"RetentionInDays": "[variables('log_retention')]",
"WorkspaceResourceId" : "[resourceId('Microsoft.OperationalInsights/workspaces', variables('monitorAccountName'))]"
},
"tags": {
"OWNER": "[parameters('owner')]"
},
"dependsOn" : [
"[resourceId('Microsoft.OperationalInsights/workspaces', variables('monitorAccountName'))]"
],
"resources": [
{
"name": "df20765c-ed5b-46f9-a47b-20f4aaf7936d",
"type": "microsoft.insights/workbooks",
"location": "[resourceGroup().location]",
"apiVersion": "2018-06-17-preview",
"dependsOn": [
"[resourceId('microsoft.insights/components', variables('appInsightsName'))]"
],
"kind": "shared",
"properties": {
"displayName": "LibFuzzer Job Dashboard",
"serializedData": "[parameters('workbookData').libFuzzerJob]",
"version": "1.0",
"sourceId": "[resourceId('microsoft.insights/components', variables('appInsightsName'))]",
"category": "tsg"
}
}
]
},

{
"apiVersion": "2019-06-01",
"type": "Microsoft.Storage/storageAccounts",
Expand Down Expand Up @@ -752,10 +750,10 @@
"name": "[guid(concat(resourceGroup().id, '-vmss'))]",
"properties": {
"roleDefinitionId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', variables('Virtual Machine Contributor'))]",
"principalId": "[reference(resourceId('Microsoft.Web/sites', parameters('name')), '2018-02-01', 'Full').identity.principalId]"
"principalId": "[reference(resourceId('Microsoft.Web/sites', variables('functionAppName')), '2018-02-01', 'Full').identity.principalId]"
},
"DependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('name'))]"
"[resourceId('Microsoft.Web/sites', variables('functionAppName'))]"
],
"tags": {
"OWNER": "[parameters('owner')]"
Expand All @@ -767,10 +765,10 @@
"name": "[guid(concat(resourceGroup().id, '-storage'))]",
"properties": {
"roleDefinitionId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', variables('Storage Account Contributor'))]",
"principalId": "[reference(resourceId('Microsoft.Web/sites', parameters('name')), '2018-02-01', 'Full').identity.principalId]"
"principalId": "[reference(resourceId('Microsoft.Web/sites', variables('functionAppName')), '2018-02-01', 'Full').identity.principalId]"
},
"DependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('name'))]"
"[resourceId('Microsoft.Web/sites', variables('functionAppName'))]"
],
"tags": {
"OWNER": "[parameters('owner')]"
Expand All @@ -782,10 +780,10 @@
"name": "[guid(concat(resourceGroup().id, '-network'))]",
"properties": {
"roleDefinitionId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', variables('Network Contributor'))]",
"principalId": "[reference(resourceId('Microsoft.Web/sites', parameters('name')), '2018-02-01', 'Full').identity.principalId]"
"principalId": "[reference(resourceId('Microsoft.Web/sites', variables('functionAppName')), '2018-02-01', 'Full').identity.principalId]"
},
"DependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('name'))]"
"[resourceId('Microsoft.Web/sites', variables('functionAppName'))]"
],
"tags": {
"OWNER": "[parameters('owner')]"
Expand All @@ -797,10 +795,10 @@
"name": "[guid(concat(resourceGroup().id, '-logs'))]",
"properties": {
"roleDefinitionId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', variables('Log Analytics Contributor'))]",
"principalId": "[reference(resourceId('Microsoft.Web/sites', parameters('name')), '2018-02-01', 'Full').identity.principalId]"
"principalId": "[reference(resourceId('Microsoft.Web/sites', variables('functionAppName')), '2018-02-01', 'Full').identity.principalId]"
},
"DependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('name'))]"
"[resourceId('Microsoft.Web/sites', variables('functionAppName'))]"
],
"tags": {
"OWNER": "[parameters('owner')]"
Expand All @@ -812,10 +810,10 @@
"name": "[guid(concat(resourceGroup().id, '-user_managed_idenity'))]",
"properties": {
"roleDefinitionId": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', variables('Managed Identity Operator'))]",
"principalId": "[reference(resourceId('Microsoft.Web/sites', parameters('name')), '2018-02-01', 'Full').identity.principalId]"
"principalId": "[reference(resourceId('Microsoft.Web/sites', variables('functionAppName')), '2018-02-01', 'Full').identity.principalId]"
},
"DependsOn": [
"[resourceId('Microsoft.Web/sites', parameters('name'))]"
"[resourceId('Microsoft.Web/sites', variables('functionAppName'))]"
],
"tags": {
"OWNER": "[parameters('owner')]"
Expand Down Expand Up @@ -956,4 +954,4 @@
"value": "[subscription().tenantId]"
}
}
}
}

0 comments on commit 5e31ba5

Please sign in to comment.