diff --git a/deploy/az/servicebus/readme.md b/deploy/az/servicebus/readme.md new file mode 100644 index 000000000..3ed8e8a0e --- /dev/null +++ b/deploy/az/servicebus/readme.md @@ -0,0 +1,33 @@ +# Deploying Azure Service Bus + +The ARM template `sbusdeploy.json` and its parameter file (`sbusdeploy.parameters.json`) are used to deploy following resources: + +1. One Service Bus namespace +2. One Service Bus +3. Subscriptions used by application + +## Editing sbusdeploy.parameters.json file + +You can edit the `sbusdeploy.parameters.parameters.json` file to set your values, but is not needed. The only parameter than can +be set is: + +1. `namespaceprefix` is a string that is used to create the namespace. ARM script creates unique values by appending a unique string to this parameter value, so you can leave the default value. + +## Deploy the template + +Once parameter file is edited you can deploy it using [create-resources script](../readme.md). + +i. e. if you are in windows, to deploy sql databases in a new resourcegroup located in westus, go to `deploy\az` folder and type: + +``` +create-resources.cmd servicebus\sbusdeploy newResourceGroup -c westus +``` + + + + + + + + + diff --git a/deploy/az/servicebus/sbusdeploy.json b/deploy/az/servicebus/sbusdeploy.json new file mode 100644 index 000000000..5f6ce3c90 --- /dev/null +++ b/deploy/az/servicebus/sbusdeploy.json @@ -0,0 +1,145 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "namespaceprefix": { + "type": "string", + "metadata": { + "description": "Name of the Service Bus namespace" + } + } + }, + "variables": { + "serviceBusTopicName": "eshop_event_bus", + "BasketSubscriptionName": "Basket", + "CatalogSubscriptionName": "Catalog", + "OrderingSubscriptionName": "Ordering", + "location": "[resourceGroup().location]", + "sbVersion": "2015-08-01", + "defaultSASKeyName": "Root", + "namespace":"[concat(parameters('namespaceprefix'), uniqueString(resourceGroup().id))]", + "authRuleResourceId": "[resourceId('Microsoft.ServiceBus/namespaces/topics/authorizationRules', variables('namespace'), variables('serviceBusTopicName'), variables('defaultSASKeyName'))]" + }, + "resources": [ + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('namespace')]", + "type": "Microsoft.ServiceBus/Namespaces", + "location": "[variables('location')]", + "sku": { + "name": "Standard", + "tier": "Standard" + }, + "resources": [ + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('serviceBusTopicName')]", + "type": "Topics", + "dependsOn": [ + "[concat('Microsoft.ServiceBus/namespaces/', variables('namespace'))]" + ], + "properties": { + "path": "[variables('serviceBusTopicName')]", + "defaultMessageTimeToLive": "14.00:00:00", + "maxSizeInMegabytes": 1024, + "requiresDuplicateDetection": false, + "enableBatchedOperations": true, + "sizeInBytes": 0, + "filteringMessagesBeforePublishing": false, + "isAnonymousAccessible": false, + "status": "Active", + "supportOrdering": false, + "autoDeleteOnIdle": "10675199.02:48:05.4775807", + "enablePartitioning": true, + "isExpress": false, + "enableSubscriptionPartitioning": false, + "enableExpress": false + }, + "resources": [ + { + "type": "AuthorizationRules", + "name": "[variables('defaultSASKeyName')]", + "apiVersion": "[variables('sbVersion')]", + "properties": { + "rights": [ + "Manage", + "Send", + "Listen" + ] + }, + "dependsOn": [ + "[variables('serviceBusTopicName')]" + ] + }, + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('BasketSubscriptionName')]", + "type": "Subscriptions", + "dependsOn": [ + "[variables('serviceBusTopicName')]" + ], + "properties": { + "lockDuration": "00:00:30", + "requiresSession": false, + "defaultMessageTimeToLive": "14.00:00:00", + "deadLetteringOnMessageExpiration": true, + "deadLetteringOnFilterEvaluationExceptions": true, + "maxDeliveryCount": 10, + "enableBatchedOperations": false, + "status": "Active", + "autoDeleteOnIdle": "10675199.02:48:05.4775807", + "entityAvailabilityStatus": "Available" + } + }, + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('OrderingSubscriptionName')]", + "type": "Subscriptions", + "dependsOn": [ + "[variables('serviceBusTopicName')]" + ], + "properties": { + "lockDuration": "00:00:30", + "requiresSession": false, + "defaultMessageTimeToLive": "14.00:00:00", + "deadLetteringOnMessageExpiration": true, + "deadLetteringOnFilterEvaluationExceptions": true, + "maxDeliveryCount": 10, + "enableBatchedOperations": false, + "status": "Active", + "autoDeleteOnIdle": "10675199.02:48:05.4775807", + "entityAvailabilityStatus": "Available" + } + }, + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('CatalogSubscriptionName')]", + "type": "Subscriptions", + "dependsOn": [ + "[variables('serviceBusTopicName')]" + ], + "properties": { + "lockDuration": "00:00:30", + "requiresSession": false, + "defaultMessageTimeToLive": "14.00:00:00", + "deadLetteringOnMessageExpiration": true, + "deadLetteringOnFilterEvaluationExceptions": true, + "maxDeliveryCount": 10, + "enableBatchedOperations": false, + "status": "Active", + "autoDeleteOnIdle": "10675199.02:48:05.4775807", + "entityAvailabilityStatus": "Available" + } + } + ] + } + ] + } + ], + "outputs": { + "NamespaceConnectionString": { + "type": "string", + "value": "[listkeys(variables('authRuleResourceId'), variables('sbVersion')).primaryConnectionString]" + } + } +} \ No newline at end of file diff --git a/deploy/az/servicebus/sbusdeploy.parameters.json b/deploy/az/servicebus/sbusdeploy.parameters.json new file mode 100644 index 000000000..f14b5329d --- /dev/null +++ b/deploy/az/servicebus/sbusdeploy.parameters.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "namespaceprefix": { + "value": "eshopsb" + } + } +} diff --git a/deploy/readme.md b/deploy/readme.md index bf51a7bf2..a9520e1f7 100644 --- a/deploy/readme.md +++ b/deploy/readme.md @@ -18,6 +18,7 @@ Using `docker-machine` is the recommended way to create a VM with docker install ## Deploying Azure resources used by the services 1. [Deploying SQL Server and databases](az/sql/readme.md) +2. [Deploying Azure Service Bus](az/servicebus/readme.md)