Add data connector for Armorblox solution

This commit is contained in:
Jayant Upadhyaya 2021-09-10 01:44:29 +05:30
Родитель 10f5362933
Коммит 4b29e664ca
10 изменённых файлов: 564 добавлений и 0 удалений

Двоичные данные
Solutions/Armorblox/Data Connectors/ArmorbloxAzureFunction.zip Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,157 @@
import azure.functions as func
import datetime
import json
import base64
import hashlib
import hmac
import requests
import re
import os
import logging
from urllib.parse import urlparse
from .state_manager import StateManager
ARMORBLOX_API_TOKEN = os.environ["ArmorbloxAPIToken"]
ARMORBLOX_INSTANCE_NAME = os.environ.get("ArmorbloxInstanceName", "").strip()
ARMORBLOX_INSTANCE_URL = os.environ.get("ArmorbloxInstanceURL", "").strip()
TABLE_NAME = "Armorblox"
CHUNKSIZE = 10000
SENTINEL_WORKSPACE_ID = os.environ["WorkspaceID"]
SENTINEL_WORKSPACE_KEY = os.environ["WorkspaceKey"]
CONNECTION_STRING = os.environ["AzureWebJobsStorage"]
LOG_ANALYTICS_URI = os.environ.get("LogAnalyticsUri", "").strip()
if LOG_ANALYTICS_URI == "":
LOG_ANALYTICS_URI = "https://" + SENTINEL_WORKSPACE_ID + ".ods.opinsights.azure.com"
pattern = r"https:\/\/([\w\-]+)\.ods\.opinsights\.azure.([a-zA-Z\.]+)$"
match = re.match(pattern, str(LOG_ANALYTICS_URI))
if not match:
raise Exception("Armorblox Data Connector: Invalid Log Analytics URI")
if (ARMORBLOX_INSTANCE_NAME == "") and (ARMORBLOX_INSTANCE_URL == ""):
raise Exception("Armorblox instance name and URL can both not be empty")
class Armorblox:
def __init__(self):
self.incidents_list = []
self.from_date, self.to_date = self.generate_date()
@staticmethod
def generate_date():
current_time = datetime.datetime.utcnow().replace(second=0, microsecond=0)
state = StateManager(connection_string=CONNECTION_STRING)
past_time = state.get()
if past_time is not None:
logging.info("The last time point is: {}".format(past_time))
else:
logging.info("There is no last time point, trying to get incidents for last day.")
past_time = (current_time - datetime.timedelta(minutes=60)).strftime("%Y-%m-%dT%H:%M:%SZ")
state.post(current_time.strftime("%Y-%m-%dT%H:%M:%SZ"))
return past_time, current_time.strftime("%Y-%m-%dT%H:%M:%SZ")
def _process_incidents(self, url, headers, params):
response = requests.get(url, headers=headers, params=params)
if response.status_code == 200:
response_json = response.json()
next_page_token = response_json.get("next_page_token", None)
self.incidents_list.extend(response_json.get("incidents", []))
if next_page_token is not None:
params["page_token"] = next_page_token
self._process_incidents(url, headers, params)
def get_incidents(self):
params = {
"from_date": self.from_date,
"to_date": self.to_date,
"page_size": 100
}
headers = {
"x-ab-authorization": ARMORBLOX_API_TOKEN,
"Content-Type": "application/json",
}
url = ""
path = "api/v1beta1/organizations/{}/incidents"
if ARMORBLOX_INSTANCE_URL:
tenant_name = urlparse(ARMORBLOX_INSTANCE_URL).netloc.split(".")[0]
path = path.format(tenant_name)
if ARMORBLOX_INSTANCE_URL.endswith("/"):
url = ARMORBLOX_INSTANCE_URL + path
else:
url = ARMORBLOX_INSTANCE_URL + "/" + path
else:
url = "https://{}.armorblox.io/{}".format(ARMORBLOX_INSTANCE_NAME, path.format(ARMORBLOX_INSTANCE_NAME))
self._process_incidents(url, headers, params)
return self.incidents_list
class Sentinel:
@staticmethod
def gen_chunks_to_object(data):
chunk = []
for index, line in enumerate(data):
if (index % CHUNKSIZE == 0) and index > 0:
yield chunk
del chunk[:]
chunk.append(line)
yield chunk
def gen_chunks(self, data):
for chunk in self.gen_chunks_to_object(data):
obj_array = []
for row in chunk:
if row is not None and row != "":
obj_array.append(row)
body = json.dumps(obj_array)
self._post_data(body, len(obj_array))
@staticmethod
def build_signature(date, content_length, method, content_type, resource):
x_headers = "x-ms-date:" + date
string_to_hash = method + "\n" + str(content_length) + "\n" + content_type + "\n" + x_headers + "\n" + resource
bytes_to_hash = bytes(string_to_hash, encoding="utf-8")
decoded_key = base64.b64decode(SENTINEL_WORKSPACE_KEY)
encoded_hash = base64.b64encode(hmac.new(decoded_key, bytes_to_hash, digestmod=hashlib.sha256).digest()).decode()
authorization = "SharedKey {}:{}".format(SENTINEL_WORKSPACE_ID, encoded_hash)
return authorization
def _post_data(self, body, chunk_count):
method = "POST"
content_type = "application/json"
resource = "/api/logs"
rfc1123date = datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")
content_length = len(body)
signature = self.build_signature(rfc1123date, content_length, method, content_type, resource)
uri = LOG_ANALYTICS_URI + resource + "?api-version=2016-04-01"
headers = {
"content-type": content_type,
"Authorization": signature,
"Log-Type": TABLE_NAME,
"x-ms-date": rfc1123date
}
response = requests.post(uri, data=body, headers=headers)
if 200 <= response.status_code <= 299:
logging.info("Chunk was sent to Azure Sentinel({} events)".format(chunk_count))
else:
logging.info("Error during sending events to Azure Sentinel. Response code:{}".format(response.status_code))
def main(mytimer: func.TimerRequest) -> None:
utc_timestamp = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat()
if mytimer.past_due:
logging.info("The timer is past due!")
logging.info("Python timer trigger function ran at %s", utc_timestamp)
armorblox = Armorblox()
sentinel = Sentinel()
incidents_list = armorblox.get_incidents()
sentinel.gen_chunks(incidents_list)

Просмотреть файл

@ -0,0 +1,11 @@
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "mytimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */10 * * * *"
}
]
}

Просмотреть файл

@ -0,0 +1,22 @@
from azure.storage.fileshare import ShareClient
from azure.storage.fileshare import ShareFileClient
from azure.core.exceptions import ResourceNotFoundError
class StateManager:
def __init__(self, connection_string, share_name='funcstatemarkershare', file_path='funcstatemarkerfile'):
self.share_cli = ShareClient.from_connection_string(conn_str=connection_string, share_name=share_name)
self.file_cli = ShareFileClient.from_connection_string(conn_str=connection_string, share_name=share_name, file_path=file_path)
def post(self, marker_text: str):
try:
self.file_cli.upload_file(marker_text)
except ResourceNotFoundError:
self.share_cli.create_share()
self.file_cli.upload_file(marker_text)
def get(self):
try:
return self.file_cli.download_file().readall().decode()
except ResourceNotFoundError:
return None

Просмотреть файл

@ -0,0 +1,125 @@
{
"id": "Armorblox",
"title": "Armorblox",
"publisher": "Armorblox",
"descriptionMarkdown": "The [Armorblox](https://www.armorblox.com/) data connector provides the capability to ingest incidents from Armorblox server into Azure Sentinel through the REST API. The connector provides ability to get events which helps to examine potential security risks, and more.",
"graphQueries": [
{
"metricName": "Armorblox Incidents",
"legend": "Armorblox_CL",
"baseQuery": "Armorblox_CL"
}
],
"sampleQueries": [
{
"description": "Armorblox Incidents",
"query": "Armorblox_CL\n | sort by TimeGenerated desc"
}
],
"dataTypes": [
{
"name": "Armorblox_CL",
"lastDataReceivedQuery": "Armorblox_CL\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
}
],
"connectivityCriterias": [
{
"type": "IsConnectedQuery",
"value": [
"Armorblox_CL\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(30d)"
]
}
],
"availability": {
"status": 1,
"isPreview": true
},
"permissions": {
"resourceProvider": [
{
"provider": "Microsoft.OperationalInsights/workspaces",
"permissionsDisplayText": "read and write permissions on the workspace are required.",
"providerDisplayName": "Workspace",
"scope": "Workspace",
"requiredPermissions": {
"write": true,
"read": true,
"delete": true
}
},
{
"provider": "Microsoft.OperationalInsights/workspaces/sharedKeys",
"permissionsDisplayText": "read permissions to shared keys for the workspace are required. [See the documentation to learn more about workspace keys](https://docs.microsoft.com/azure/azure-monitor/platform/agent-windows#obtain-workspace-id-and-key).",
"providerDisplayName": "Keys",
"scope": "Workspace",
"requiredPermissions": {
"action": true
}
}
],
"customs": [
{
"name": "Microsoft.Web/sites permissions",
"description": "Read and write permissions to Azure Functions to create a Function App is required. [See the documentation to learn more about Azure Functions](https://docs.microsoft.com/azure/azure-functions/)."
},
{
"name": "Armorblox Instance Details",
"description": "**ArmorbloxInstanceName** OR **ArmorbloxInstanceURL** is required"
},
{
"name": "Armorblox API Credentials",
"description": "**ArmorbloxAPIToken** is required"
}
]
},
"instructionSteps": [
{
"title": "",
"description": ">**NOTE:** This connector uses Azure Functions to connect to the Armorblox API to pull its logs into Azure Sentinel. This might result in additional data ingestion costs. Check the [Azure Functions pricing page](https://azure.microsoft.com/pricing/details/functions/) for details."
},
{
"title": "",
"description": ">**(Optional Step)** Securely store workspace and API authorization key(s) or token(s) in Azure Key Vault. Azure Key Vault provides a secure mechanism to store and retrieve key values. [Follow these instructions](https://docs.microsoft.com/azure/app-service/app-service-key-vault-references) to use Azure Key Vault with an Azure Function App."
},
{
"title": "",
"description": "**STEP 1 - Configuration steps for the Armorblox API**\n\n Follow the instructions to obtain the API token.\n\n1. Log in to the Armorblox portal with your credentials.\n2. In the portal, click **Settings**.\n3. In the **Settings** view, click **API Keys**\n4. Click **Create API Key**.\n5. Enter the required information.\n6. Click **Create**, and copy the API token displayed in the modal.\n7. Save API token for using in the data connector."
},
{
"title": "",
"description": "**STEP 2 - Choose ONE from the following two deployment options to deploy the connector and the associated Azure Function**\n\n>**IMPORTANT:** Before deploying the Armorblox data connector, have the Workspace ID and Workspace Primary Key (can be copied from the following).",
"instructions": [
{
"parameters": {
"fillWith": ["WorkspaceId"],
"label": "Workspace ID"
},
"type": "CopyableLabel"
},
{
"parameters": {
"fillWith": ["PrimaryKey"],
"label": "Primary Key"
},
"type": "CopyableLabel"
}
]
},
{
"title": "Option 1 - Azure Resource Manager (ARM) Template",
"description": "Use this method for automated deployment of the Armorblox data connector using an ARM Tempate.\n\n1. Click the **Deploy to Azure** button below. \n\n\t[![Deploy To Azure](https://aka.ms/deploytoazurebutton)](https://raw.githubusercontent.com/armorblox/Azure-Sentinel/master/Solutions/Armorblox/Data%20Connectors/azuredeploy_Armorblox_API_FunctionApp.json)\n2. Select the preferred **Subscription**, **Resource Group** and **Location**. \n> **NOTE:** Within the same resource group, you can't mix Windows and Linux apps in the same region. Select existing resource group without Windows apps in it or create new resource group.\n3. Enter the **ArmorbloxAPIToken**, **ArmorbloxInstanceURL** OR **ArmorbloxInstanceName**, and deploy. \n4. Mark the checkbox labeled **I agree to the terms and conditions stated above**. \n5. Click **Purchase** to deploy."
},
{
"title": "Option 2 - Manual Deployment of Azure Functions",
"description": "Use the following step-by-step instructions to deploy the Armorblox data connector manually with Azure Functions (Deployment via Visual Studio Code)."
},
{
"title": "",
"description": "**1. Deploy a Function App**\n\n> **NOTE:** You will need to [prepare VS code](https://docs.microsoft.com/azure/azure-functions/functions-create-first-function-python#prerequisites) for Azure function development.\n\n1. Download the [Azure Function App](https://raw.githubusercontent.com/armorblox/Azure-Sentinel/master/Solutions/Armorblox/Data%20Connectors/ArmorbloxAzureFunction.zip) file. Extract archive to your local development computer.\n2. Start VS Code. Choose File in the main menu and select Open Folder.\n3. Select the top level folder from extracted files.\n4. Choose the Azure icon in the Activity bar, then in the **Azure: Functions** area, choose the **Deploy to function app** button.\nIf you aren't already signed in, choose the Azure icon in the Activity bar, then in the **Azure: Functions** area, choose **Sign in to Azure**\nIf you're already signed in, go to the next step.\n5. Provide the following information at the prompts:\n\n\ta. **Select folder:** Choose a folder from your workspace or browse to one that contains your function app.\n\n\tb. **Select Subscription:** Choose the subscription to use.\n\n\tc. Select **Create new Function App in Azure** (Don't choose the Advanced option)\n\n\td. **Enter a globally unique name for the function app:** Type a name that is valid in a URL path. The name you type is validated to make sure that it's unique in Azure Functions. (e.g. Armorblox).\n\n\te. **Select a runtime:** Choose Python 3.8.\n\n\tf. Select a location for new resources. For better performance and lower costs choose the same [region](https://azure.microsoft.com/regions/) where Azure Sentinel is located.\n\n6. Deployment will begin. A notification is displayed after your function app is created and the deployment package is applied.\n7. Go to Azure Portal for the Function App configuration."
},
{
"title": "",
"description": "**2. Configure the Function App**\n\n1. In the Function App, select the Function App Name and select **Configuration**.\n2. In the **Application settings** tab, select ** New application setting**.\n3. Add each of the following application settings individually, with their respective string values (case-sensitive): \n\t\tArmorbloxAPIToken\n\t\tArmorbloxInstanceName OR ArmorbloxInstanceURL\n\t\tWorkspaceID\n\t\tWorkspaceKey\n\t\tLogAnalyticsUri (optional)\n> - Use LogAnalyticsUri to override the log analytics API endpoint for dedicated cloud. For example, for public cloud, leave the value empty; for Azure GovUS cloud environment, specify the value in the following format: `https://<CustomerId>.ods.opinsights.azure.us`.\n4. Once all application settings have been entered, click **Save**."
}
]
}

Просмотреть файл

@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400.73 512.73"><defs><style>.cls-1,.cls-2{fill:#33058d;}.cls-1{fill-rule:evenodd;}</style></defs><title>Armorblox_Logo_#33058d_SVG</title><path class="cls-1" d="M318.22,162.19l-9.69-3.41-66.85-23.52c-2.67-.94-3.75.33-2.4,2.81,0,0,.66,1.22,2.38,4.16,10.62,17.37,39.23,55.59,39.23,55.59,1.7,2.26.93,3.26-1.7,2.23l-20.3-6.56a17.06,17.06,0,0,1-8.07-5.37l-8.56-11.69a11.84,11.84,0,0,0-8.12-4.37l-6.36,0a11.89,11.89,0,0,0-8.12,4.38l-8.61,11.76A17.1,17.1,0,0,1,203,193.6L183.18,200c-2.62,1-3.39,0-1.7-2.22,0,0,28.62-38.22,39.24-55.59,1.79-3,2.57-4.48,2.57-4.48,1.35-2.48.28-3.72-2.38-2.75l-65.2,23.73c-2.65,1-7,2.52-9.67,3.46l-6.84,2.4a7.78,7.78,0,0,0-4.85,6.84v89.71a20.14,20.14,0,0,0,2.83,9.43l8.12,12.35a20.14,20.14,0,0,1,2.83,9.43v23.44a14.06,14.06,0,0,0,3.66,8.73l53.27,52.41c2,2,3.44,1.3,3.17-1.51,0,0-3.63-37.45-7-59.9s-14.26-48.83-14.26-48.83a9.93,9.93,0,0,0-7-5.46L171.13,260a7,7,0,0,1-5.67-5.81l-1.6-14.2a3.4,3.4,0,0,1,4.42-3.95l36.81,8.48a5.7,5.7,0,0,1,4.28,6.24L205.31,279a10,10,0,0,0,3.28,8.3l19.53,15.67a6.53,6.53,0,0,0,7.93-.1l18.32-15.47a10.36,10.36,0,0,0,3.2-8.4l-4.06-28.2a5.67,5.67,0,0,1,4.28-6.21L296,236a3.43,3.43,0,0,1,4.43,4l-1.6,14.2a6.8,6.8,0,0,1-5.68,5.7l-12.6,1.45a8.26,8.26,0,0,0-6.46,5.54s-6.38,23.17-11.4,48.37-8.05,60.15-8.05,60.15c-.25,2.82,1.2,3.5,3.21,1.52l53.27-52.41a14.06,14.06,0,0,0,3.66-8.73V292.35a18.58,18.58,0,0,1,3-9.3l9.13-12.61a18.67,18.67,0,0,0,3-9.3V171.43a7.78,7.78,0,0,0-4.85-6.84Z"/><path class="cls-2" d="M458.89,202.26l52.33,134.06-19.38.67-14-36.48H423.18l-13.41,35.91H391.22l50.51-134.16ZM450,227.71l-21.5,57.61h43.6Z"/><path class="cls-2" d="M543.33,336.42H524.39v-98.7h10.66l6.11,15.58A90.68,90.68,0,0,1,557,242.65c6.12-3.29,15.5-4.93,20.11-4.93l.12,15.19q-7.5,0-17,5a77.35,77.35,0,0,0-17,12.14Z"/><path class="cls-2" d="M729.83,247.34q7.5,9.78,7.5,26v63.13H718.39V275.06q0-10.24-3.46-15.78t-11.54-5.52c-3.81,0-8.16,1.28-13,3.84a78.62,78.62,0,0,0-14.6,10.16c.13,1.19.2,3,.2,5.53v63.13H657V275.06q0-10.24-3.45-15.78c-2.31-3.68-6.15-5.52-11.55-5.52-4.07,0-8.65,1.41-13.71,4.24A91.3,91.3,0,0,0,613,269v67.47H594.09v-98.7h13.22l3.35,15.64A66.13,66.13,0,0,1,627.73,242,43.37,43.37,0,0,1,646,237.58q9.46,0,16.08,4.14a25.88,25.88,0,0,1,10,11.64A66.13,66.13,0,0,1,689.09,242a43.37,43.37,0,0,1,18.25-4.44Q722.33,237.58,729.83,247.34Z"/><path class="cls-2" d="M883.66,336.42H864.72v-98.7h10.65l6.12,15.58a90.3,90.3,0,0,1,15.88-10.65c6.12-3.29,15.5-4.93,20.1-4.93l.12,15.19q-7.5,0-17,5a77.11,77.11,0,0,0-17,12.14Z"/><path class="cls-2" d="M1039.32,336.42V200.87l18.94-2.17V336.42Z"/><path class="cls-2" d="M1173.52,336.42l34-49.67-34.18-48.26h20.1L1219.51,274l26.17-35.55h20.11l-36.19,48.26,36.78,49.67h-20.91l-25.93-35.6-24.91,35.6Z"/><path class="cls-2" d="M810.61,236.3H789.54c-9.62,0-17.33,2.79-22.92,8.31s-8.43,13.27-8.43,23v38.4c0,9.77,2.84,17.52,8.43,23s13.3,8.31,22.92,8.31h21.07c9.62,0,17.34-2.8,22.93-8.31s8.42-13.28,8.42-23v-38.4c0-9.77-2.83-17.52-8.43-23S820.24,236.3,810.61,236.3ZM823.67,268v37.61c0,10.26-4.65,15-14.64,15h-17.9c-10,0-14.64-4.78-14.64-15V268c0-10.26,4.65-15,14.64-15H809C819,253,823.67,257.78,823.67,268Z"/><path class="cls-2" d="M1154.72,244.61c-5.59-5.52-13.3-8.31-22.92-8.31h-21.07c-9.63,0-17.34,2.79-22.92,8.31s-8.43,13.27-8.43,23v38.4c0,9.77,2.84,17.52,8.43,23s13.3,8.31,22.92,8.31h21.07c9.62,0,17.33-2.8,22.92-8.31s8.43-13.28,8.43-23v-38.4C1163.15,257.88,1160.31,250.13,1154.72,244.61ZM1144.85,268v37.61c0,10.26-4.65,15-14.64,15h-17.89c-10,0-14.65-4.78-14.65-15V268c0-10.26,4.66-15,14.65-15h17.89C1140.2,253,1144.85,257.78,1144.85,268Z"/><path class="cls-2" d="M984.3,236.11H972.19c-11.69,0-18.31,2.14-22,4.28V197.5l-18.49,2.56V337.4H984.3c9.49,0,17.14-2.8,22.72-8.31s8.43-13.28,8.43-23V267.26c0-9.63-2.83-17.31-8.43-22.84S993.79,236.11,984.3,236.11Zm-30,20.88c2.61-2.61,7.57-4.17,13.27-4.17h12.7c10.86,0,16.85,5.41,16.85,15.24v37.39c0,10.4-4.72,15.24-14.84,15.24l-32.13,0,0-51.82C950.17,263.75,951.58,259.76,954.34,257Z"/></svg>

После

Ширина:  |  Высота:  |  Размер: 3.9 KiB

Просмотреть файл

@ -0,0 +1,222 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"FunctionName": {
"defaultValue": "Armorblox",
"minLength": 1,
"maxLength": 11,
"type": "string"
},
"WorkspaceID": {
"type": "string",
"defaultValue": ""
},
"WorkspaceKey": {
"type": "securestring",
"defaultValue": ""
},
"ArmorbloxAPIToken": {
"type": "securestring",
"defaultValue": ""
},
"ArmorbloxInstanceName": {
"type": "string",
"defaultValue": ""
},
"ArmorbloxInstanceURL": {
"type": "string",
"defaultValue": ""
}
},
"variables": {
"FunctionName": "[concat(toLower(parameters('FunctionName')), uniqueString(resourceGroup().id))]",
"StorageSuffix": "[environment().suffixes.storage]",
"LogAnalyticsUri": "[replace(environment().portal, 'https://portal', concat('https://', toLower(parameters('WorkspaceID')), '.ods.opinsights'))]"
},
"resources": [
{
"type": "Microsoft.Insights/components",
"apiVersion": "2015-05-01",
"name": "[variables('FunctionName')]",
"location": "[resourceGroup().location]",
"kind": "web",
"properties": {
"Application_Type": "web",
"ApplicationId": "[variables('FunctionName')]"
}
},
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"name": "[tolower(variables('FunctionName'))]",
"location": "[resourceGroup().location]",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"kind": "StorageV2",
"properties": {
"networkAcls": {
"bypass": "AzureServices",
"virtualNetworkRules": [],
"ipRules": [],
"defaultAction": "Allow"
},
"supportsHttpsTrafficOnly": true,
"encryption": {
"services": {
"file": {
"keyType": "Account",
"enabled": true
},
"blob": {
"keyType": "Account",
"enabled": true
}
},
"keySource": "Microsoft.Storage"
}
}
},
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"name": "[variables('FunctionName')]",
"location": "[resourceGroup().location]",
"sku": {
"name": "Y1",
"tier": "Dynamic"
},
"kind": "functionapp",
"properties": {
"name": "[variables('FunctionName')]",
"workerSize": "0",
"workerSizeId": "0",
"numberOfWorkers": "1"
}
},
{
"type": "Microsoft.Storage/storageAccounts/blobServices",
"apiVersion": "2019-06-01",
"name": "[concat(variables('FunctionName'), '/default')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', tolower(variables('FunctionName')))]"
],
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"cors": {
"corsRules": []
},
"deleteRetentionPolicy": {
"enabled": false
}
}
},
{
"type": "Microsoft.Storage/storageAccounts/fileServices",
"apiVersion": "2019-06-01",
"name": "[concat(variables('FunctionName'), '/default')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', tolower(variables('FunctionName')))]"
],
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"properties": {
"cors": {
"corsRules": []
}
}
},
{
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"name": "[variables('FunctionName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', tolower(variables('FunctionName')))]",
"[resourceId('Microsoft.Web/serverfarms', variables('FunctionName'))]",
"[resourceId('Microsoft.Insights/components', variables('FunctionName'))]"
],
"kind": "functionapp,linux",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"name": "[variables('FunctionName')]",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('FunctionName'))]",
"httpsOnly": true,
"clientAffinityEnabled": true,
"alwaysOn": true,
"reserved": true
},
"resources": [
{
"apiVersion": "2018-11-01",
"type": "config",
"name": "appsettings",
"dependsOn": [
"[concat('Microsoft.Web/sites/', variables('FunctionName'))]"
],
"properties": {
"FUNCTIONS_EXTENSION_VERSION": "~3",
"FUNCTIONS_WORKER_RUNTIME": "python",
"APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('Microsoft.insights/components', variables('FunctionName')), '2015-05-01').InstrumentationKey]",
"APPLICATIONINSIGHTS_CONNECTION_STRING": "[reference(resourceId('microsoft.insights/components', variables('FunctionName')), '2015-05-01').ConnectionString]",
"WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "[concat('DefaultEndpointsProtocol=https;AccountName=', toLower(variables('FunctionName')),';AccountKey=', listKeys(resourceId('Microsoft.Storage/storageAccounts', toLower(variables('FunctionName'))), '2019-06-01').keys[0].value, ';EndpointSuffix=',toLower(variables('StorageSuffix')))]",
"WEBSITE_CONTENTSHARE": "[toLower(variables('FunctionName'))]",
"AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=', toLower(variables('FunctionName')),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', toLower(variables('FunctionName'))), '2019-06-01').keys[0].value, ';EndpointSuffix=',toLower(variables('StorageSuffix')))]",
"WorkspaceID": "[parameters('WorkspaceID')]",
"WorkspaceKey": "[parameters('WorkspaceKey')]",
"ArmorbloxAPIToken": "[parameters('ArmorbloxAPIToken')]",
"ArmorbloxInstanceName": "[parameters('ArmorbloxInstanceName')]",
"ArmorbloxInstanceURL": "[parameters('ArmorbloxInstanceURL')]",
"LogAnalyticsUri": "[variables('LogAnalyticsUri')]",
"WEBSITE_RUN_FROM_PACKAGE": "https://raw.githubusercontent.com/armorblox/Azure-Sentinel/master/Solutions/Armorblox/Data%20Connectors/ArmorbloxAzureFunction.zip"
}
}
]
},
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "2019-06-01",
"name": "[concat(variables('FunctionName'), '/default/azure-webjobs-hosts')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', variables('FunctionName'), 'default')]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('FunctionName'))]"
],
"properties": {
"publicAccess": "None"
}
},
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "2019-06-01",
"name": "[concat(variables('FunctionName'), '/default/azure-webjobs-secrets')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', variables('FunctionName'), 'default')]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('FunctionName'))]"
],
"properties": {
"publicAccess": "None"
}
},
{
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"apiVersion": "2019-06-01",
"name": "[concat(variables('FunctionName'), '/default/', tolower(variables('FunctionName')))]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/fileServices', variables('FunctionName'), 'default')]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('FunctionName'))]"
],
"properties": {
"shareQuota": 5120
}
}
]
}

Просмотреть файл

@ -0,0 +1,15 @@
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
}
}

Просмотреть файл

@ -0,0 +1,4 @@
{
"$schema": "http://json.schemastore.org/proxies",
"proxies": {}
}

Просмотреть файл

@ -0,0 +1,7 @@
# DO NOT include azure-functions-worker in this file
# The Python Worker is managed by Azure Functions platform
# Manually managing azure-functions-worker may cause unexpected issues
azure-storage-file-share==12.5.0
azure-functions
requests