I've a microservice that runs on a Azure Container Instance, and a WebApp that run on App Service. I want my WebApp to call my microservice (that is private). I've created a virtual network (v-net) with a subnet. But Azure says my two services cannot be on the same subnet because there are not delegated by the same resource. WebApp is delegated to Microsoft.Web/serverfarms and Azure Container Service is delegated to: Microsoft.ContainerInstance/containerGroups. How can I achieve what I want ? (call the microservice from the webapp ?)
CodePudding user response:
Even though it's not exactly how you're trying to achieve, you can always use a message broker to decouple and enable the communication between 1-N microservices using a Service Bus Topic.
Among the benefits:
- it's the fact Web App won't need to know the URI to communicate with the Microservices
- You can add more microservices to react to a particular type of message in the future with no code changes (besides the subscription of the new microservice to a specific topic)
- it's reliable and durable
- well tested and used in all kind of applications (ecommerces, crm, erp, etc)
- you won't need to deal with such network configuration issues.
You can read more about my recommended solution:
https://microservices.io/patterns/communication-style/messaging.html
https://docs.microsoft.com/en-us/azure/architecture/microservices/design/interservice-communication
https://docs.microsoft.com/en-us/dotnet/architecture/cloud-native/service-to-service-communication