What is it?
The Azure Service Bus Relay is a technology which is aimed at helping you to create hybrid integration solutions where one you would bridge from a client outside of your organisation to access a service inside your network.
Azure Service Bus Relay is conceptually like a router hosted in the cloud. If you implement an on premise service then that service can “come online” and open an endpoint which is hosted in the cloud on the Azure Service Bus Relay. You can then allow a client application to access this endpoint and make web service calls to it which are then routed down to the service implementation which is hosted on premise. Your service would then implement the functionality it normally would.
The below picture shows you an example of how Dynamics CRM could be calling a service hosted on the Azure Service Bus Relay.
This section will include some common information you might need to know or common technical questions which are asked.
How does it bridge into my organisation?
The Azure Service Bus Relay uses a port forwarding technology which allows your on premise service to open up an outbound bi-directional connection from your on premise server to the cloud.. The relay is then able to forward requests back down that bi-directional channel to your on premise service.
The fact that the connection to the cloud from on premise is initiated on premise and is outbound means that you do not need to expose any inbound ports through your organizations firewall which increases the security.
What about Security
The Azure Service Bus Relay uses transport level security with SSL to secure data over the wire over https or net/tpc protocols for WCF. The Azure Service Bus Relay uses shared access secrets which are provided by the Azure portal. These secrets allow you to have a different secret for senders, receivers and manage permissions related to the relay.
Do I have to host the receiver service on premise?
No you don’t, the receiver service can be hosted anywhere as long as it can access the internet to register itself on the endpoint. Example receivers could be:
- An Azure App Service with a WCF receiver configured to use the Service Bus bindings
- An on premise IIS application
- An on premise windows service
- An Azure Web Job which has opened a listener to the Service Bus
- A custom .net application using WCF
The receiver can be in your own data centre, in Azure or in another cloud provider.
Do I have to use WCF?
You would normally use one of the WCF relay bindings which allows you to support SOAP or REST based messages being flown over the channel. REST allows some interoperability for the client wanting to send the message but the server side receiver of the message needs to be a WCF hosted service.
How does load balancing work?
Load balancing works using a competing consumer pattern where messages are routed across the receivers which are currently listening. One service instance will receive one copy of the message. You do not need any special on premise routing software or hardware.
There are not really any special hosting requirements for Azure Service Bus Relay. You need to create a namespace via the Azure Portal but otherwise you can just use the infrastructure you already have provided your service would be able to open an outbound listening connection to the relay endpoint.
The costs for Azure Service Bus Relay follow a pay as you go model. You would pay per hour for each listening service instance and also per message for each message flowing through the relay.
Obviously the costs depend on how much you use it and on real world projects we have found that unless you are a very high volume user the Azure Service Bus Relay tends to be one of the lowest cost options for connecting cloud to on premise in terms of setup and running costs.
Pricing details are available on the Microsoft Website: Click Here
The following technologies can be combined with Azure Service Bus Relay when creating solutions.
In BizTalk you can create a receive location which uses the WCF relay bindings which allows you to open up an endpoint on the Azure Service Bus Relay which allows BizTalk to receive messages via the cloud. This can be a great low cost way to bridge from outside of your organisation to your existing BizTalk infrastructure.
WCF Routing Service
If you have existing on premise web services and want to expose them to the cloud without having to make any changes to allow them to use the WCF relay bindings then one great way you can do this is to use the WCF Routing Service along side Azure Service Bus Relay. Your instance of the WCF Routing Service would come online and register an endpoint in the Azure Service Bus Relay. When a message is send through the cloud to your on premise WCF Routing Service it will inspect the SOAP Action and use some routing rules to forward the message to another WCF Service somewhere else on premise.
This is an easy way to span out to the cloud for an existing application potentially without having to implement any changes.
Sample Usage Scenarios
The following are some sample usage scenarios where you might use Azure Service Bus Relay.
- Extending Service Bus with WCF Routing Service
- Extending BizTalk to the Cloud with Service Bus Relay
The following articles are recommended reading to find out more about this technology:
- Technet Wiki contains links to many resources related to Azure Service Bus Relay – Click Here
- Neudesic have a great article about Azure Service Bus (including relay) which is a good starting point – Click Here