{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "sites_SumoMetricsFunctionApp_name": { "defaultValue": "[concat('SMFuncApp', uniqueString(resourceGroup().id))]", "type": "String" }, "namespaces_SumoMetricsNamespace_name": { "defaultValue": "[concat('SMNamespace', uniqueString(resourceGroup().id))]", "type": "String" }, "storageAccounts_SumoMetricsAppLogs_name": { "defaultValue": "[concat('smapplogs', uniqueString(resourceGroup().id))]", "type": "String" }, "storageAccounts_SumoMetricsFailedLogs_name": { "defaultValue": "[concat('smfaillogs', uniqueString(resourceGroup().id))]", "type": "String" }, "serverfarms_SumoMetricsAppServicePlan_name": { "defaultValue": "[concat('SMAppServicePlan', uniqueString(resourceGroup().id))]", "type": "String" }, "eventhubs_InsightsMetrics_name": { "defaultValue": "insights-metrics-pt1m", "type": "String" }, "authorizationRules_RootManageSharedAccessKey_name": { "defaultValue": "RootManageSharedAccessKey", "type": "String" }, "consumerGroupName": { "defaultValue": "$Default", "type": "String" }, "sourceCodeRepositoryURL": { "defaultValue": "https://github.com/SumoLogic/sumologic-azure-function", "type": "String" }, "sourceCodeBranch": { "defaultValue": "master", "type": "String" }, "sourceCodeManualIntegration": { "defaultValue": "true", "type": "String" }, "sumoEndpointURL": { "defaultValue": "Enter HTTP Source URL", "type": "String" }, "appInsightsName": { "defaultValue": "[concat('SMAppInsights', uniqueString(resourceGroup().id))]", "type": "String" }, "logAnalyticsWorkspaceName": { "defaultValue": "[concat('SMWorkspace', uniqueString(resourceGroup().id))]", "type": "String" }, "location": { "type": "string", "defaultValue": "[resourceGroup().location]", "metadata": { "description": "Location for the resources." } }, "storageEndpointSuffix": { "type": "string", "defaultValue": "core.windows.net", "metadata": { "description": "The Azure Storage endpoint suffix. Update for different Azure environments." } } }, "variables": { "appInsightsResourceType": "[concat('microsoft.insights/components/', parameters('appInsightsName'))]" }, "resources": [ { "type": "Microsoft.EventHub/namespaces", "sku": { "name": "Standard", "tier": "Standard", "capacity": 1 }, "name": "[parameters('namespaces_SumoMetricsNamespace_name')]", "apiVersion": "2022-10-01-preview", "location": "[parameters('location')]", "tags": {}, "scale": null, "properties": { "isAutoInflateEnabled": true, "maximumThroughputUnits": 20 }, "dependsOn": [] }, { "type": "Microsoft.Storage/storageAccounts", "sku": { "name": "Standard_RAGRS", "tier": "Standard" }, "kind": "Storage", "name": "[parameters('storageAccounts_SumoMetricsAppLogs_name')]", "apiVersion": "2022-09-01", "location": "[parameters('location')]", "tags": {}, "scale": null, "properties": { "minimumTlsVersion": "TLS1_2", "networkAcls": { "bypass": "AzureServices", "defaultAction": "Allow" }, "supportsHttpsTrafficOnly": true, "encryption": { "services": { "file": { "enabled": true }, "blob": { "enabled": true } }, "keySource": "Microsoft.Storage" } }, "dependsOn": [] }, { "type": "Microsoft.Storage/storageAccounts", "sku": { "name": "Standard_LRS", "tier": "Standard" }, "kind": "Storage", "name": "[parameters('storageAccounts_SumoMetricsFailedLogs_name')]", "apiVersion": "2022-09-01", "location": "[parameters('location')]", "tags": {}, "scale": null, "properties": { "minimumTlsVersion": "TLS1_2", "networkAcls": { "bypass": "AzureServices", "defaultAction": "Allow" }, "supportsHttpsTrafficOnly": true, "encryption": { "services": { "file": { "enabled": true }, "blob": { "enabled": true } }, "keySource": "Microsoft.Storage" } }, "dependsOn": [] }, { "type": "Microsoft.Web/serverfarms", "sku": { "name": "Y1", "tier": "Dynamic", "size": "Y1", "family": "Y", "capacity": 0 }, "kind": "functionapp", "name": "[parameters('serverfarms_SumoMetricsAppServicePlan_name')]", "apiVersion": "2022-09-01", "location": "[parameters('location')]", "scale": null, "properties": { "name": "[parameters('serverfarms_SumoMetricsAppServicePlan_name')]", "perSiteScaling": false, "reserved": false, "targetWorkerCount": 0, "targetWorkerSizeId": 0 }, "dependsOn": [] }, { "type": "Microsoft.Web/sites", "kind": "functionapp", "name": "[parameters('sites_SumoMetricsFunctionApp_name')]", "apiVersion": "2022-09-01", "location": "[parameters('location')]", "scale": null, "identity": { "type": "SystemAssigned" }, "properties": { "httpsOnly": true, "enabled": true, "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('serverfarms_SumoMetricsAppServicePlan_name'))]", "reserved": false, "siteConfig": { "http20Enabled": true, "ftpsState": "Disabled", "minTlsVersion": "1.2", "scmMinTlsVersion": "1.2", "cors": { "allowedOrigins": [ "https://portal.azure.com" ] }, "appSettings": [ { "name": "FUNCTIONS_EXTENSION_VERSION", "value": "~4" }, { "name": "FUNCTIONS_WORKER_RUNTIME", "value": "node" }, { "name": "WEBSITE_NODE_DEFAULT_VERSION", "value": "~18" }, { "name": "Project", "value": "EventHubs/target/metrics_build/" }, { "name": "AzureWebJobsStorage", "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccounts_SumoMetricsAppLogs_name'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_SumoMetricsAppLogs_name')),'2022-09-01').keys[0].value,';EndpointSuffix=', parameters('storageEndpointSuffix'))]" }, { "name": "APPLICATIONINSIGHTS_CONNECTION_STRING", "value": "[reference(variables('appInsightsResourceType'), '2020-02-02').ConnectionString]" }, { "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING", "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccounts_SumoMetricsAppLogs_name'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_SumoMetricsAppLogs_name')),'2022-09-01').keys[0].value,';EndpointSuffix=', parameters('storageEndpointSuffix'))]" }, { "name": "WEBSITE_CONTENTSHARE", "value": "[toLower(parameters('sites_SumoMetricsFunctionApp_name'))]" }, { "name": "FUNCTION_APP_EDIT_MODE", "value": "readwrite" }, { "name": "SumoLabsMetricEndpoint", "value": "[parameters('sumoEndpointURL')]" }, { "name": "AzureEventHubConnectionString", "value": "[concat(listkeys(resourceId('Microsoft.EventHub/namespaces/authorizationRules', parameters('namespaces_SumoMetricsNamespace_name'),parameters('authorizationRules_RootManageSharedAccessKey_name')), '2022-10-01-preview').primaryConnectionString,';EntityPath=',parameters('eventhubs_InsightsMetrics_name'))]" }, { "name": "StorageConnectionString", "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', parameters('storageAccounts_SumoMetricsFailedLogs_name'), ';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_SumoMetricsFailedLogs_name')),'2022-09-01').keys[0].value,';EndpointSuffix=', parameters('storageEndpointSuffix'))]" } ] } }, "resources": [ { "apiVersion": "2022-09-01", "name": "web", "type": "sourcecontrols", "dependsOn": [ "[resourceId('Microsoft.Web/sites/', parameters('sites_SumoMetricsFunctionApp_name'))]" ], "properties": { "RepoUrl": "[parameters('sourceCodeRepositoryURL')]", "branch": "[parameters('sourceCodeBranch')]", "IsManualIntegration": "[parameters('sourceCodeManualIntegration')]" } } ], "dependsOn": [ "[resourceId('Microsoft.Web/serverfarms', parameters('serverfarms_SumoMetricsAppServicePlan_name'))]", "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccounts_SumoMetricsAppLogs_name'))]", "[resourceId('Microsoft.EventHub/namespaces/', parameters('namespaces_SumoMetricsNamespace_name'))]", "[resourceId('Microsoft.Insights/components', parameters('appInsightsName'))]" ] }, { "type": "Microsoft.EventHub/namespaces/AuthorizationRules", "name": "[concat(parameters('namespaces_SumoMetricsNamespace_name'), '/', parameters('authorizationRules_RootManageSharedAccessKey_name'))]", "apiVersion": "2022-10-01-preview", "location": "[parameters('location')]", "scale": null, "properties": { "rights": [ "Listen", "Manage", "Send" ] }, "dependsOn": [ "[resourceId('Microsoft.EventHub/namespaces', parameters('namespaces_SumoMetricsNamespace_name'))]" ] }, { "type": "Microsoft.EventHub/namespaces/eventhubs", "name": "[concat(parameters('namespaces_SumoMetricsNamespace_name'), '/', parameters('eventhubs_InsightsMetrics_name'))]", "apiVersion": "2022-10-01-preview", "location": "[parameters('location')]", "scale": null, "properties": { "messageRetentionInDays": 7, "partitionCount": 4, "status": "Active" }, "dependsOn": [ "[resourceId('Microsoft.EventHub/namespaces', parameters('namespaces_SumoMetricsNamespace_name'))]" ] }, { "type": "Microsoft.EventHub/namespaces/eventhubs/consumergroups", "name": "[concat(parameters('namespaces_SumoMetricsNamespace_name'), '/', parameters('eventhubs_InsightsMetrics_name'), '/', parameters('consumerGroupName'))]", "apiVersion": "2022-10-01-preview", "location": "[parameters('location')]", "scale": null, "properties": {}, "dependsOn": [ "[resourceId('Microsoft.EventHub/namespaces', parameters('namespaces_SumoMetricsNamespace_name'))]", "[resourceId('Microsoft.EventHub/namespaces/eventhubs', parameters('namespaces_SumoMetricsNamespace_name'), parameters('eventhubs_InsightsMetrics_name'))]" ] }, { "type": "Microsoft.OperationalInsights/workspaces", "apiVersion": "2022-10-01", "name": "[parameters('logAnalyticsWorkspaceName')]", "location": "[parameters('location')]", "properties": { "sku": { "name": "PerGB2018" }, "retentionInDays": 30, "features": { "enableLogAccessUsingOnlyResourcePermissions": true }, "workspaceCapping": { "dailyQuotaGb": -1 }, "publicNetworkAccessForIngestion": "Enabled", "publicNetworkAccessForQuery": "Enabled" } }, { "name": "[parameters('appInsightsName')]", "type": "Microsoft.Insights/components", "apiVersion": "2020-02-02", "location": "[parameters('location')]", "kind": "web", "properties": { "Application_Type": "web", "applicationId": "[parameters('appInsightsName')]", "WorkspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces', parameters('logAnalyticsWorkspaceName'))]" }, "dependsOn": [ "[resourceId('Microsoft.OperationalInsights/workspaces', parameters('logAnalyticsWorkspaceName'))]" ] } ] }