-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds an ARM template to create the following resources: - Event Hubs namespace and Event Hub - Storage Account and Storage Container To simplify setup. In addition, the outputs it spits out are exactly the values you'd need to set as environment varialbes (minus the app registration stuff which will be done manually)
- Loading branch information
Showing
2 changed files
with
154 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"baseName": { | ||
"type": "string", | ||
"defaultValue": "[resourceGroup().name]", | ||
"metadata": { | ||
"description": "The base resource name." | ||
} | ||
}, | ||
"appPort": { | ||
"type": "string", | ||
"defaultValue": "3000", | ||
"metadata": { | ||
"description": "The port used for the React app. Defaults to 3000" | ||
} | ||
} | ||
}, | ||
"variables": { | ||
"eventHubsName": "events", | ||
"eventHubsNamespace": "[concat(parameters('baseName'), 'reactEvents')]", | ||
"storageAccount": "[concat(parameters('baseName'), 'reactstorage')]", | ||
"storageContainer": "[concat(parameters('baseName'), 'reactstorage', '/default/blobs')]", | ||
"location": "[resourceGroup().location]" | ||
}, | ||
"resources": [ | ||
{ | ||
"type": "Microsoft.EventHub/namespaces", | ||
"apiVersion": "2018-01-01-preview", | ||
"name": "[variables('eventHubsNamespace')]", | ||
"location": "[variables('location')]", | ||
"sku": { | ||
"name": "Basic", | ||
"tier": "Basic", | ||
"capacity": 1 | ||
}, | ||
"properties": { | ||
"zoneRedundant": false, | ||
"isAutoInflateEnabled": false, | ||
"maximumThroughputUnits": 0, | ||
"kafkaEnabled": false | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.Storage/storageAccounts", | ||
"apiVersion": "2020-08-01-preview", | ||
"name": "[variables('storageAccount')]", | ||
"location": "[variables('location')]", | ||
"sku": { | ||
"name": "Standard_RAGRS", | ||
"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" | ||
}, | ||
"accessTier": "Hot" | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.EventHub/namespaces/eventhubs", | ||
"apiVersion": "2017-04-01", | ||
"name": "[concat(variables('eventHubsNamespace'), '/', variables('eventHubsName'))]", | ||
"location": "[variables('location')]", | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.EventHub/namespaces', variables('eventHubsNamespace'))]" | ||
], | ||
"properties": { | ||
"messageRetentionInDays": 1, | ||
"partitionCount": 2, | ||
"status": "Active" | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.Storage/storageAccounts/blobServices", | ||
"apiVersion": "2020-08-01-preview", | ||
"name": "[concat(variables('storageAccount'), '/default')]", | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccount'))]" | ||
], | ||
"sku": { | ||
"name": "Standard_RAGRS", | ||
"tier": "Standard" | ||
}, | ||
"properties": { | ||
"cors": { | ||
"corsRules": [ | ||
{ | ||
"allowedOrigins": ["[concat('http://localhost:', parameters('appPort'))]"], | ||
"allowedMethods": ["GET", "OPTIONS"], | ||
"maxAgeInSeconds": 0, | ||
"exposedHeaders": ["*"], | ||
"allowedHeaders": ["*"] | ||
} | ||
] | ||
}, | ||
"deleteRetentionPolicy": { | ||
"enabled": false | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.Storage/storageAccounts/blobServices/containers", | ||
"apiVersion": "2020-08-01-preview", | ||
"name": "[variables('storageContainer')]", | ||
"dependsOn": [ | ||
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', variables('storageAccount'), 'default')]", | ||
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccount'))]" | ||
], | ||
"properties": { | ||
"defaultEncryptionScope": "$account-encryption-key", | ||
"denyEncryptionScopeOverride": false, | ||
"publicAccess": "None" | ||
} | ||
} | ||
], | ||
"outputs": { | ||
"REACT_APP_BLOB_URI": { | ||
"type": "string", | ||
"value": "[reference(variables('storageAccount')).primaryEndpoints.blob]" | ||
}, | ||
"REACT_APP_BLOB_CONTAINER": { | ||
"type": "string", | ||
"value": "[last(split(variables('storageContainer'), '/'))]" | ||
}, | ||
"REACT_APP_EVENT_HUBS_NAMESPACE": { | ||
"type": "string", | ||
"value": "[concat(variables('eventHubsNamespace'), '.servicebus.windows.net')]" | ||
}, | ||
"REACT_APP_EVENT_HUBS_NAME": { | ||
"type": "string", | ||
"value": "[variables('eventHubsName')]" | ||
} | ||
} | ||
} |