Skip to content

Instantly share code, notes, and snippets.

@crh
Created November 1, 2018 14:15
Show Gist options
  • Save crh/b8fad4ea92c32a1515d401b17d60b294 to your computer and use it in GitHub Desktop.
Save crh/b8fad4ea92c32a1515d401b17d60b294 to your computer and use it in GitHub Desktop.
{
"$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"
}
}
},
"variables": {
"iotHubName": "[concat(parameters('uniqueSolutionPrefix'), 'hub')]",
"location": "[resourceGroup().location]",
"hostingPlanName": "[concat(parameters('uniqueSolutionPrefix'), 'plan')]",
"storageAccountName": "[concat(parameters('uniqueSolutionPrefix'), 'storage')]",
"storageAccountType": "Standard_LRS",
"functionAppName": "[concat(parameters('uniqueSolutionPrefix'), 'function')]",
"gitUsername": "Azure",
"gitRepoUrl": "[concat('https://github.com/',variables('gitUsername'),'/iotedge-lorawan-starterkit.git')]",
"gitBranch": "master",
"storageAccountId": "[concat(resourceGroup().id, '/providers/', 'Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
"iotHubOwnerPolicyName": "iothubowner",
"appInsightName":"[concat(parameters('uniqueSolutionPrefix'), 'insight')]"
},
"resources": [
{
"type": "Microsoft.Devices/IotHubs",
"sku": {
"name": "F1",
"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": [
"[concat('Microsoft.Devices/iothubs/', variables('iotHubName'))]"
]
},
{
"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'))]"
],
"resources": [
{
"apiVersion": "2016-08-01",
"name": "web",
"type": "sourcecontrols",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('functionAppName'))]"
],
"properties": {
"repoUrl": "[variables('gitRepoUrl')]",
"branch": "[variables('gitBranch')]",
"IsManualIntegration": true
}
}
],
"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)]"
}
],
"appSettings": [
{
"name": "AzureWebJobsDashboard",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountId'),'2015-05-01-preview').key1)]"
},
{
"name": "AzureWebJobsStorage",
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountId'),'2015-05-01-preview').key1)]"
},
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "beta"
},
{
"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": "WEBSITE_NODE_DEFAULT_VERSION",
"value": "6.5.0"
},
{
"name": "PROJECT",
"value": "LoRaEngine/LoraKeysManagerFacade/LoraKeysManagerFacade.csproj"
},
{
"name": "FACADE_HOST_NAME",
"value": "[variables('functionAppName')]"
},
{
"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": "functionLauncher",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"dependsOn": [
"[resourceId('Microsoft.Web/sites/sourcecontrols', variables('functionAppName'),'web')]"
],
"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')]"
}
}
}
},
{
"type": "microsoft.insights/components",
"kind": "web",
"name": "[variables('appInsightName')]",
"apiVersion": "2015-05-01",
"location": "[resourceGroup().location]",
"scale": null,
"properties": {
"ApplicationId": "[variables('appInsightName')]"
},
"dependsOn": []
}
],
"outputs": {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment