My repo has different arm templates (azure deploy json files) for two different environments. Each environment has its own service bus namespace. I want to generate the same list of topics for each environment in the arm template.
I want to keep the service bus namespace name in their perspective arm template, but I'm not sure if I'm doing this the right way.
The list of topics will be in a parameters.json file. I want to use the same parameters file for both environment/templates. I'm also not sure if this is possible. From this article, using the same parameter file may not be do-able.
I used this site as a reference to create the loop of topics.
Here is en example of an armtemplate.json file:
...
"parameters": {
"serviceBusNamespaceName": {
"type": "string",
"defaultValue": "serviceBusName1",
"metadata": {
"description": "Name of the Service Bus namespace"
}
},
"serviceBusTopics": {
"type": "array",
"metadata": {
"description": "List of topics"
}
},
...
"resources": [
{
"apiVersion": "2017-04-01",
"name": "[parameters('serviceBusNamespaceName')]",
"type": "Microsoft.ServiceBus/namespaces",
"location": "[resourceGroup().location]",
"sku": {
"name": "Standard"
},
"properties": {}
},
{
"apiVersion": "2017-04-01",
"name": "[concat(parameters('serviceBusNamespaceName'), '/', parameters('serviceBusTopics')[copyIndex()])]",
"type": "Microsoft.ServiceBus/namespaces/topics",
"location": "[resourceGroup().location]",
"copy": {
"name": "topicLoop",
"count": "[length(parameters('serviceBusTopics'))]"
},
"properties": {},
"dependsOn": [
"[concat('Microsoft.ServiceBus/namespaces/', parameters('serviceBusNamespaceName'))]"
]
},
....
Here is the parameters.json file:
"parameters": {
"serviceBusTopics": {
"value": [
"topic1",
"topic2"
]
}
}
I have Azure Pipelines configured to build and deploy the azure resources. When I navigate out to Azure Portal and check each service bus, I expect to see the topics created. However, this is not working for me.
Can I use the same parameter file for different template/environment? Syntactically, do I have any errors?