426 строки
20 KiB
JSON
426 строки
20 KiB
JSON
{
|
|
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
|
"contentVersion": "1.0.0.0",
|
|
"parameters": {
|
|
"uniqueSolutionPrefix": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "Prefix used for resource names. Should be unique as this will also be used for domain names."
|
|
}
|
|
},
|
|
"edgeGatewayName": {
|
|
"type": "string",
|
|
"metadata": {
|
|
"description": "The name of the Edge gateway"
|
|
}
|
|
},
|
|
"deployDevice": {
|
|
"type": "bool",
|
|
"metadata": {
|
|
"description": "Provision a final LoRa device in the IoT hub in addition to the gateway"
|
|
}
|
|
},
|
|
"resetPin": {
|
|
"type": "int",
|
|
"metadata": {
|
|
"description": "Provide the reset pin value of your gateway. Please refer to the doc if you are unfamiliar with the value"
|
|
}
|
|
},
|
|
"region": {
|
|
"type": "string",
|
|
"allowedValues": [
|
|
"EU",
|
|
"US"
|
|
],
|
|
"defaultValue": "EU",
|
|
"metadata": {
|
|
"description": "In what region is your gateway deployed?"
|
|
}
|
|
},
|
|
"stationEui": {
|
|
"type": "string",
|
|
"defaultValue": "AA555A0000000101",
|
|
"metadata": {
|
|
"description": "The StationEUI of the sample concentrator device"
|
|
}
|
|
},
|
|
"spiSpeed": {
|
|
"type": "int",
|
|
"allowedValues": [
|
|
8,
|
|
2
|
|
],
|
|
"defaultValue": 8,
|
|
"metadata": {
|
|
"description": "[In Mbps] Custom SPI speed for your gateway, currently only supported for ARM gateways"
|
|
}
|
|
},
|
|
"spiDev": {
|
|
"type": "int",
|
|
"allowedValues": [
|
|
0,
|
|
1,
|
|
2
|
|
],
|
|
"defaultValue": 0,
|
|
"metadata": {
|
|
"description": "SPI Dev version for x86 based gateway"
|
|
}
|
|
},
|
|
"useAzureMonitorOnEdge": {
|
|
"type": "bool",
|
|
"defaultValue": true,
|
|
"metadata": {
|
|
"description": "Controls whether observability is set up for IoT edge."
|
|
}
|
|
},
|
|
"useDiscoveryService": {
|
|
"type": "bool",
|
|
"defaultValue": false,
|
|
"metadata": {
|
|
"description": "Controls whether the standalone discovery service should be deployed."
|
|
}
|
|
}
|
|
},
|
|
"variables": {
|
|
"iotHubName": "[concat(parameters('uniqueSolutionPrefix'), 'hub')]",
|
|
"location": "[resourceGroup().location]",
|
|
"hostingPlanName": "[concat(parameters('uniqueSolutionPrefix'), 'plan')]",
|
|
"storageAccountName": "[concat(parameters('uniqueSolutionPrefix'), 'storage')]",
|
|
"storageAccountType": "Standard_LRS",
|
|
"credentialsContainerName": "stationcredentials",
|
|
"firmwareUpgradesContainerName": "fwupgrades",
|
|
"functionAppName": "[concat(parameters('uniqueSolutionPrefix'), 'function')]",
|
|
"gitUsername": "Azure",
|
|
"functionZipBinary": "https://github.com/Azure/iotedge-lorawan-starterkit/releases/download/v2.1.0/function-2.1.0.zip",
|
|
"discoveryServiceZipBinary": "https://github.com/Azure/iotedge-lorawan-starterkit/releases/download/v2.1.0/discoveryservice-2.1.0.zip",
|
|
"gitBranch": "v2.1.0",
|
|
"storageAccountId": "[concat(resourceGroup().id, '/providers/', 'Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
|
"iotHubOwnerPolicyName": "iothubowner",
|
|
"appInsightName": "[concat(parameters('uniqueSolutionPrefix'), 'insight')]",
|
|
"redisCacheName": "[concat(parameters('uniqueSolutionPrefix'), 'redis')]",
|
|
"logAnalyticsName": "[concat(parameters('uniqueSolutionPrefix'), 'log')]",
|
|
"discoveryServiceWebAppName": "[concat(parameters('uniqueSolutionPrefix'), 'discovery')]",
|
|
"deploymentsAPIVersion": "2021-04-01"
|
|
},
|
|
"resources": [
|
|
{
|
|
"type": "Microsoft.Devices/IotHubs",
|
|
"sku": {
|
|
"name": "S1",
|
|
"tier": "Standard",
|
|
"capacity": 1
|
|
},
|
|
"name": "[variables('iotHubName')]",
|
|
"apiVersion": "2017-07-01",
|
|
"location": "[variables('location')]",
|
|
"properties": {},
|
|
"dependsOn": []
|
|
},
|
|
{
|
|
"type": "Microsoft.Web/serverfarms",
|
|
"apiVersion": "2015-04-01",
|
|
"name": "[variables('hostingPlanName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"name": "[variables('hostingPlanName')]",
|
|
"computeMode": "Dynamic",
|
|
"sku": "Dynamic"
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Storage/storageAccounts",
|
|
"name": "[variables('storageAccountName')]",
|
|
"apiVersion": "2015-06-15",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"accountType": "[variables('storageAccountType')]"
|
|
},
|
|
"dependsOn": []
|
|
},
|
|
{
|
|
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
|
|
"apiVersion": "2021-06-01",
|
|
"name": "[format('{0}/default/{1}', variables('storageAccountName'), variables('credentialsContainerName'))]",
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
|
|
]
|
|
},
|
|
{
|
|
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
|
|
"apiVersion": "2021-06-01",
|
|
"name": "[format('{0}/default/{1}', variables('storageAccountName'), variables('firmwareUpgradesContainerName'))]",
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
|
|
]
|
|
},
|
|
{
|
|
"apiVersion": "2016-08-01",
|
|
"type": "Microsoft.Web/sites",
|
|
"name": "[variables('functionAppName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"kind": "functionapp",
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
|
|
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
|
|
"[concat('Microsoft.Devices/iothubs/', variables('iotHubName'))]",
|
|
"[resourceId('Microsoft.Cache/Redis', variables('redisCacheName'))]",
|
|
"[resourceId('microsoft.insights/components/', variables('appInsightName'))]",
|
|
"[resourceId('Microsoft.OperationalInsights/workspaces', variables('logAnalyticsName'))]"
|
|
],
|
|
"resources": [],
|
|
"properties": {
|
|
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]",
|
|
"siteConfig": {
|
|
"connectionStrings": [
|
|
{
|
|
"name": "IoTHubConnectionString",
|
|
"type": "Custom",
|
|
"connectionString": "[concat('HostName=', variables('iotHubName'), '.azure-devices.net;SharedAccessKeyName=', variables('iotHubOwnerPolicyName'), ';SharedAccessKey=', listKeys(resourceId('Microsoft.Devices/IotHubs/IotHubKeys', variables('iotHubName'), variables('iotHubOwnerPolicyName')), '2017-01-19').primaryKey)]"
|
|
},
|
|
{
|
|
"name": "RedisConnectionString",
|
|
"type": "Custom",
|
|
"connectionString": "[concat(variables('redisCacheName'),'.redis.cache.windows.net,abortConnect=false,ssl=true,password=', listKeys(resourceId('Microsoft.Cache/Redis', variables('redisCacheName')), '2015-08-01').primaryKey)]"
|
|
}
|
|
],
|
|
"appSettings": [
|
|
{
|
|
"name": "AzureWebJobsStorage",
|
|
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountId'),'2015-05-01-preview').key1)]"
|
|
},
|
|
{
|
|
"name": "AzureWebJobsSecretStorageType",
|
|
"value": "Files"
|
|
},
|
|
{
|
|
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
|
|
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountId'),'2015-05-01-preview').key1)]"
|
|
},
|
|
{
|
|
"name": "WEBSITE_CONTENTSHARE",
|
|
"value": "[toLower(variables('functionAppName'))]"
|
|
},
|
|
{
|
|
"name": "FACADE_HOST_NAME",
|
|
"value": "[variables('functionAppName')]"
|
|
},
|
|
{
|
|
"name": "FUNCTIONS_WORKER_RUNTIME",
|
|
"value": "dotnet"
|
|
},
|
|
{
|
|
"name": "FUNCTIONS_EXTENSION_VERSION",
|
|
"value": "~4"
|
|
},
|
|
{
|
|
"name": "DEPLOY_DEVICE",
|
|
"value": "[parameters('deployDevice')]"
|
|
},
|
|
{
|
|
"name": "DEVICE_CONFIG_LOCATION",
|
|
"value": "[concat('https://raw.githubusercontent.com/',variables('gitUsername'),'/iotedge-lorawan-starterkit/',variables('gitBranch'),'/Template/deviceConfiguration.json')]"
|
|
},
|
|
{
|
|
"name": "APPINSIGHTS_INSTRUMENTATIONKEY",
|
|
"value": "[reference(concat('microsoft.insights/components/', variables('appInsightName'))).InstrumentationKey]"
|
|
},
|
|
{
|
|
"name": "WEBSITE_RUN_FROM_PACKAGE",
|
|
"value": "[variables('functionZipBinary')]"
|
|
},
|
|
{
|
|
"name": "OBSERVABILITY_CONFIG_LOCATION",
|
|
"value": "[concat('https://raw.githubusercontent.com/',variables('gitUsername'),'/iotedge-lorawan-starterkit/',variables('gitBranch'),'/Template/observabilityConfiguration.json')]"
|
|
},
|
|
{
|
|
"name": "IOT_HUB_RESOURCE_ID",
|
|
"value": "[resourceId('Microsoft.Devices/IotHubs', variables('iotHubName'))]"
|
|
},
|
|
{
|
|
"name": "LOG_ANALYTICS_WORKSPACE_ID",
|
|
"value": "[if(parameters('useAzureMonitorOnEdge'), reference(concat('Microsoft.OperationalInsights/workspaces/', variables('logAnalyticsName'))).customerId, '')]"
|
|
},
|
|
{
|
|
"name": "LOG_ANALYTICS_WORKSPACE_KEY",
|
|
"value": "[if(parameters('useAzureMonitorOnEdge'), listKeys(resourceId('Microsoft.OperationalInsights/workspaces', variables('logAnalyticsName')), '2021-06-01').primarySharedKey, '')]"
|
|
},
|
|
{
|
|
"name": "EU863_CONFIG_LOCATION",
|
|
"value": "[concat('https://raw.githubusercontent.com/',variables('gitUsername'),'/iotedge-lorawan-starterkit/',variables('gitBranch'),'/Tools/Cli-LoRa-Device-Provisioning/DefaultRouterConfig/EU863.json')]"
|
|
},
|
|
{
|
|
"name": "US902_CONFIG_LOCATION",
|
|
"value": "[concat('https://raw.githubusercontent.com/',variables('gitUsername'),'/iotedge-lorawan-starterkit/',variables('gitBranch'),'/Tools/Cli-LoRa-Device-Provisioning/DefaultRouterConfig/US902.json')]"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "functionLauncher",
|
|
"type": "Microsoft.Resources/deployments",
|
|
"apiVersion": "[variables('deploymentsAPIVersion')]",
|
|
"dependsOn": [
|
|
"[resourceId('Microsoft.Web/sites', variables('functionAppName'))]"
|
|
],
|
|
"properties": {
|
|
"mode": "Incremental",
|
|
"templateLink": {
|
|
"uri": "[concat('https://raw.githubusercontent.com/',variables('gitUsername'),'/iotedge-lorawan-starterkit/',variables('gitBranch'),'/Template/createEdgeDevice.json')]",
|
|
"contentVersion": "1.0.0.0"
|
|
},
|
|
"parameters": {
|
|
"solutionPrefix": {
|
|
"value": "[parameters('uniqueSolutionPrefix')]"
|
|
},
|
|
"edgeGatewayName": {
|
|
"value": "[parameters('edgeGatewayName')]"
|
|
},
|
|
"region": {
|
|
"value": "[parameters('region')]"
|
|
},
|
|
"resetPin": {
|
|
"value": "[parameters('resetPin')]"
|
|
},
|
|
"spiDev": {
|
|
"value": "[parameters('spiDev')]"
|
|
},
|
|
"spiSpeed": {
|
|
"value": "[parameters('spiSpeed')]"
|
|
},
|
|
"stationEui": {
|
|
"value": "[parameters('stationEui')]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.Insights/components",
|
|
"kind": "web",
|
|
"name": "[variables('appInsightName')]",
|
|
"apiVersion": "2020-02-02",
|
|
"location": "[resourceGroup().location]",
|
|
"scale": null,
|
|
"properties": {
|
|
"ApplicationId": "[variables('appInsightName')]",
|
|
"WorkspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces/', variables('logAnalyticsName'))]"
|
|
},
|
|
"dependsOn": [ "[resourceId('Microsoft.OperationalInsights/workspaces/', variables('logAnalyticsName'))]" ]
|
|
},
|
|
{
|
|
"name": "azuremonitoralerts",
|
|
"type": "Microsoft.Resources/deployments",
|
|
"apiVersion": "[variables('deploymentsAPIVersion')]",
|
|
"condition": "[parameters('useAzureMonitorOnEdge')]",
|
|
"dependsOn": [
|
|
"[resourceId('microsoft.insights/components/', variables('appInsightName'))]",
|
|
"[concat('Microsoft.Devices/iothubs/', variables('iotHubName'))]"
|
|
],
|
|
"properties": {
|
|
"mode": "Incremental",
|
|
"templateLink": {
|
|
"uri": "[concat('https://raw.githubusercontent.com/',variables('gitUsername'),'/iotedge-lorawan-starterkit/',variables('gitBranch'),'/Template/azureMonitorAlerts.json')]",
|
|
"contentVersion": "1.0.0.0"
|
|
},
|
|
"parameters": {
|
|
"appInsightName": {
|
|
"value": "[variables('appInsightName')]"
|
|
},
|
|
"iotHubName": {
|
|
"value": "[variables('iotHubName')]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "azuremonitorworkbook",
|
|
"type": "Microsoft.Resources/deployments",
|
|
"apiVersion": "[variables('deploymentsAPIVersion')]",
|
|
"condition": "[parameters('useAzureMonitorOnEdge')]",
|
|
"dependsOn": [
|
|
"[resourceId('microsoft.insights/components/', variables('appInsightName'))]",
|
|
"[concat('Microsoft.Devices/iothubs/', variables('iotHubName'))]"
|
|
],
|
|
"properties": {
|
|
"mode": "Incremental",
|
|
"templateLink": {
|
|
"uri": "[concat('https://raw.githubusercontent.com/',variables('gitUsername'),'/iotedge-lorawan-starterkit/',variables('gitBranch'),'/Template/workbook.json')]",
|
|
"contentVersion": "1.0.0.0"
|
|
},
|
|
"parameters": {
|
|
"iotHubResourceId": {
|
|
"value": "[resourceId('microsoft.devices/iothubs/', variables('iotHubName'))]"
|
|
},
|
|
"appInsightsResourceId": {
|
|
"value": "[resourceId('microsoft.insights/components/', variables('appInsightName'))]"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "Microsoft.OperationalInsights/workspaces",
|
|
"apiVersion": "2021-06-01",
|
|
"name": "[variables('logAnalyticsName')]",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"retentionInDays": 30,
|
|
"sku": {
|
|
"name": "PerGB2018"
|
|
},
|
|
"workspaceCapping": {
|
|
"dailyQuotaGb": 10
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"apiVersion": "2018-03-01",
|
|
"name": "[variables('redisCacheName')]",
|
|
"type": "Microsoft.Cache/Redis",
|
|
"location": "[resourceGroup().location]",
|
|
"properties": {
|
|
"sku": {
|
|
"capacity": 0,
|
|
"family": "C",
|
|
"name": "Basic"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "discoveryservice",
|
|
"type": "Microsoft.Resources/deployments",
|
|
"apiVersion": "[variables('deploymentsAPIVersion')]",
|
|
"condition": "[parameters('useDiscoveryService')]",
|
|
"dependsOn": [
|
|
"[resourceId('microsoft.insights/components/', variables('appInsightName'))]",
|
|
"[concat('Microsoft.Devices/iothubs/', variables('iotHubName'))]"
|
|
],
|
|
"properties": {
|
|
"mode": "Incremental",
|
|
"templateLink": {
|
|
"uri": "[concat('https://raw.githubusercontent.com/',variables('gitUsername'),'/iotedge-lorawan-starterkit/',variables('gitBranch'),'/Template/discoveryService.json')]",
|
|
"contentVersion": "1.0.0.0"
|
|
},
|
|
"parameters": {
|
|
"webAppName": {
|
|
"value": "[variables('discoveryServiceWebAppName')]"
|
|
},
|
|
"iotHubName": {
|
|
"value": "[variables('iotHubName')]"
|
|
},
|
|
"iotHubHostName": {
|
|
"value": "[reference(resourceId('Microsoft.Devices/IoTHubs', variables('iotHubName')), providers('Microsoft.Devices', 'IoTHubs').apiVersions[0]).hostName]"
|
|
},
|
|
"discoveryZipUrl": {
|
|
"value": "[variables('discoveryServiceZipBinary')]"
|
|
},
|
|
"appInsightsInstrumentationKey": {
|
|
"value": "[reference(concat('microsoft.insights/components/', variables('appInsightName'))).InstrumentationKey]"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"outputs": {}
|
|
}
|