Skip to content

Commit ec7a251

Browse files
committed
Service Bus deploy template and doc
1 parent ed0e548 commit ec7a251

4 files changed

Lines changed: 188 additions & 0 deletions

File tree

deploy/az/servicebus/readme.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Deploying Azure Service Bus
2+
3+
The ARM template `sbusdeploy.json` and its parameter file (`sbusdeploy.parameters.json`) are used to deploy following resources:
4+
5+
1. One Service Bus namespace
6+
2. One Service Bus
7+
3. Subscriptions used by application
8+
9+
## Editing sbusdeploy.parameters.json file
10+
11+
You can edit the `sbusdeploy.parameters.parameters.json` file to set your values, but is not needed. The only parameter than can
12+
be set is:
13+
14+
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.
15+
16+
## Deploy the template
17+
18+
Once parameter file is edited you can deploy it using [create-resources script](../readme.md).
19+
20+
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:
21+
22+
```
23+
create-resources.cmd servicebus\sbusdeploy newResourceGroup -c westus
24+
```
25+
26+
27+
28+
29+
30+
31+
32+
33+
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
{
2+
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"namespaceprefix": {
6+
"type": "string",
7+
"metadata": {
8+
"description": "Name of the Service Bus namespace"
9+
}
10+
}
11+
},
12+
"variables": {
13+
"serviceBusTopicName": "eshop_event_bus",
14+
"BasketSubscriptionName": "Basket",
15+
"CatalogSubscriptionName": "Catalog",
16+
"OrderingSubscriptionName": "Ordering",
17+
"location": "[resourceGroup().location]",
18+
"sbVersion": "2015-08-01",
19+
"defaultSASKeyName": "Root",
20+
"namespace":"[concat(parameters('namespaceprefix'), uniqueString(resourceGroup().id))]",
21+
"authRuleResourceId": "[resourceId('Microsoft.ServiceBus/namespaces/topics/authorizationRules', variables('namespace'), variables('serviceBusTopicName'), variables('defaultSASKeyName'))]"
22+
},
23+
"resources": [
24+
{
25+
"apiVersion": "[variables('sbVersion')]",
26+
"name": "[variables('namespace')]",
27+
"type": "Microsoft.ServiceBus/Namespaces",
28+
"location": "[variables('location')]",
29+
"sku": {
30+
"name": "Standard",
31+
"tier": "Standard"
32+
},
33+
"resources": [
34+
{
35+
"apiVersion": "[variables('sbVersion')]",
36+
"name": "[variables('serviceBusTopicName')]",
37+
"type": "Topics",
38+
"dependsOn": [
39+
"[concat('Microsoft.ServiceBus/namespaces/', variables('namespace'))]"
40+
],
41+
"properties": {
42+
"path": "[variables('serviceBusTopicName')]",
43+
"defaultMessageTimeToLive": "14.00:00:00",
44+
"maxSizeInMegabytes": 1024,
45+
"requiresDuplicateDetection": false,
46+
"enableBatchedOperations": true,
47+
"sizeInBytes": 0,
48+
"filteringMessagesBeforePublishing": false,
49+
"isAnonymousAccessible": false,
50+
"status": "Active",
51+
"supportOrdering": false,
52+
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
53+
"enablePartitioning": true,
54+
"isExpress": false,
55+
"enableSubscriptionPartitioning": false,
56+
"enableExpress": false
57+
},
58+
"resources": [
59+
{
60+
"type": "AuthorizationRules",
61+
"name": "[variables('defaultSASKeyName')]",
62+
"apiVersion": "[variables('sbVersion')]",
63+
"properties": {
64+
"rights": [
65+
"Manage",
66+
"Send",
67+
"Listen"
68+
]
69+
},
70+
"dependsOn": [
71+
"[variables('serviceBusTopicName')]"
72+
]
73+
},
74+
{
75+
"apiVersion": "[variables('sbVersion')]",
76+
"name": "[variables('BasketSubscriptionName')]",
77+
"type": "Subscriptions",
78+
"dependsOn": [
79+
"[variables('serviceBusTopicName')]"
80+
],
81+
"properties": {
82+
"lockDuration": "00:00:30",
83+
"requiresSession": false,
84+
"defaultMessageTimeToLive": "14.00:00:00",
85+
"deadLetteringOnMessageExpiration": true,
86+
"deadLetteringOnFilterEvaluationExceptions": true,
87+
"maxDeliveryCount": 10,
88+
"enableBatchedOperations": false,
89+
"status": "Active",
90+
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
91+
"entityAvailabilityStatus": "Available"
92+
}
93+
},
94+
{
95+
"apiVersion": "[variables('sbVersion')]",
96+
"name": "[variables('OrderingSubscriptionName')]",
97+
"type": "Subscriptions",
98+
"dependsOn": [
99+
"[variables('serviceBusTopicName')]"
100+
],
101+
"properties": {
102+
"lockDuration": "00:00:30",
103+
"requiresSession": false,
104+
"defaultMessageTimeToLive": "14.00:00:00",
105+
"deadLetteringOnMessageExpiration": true,
106+
"deadLetteringOnFilterEvaluationExceptions": true,
107+
"maxDeliveryCount": 10,
108+
"enableBatchedOperations": false,
109+
"status": "Active",
110+
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
111+
"entityAvailabilityStatus": "Available"
112+
}
113+
},
114+
{
115+
"apiVersion": "[variables('sbVersion')]",
116+
"name": "[variables('CatalogSubscriptionName')]",
117+
"type": "Subscriptions",
118+
"dependsOn": [
119+
"[variables('serviceBusTopicName')]"
120+
],
121+
"properties": {
122+
"lockDuration": "00:00:30",
123+
"requiresSession": false,
124+
"defaultMessageTimeToLive": "14.00:00:00",
125+
"deadLetteringOnMessageExpiration": true,
126+
"deadLetteringOnFilterEvaluationExceptions": true,
127+
"maxDeliveryCount": 10,
128+
"enableBatchedOperations": false,
129+
"status": "Active",
130+
"autoDeleteOnIdle": "10675199.02:48:05.4775807",
131+
"entityAvailabilityStatus": "Available"
132+
}
133+
}
134+
]
135+
}
136+
]
137+
}
138+
],
139+
"outputs": {
140+
"NamespaceConnectionString": {
141+
"type": "string",
142+
"value": "[listkeys(variables('authRuleResourceId'), variables('sbVersion')).primaryConnectionString]"
143+
}
144+
}
145+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"namespaceprefix": {
6+
"value": "eshopsb"
7+
}
8+
}
9+
}

deploy/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Using `docker-machine` is the recommended way to create a VM with docker install
1818
## Deploying Azure resources used by the services
1919

2020
1. [Deploying SQL Server and databases](az/sql/readme.md)
21+
2. [Deploying Azure Service Bus](az/servicebus/readme.md)
2122

2223

2324

0 commit comments

Comments
 (0)