Created
June 26, 2025 20:30
-
-
Save briandelmsft/896159692d362b5b7e4404dbbc335505 to your computer and use it in GitHub Desktop.
QualysFunction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"FunctionName": { | |
"type": "string", | |
"minLength": 1, | |
"maxLength": 11, | |
"defaultValue": "QualysKB" | |
}, | |
"WorkspaceID": { | |
"type": "string", | |
"minLength": 36, | |
"maxLength": 36, | |
"defaultValue": "<workspaceID>" | |
}, | |
"WorkspaceKey": { | |
"type": "securestring", | |
"minLength": 88, | |
"maxLength": 88, | |
"defaultValue": "<workspaceKey>" | |
}, | |
"APIUsername": { | |
"type": "string", | |
"defaultValue": "<apiUsername>" | |
}, | |
"APIPassword": { | |
"type": "securestring", | |
"defaultValue": "<apiPassword>" | |
}, | |
"Uri": { | |
"type": "string", | |
"defaultValue": "https://<API Server URL>/api/2.0", | |
"metadata": { | |
"description": "For example: https://qualysapi.qualys.com/api/2.0" | |
} | |
}, | |
"OptionalFilterParameters": { | |
"type": "string", | |
"defaultValue": "", | |
"metadata": { | |
"description": "For example: id_min=12345&id_max=23456&is_patchable=1" | |
} | |
}, | |
"AppInsightsWorkspaceResourceID": { | |
"type": "string", | |
"metadata": { | |
"description": "Migrate Classic Application Insights to Log Analytic Workspace which is retiring by 29 Febraury 2024. Use 'Log Analytic Workspace-->Properties' blade having 'Resource ID' property value. This is a fully qualified resourceId which is in format '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}'" | |
} | |
} | |
}, | |
"variables": { | |
"FunctionName": "[concat(toLower(parameters('FunctionName')), uniqueString(resourceGroup().id))]", | |
"StorageSuffix":"[environment().suffixes.storage]", | |
"LogAnaltyicsUri":"[replace(environment().portal, 'https://portal', concat('https://', toLower(parameters('WorkspaceID')), '.ods.opinsights'))]" | |
}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Insights/components", | |
"apiVersion": "2020-02-02", | |
"name": "[variables('FunctionName')]", | |
"location": "[resourceGroup().location]", | |
"kind": "web", | |
"properties": { | |
"Application_Type": "web", | |
"ApplicationId": "[variables('FunctionName')]", | |
"WorkspaceResourceId": "[parameters('AppInsightsWorkspaceResourceID')]" | |
} | |
}, | |
{ | |
"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.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.Insights/components', variables('FunctionName'))]" | |
], | |
"kind": "functionapp", | |
"identity": { | |
"type": "SystemAssigned" | |
}, | |
"properties": { | |
"name": "[variables('FunctionName')]", | |
"httpsOnly": true, | |
"clientAffinityEnabled": true, | |
"alwaysOn": true, | |
"siteConfig": { | |
"powerShellVersion": "7.4" | |
} | |
}, | |
"resources": [ | |
{ | |
"apiVersion": "2018-11-01", | |
"type": "config", | |
"name": "appsettings", | |
"dependsOn": [ | |
"[concat('Microsoft.Web/sites/', variables('FunctionName'))]" | |
], | |
"properties": { | |
"FUNCTIONS_EXTENSION_VERSION": "~4", | |
"FUNCTIONS_WORKER_RUNTIME": "powershell", | |
"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]", | |
"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')))]", | |
"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'))]", | |
"workspaceID": "[parameters('WorkspaceID')]", | |
"workspaceKey": "[parameters('WorkspaceKey')]", | |
"apiUsername": "[parameters('APIUsername')]", | |
"apiPassword": "[parameters('APIPassword')]", | |
"uri": "[parameters('Uri')]", | |
"filterParameters": "[parameters('OptionalFilterParameters')]", | |
"logAnalyticsUri": "[variables('LogAnaltyicsUri')]", | |
"WEBSITE_RUN_FROM_PACKAGE": "https://aka.ms/sentinel-qualyskb-functioncode" | |
} | |
} | |
] | |
}, | |
{ | |
"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 | |
} | |
} | |
] | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment