2
votes

Here's what I have on Azure:

Resource group: 'microservice-1'
App Service: 'app-service-1'
Database: 'database-1'

Resource group: 'microservice-2'
App Service: 'app-service-2'
Database: 'database-2'

Resource group: 'shared-infrastructure'
Database: 'shared-database-1'

Both microservices use shared-database-1. Every microservice contain ARM template script to create/update resource group that is used when microservice is deployed. In ARM scripts we can define dependencies (dependsOn) so that the resources are updated with proper order but this work only within resource group.

Here's the scenario I want to run:
There's nothing in Azure and I want to release microservice-1. Is there a mechanism in Azure / ARM that I can use, so that shared-infrastructure release (ARM template) is run prior to microservice-1?

1

1 Answers

1
votes

No, unless you specifically include that in your ARM Template. DependOn just check if the resource is there, it won't magically create it for you.

But you could include that in your template and if it exists, it won't do anything, unless you specify deploymentmode = complete.

So you could create 3 templates,: for microservice-1, microservice-2 and for shared-infrastructure. In your templates for microservices you could include the deployment to create shared infrastructure and it won't do it if its already in place

Edited based on comments:

You can link resources in the same subscription after deployment. There's no way to do that with ARM, but PowerShell + ARM could do that, you could search for existing instances of shared resource and if its not there - create it with an ARM template and after that invoke another ARM template to deploy the actual service.