diff --git a/src/deployment/azuredeploy.json b/src/deployment/azuredeploy.json index dece4eb487..83cbe9c72c 100644 --- a/src/deployment/azuredeploy.json +++ b/src/deployment/azuredeploy.json @@ -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": { @@ -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": [ @@ -149,7 +153,7 @@ }, { "apiVersion": "2018-11-01", - "name": "[parameters('name')]", + "name": "[variables('functionAppName')]", "type": "Microsoft.Web/sites", "kind": "functionapp,linux", "location": "[resourceGroup().location]", @@ -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'))]" ], @@ -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": { @@ -188,7 +192,7 @@ } ], "properties": { - "name": "[parameters('name')]", + "name": "[variables('functionAppName')]", "siteConfig": { "appSettings": [ { @@ -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", @@ -289,7 +293,7 @@ "isAadAutoProvisioned": false } }, - "serverFarmId": "[resourceId('Microsoft.Web/serverFarms', parameters('name'))]", + "serverFarmId": "[resourceId('Microsoft.Web/serverFarms', variables('serverFarmName'))]", "hostingEnvironment": "", "clientAffinityEnabled": false, "httpsOnly": true @@ -297,13 +301,13 @@ }, { "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": { @@ -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", @@ -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, @@ -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, @@ -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')]", @@ -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'))]" @@ -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": "" @@ -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", @@ -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')]" @@ -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')]" @@ -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')]" @@ -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')]" @@ -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')]" @@ -956,4 +954,4 @@ "value": "[subscription().tenantId]" } } -} +} \ No newline at end of file