At DrDoctor we’re determined to push ahead with FHIR as the standard for interoperability in UK healthcare. Microsoft have developed an open source FHIR server that uses Azure services to deliver a fully operational API backed by a data repository. This is an enormous head start for anyone wanting to move to FHIR.
Our first challenge with our shiny new Azure-hosted FHIR server was how to deliver the API securely over the NHS private HSCN network. Azure services are accessed using HTTPS over the internet. Cloud services require a mental shift: if you use an Azure Cosmos database for example, then it is accessed over the internet, even by the other components of your own application. How you secure it is important! If you get it wrong, it’s a bit like your house having a 3-inch thick steel front door with iris recognition, and a normal wooden back door with a standard mortice lock.
Having decided our FHIR API was only going to be available over HSCN, we needed to be certain that the backend of it was going to be completely inaccessible via the public internet. The normal access controls used to restrict access to Azure services wouldn’t suffice.
The rest of this article is a how-to that might be useful to anyone wanting to get an Azure-hosted API working over HSCN with its associated backend services properly secured. Bottom line: we did it!
Using an Application Gateway to control App Service access
By deploying an Azure Application Gateway in a new subnet in the HSCN VNet and only configuring it with a private IP address we can use it to control access to the FHIR App Service.
To configure an Application Gateway to make an App Service only visible via an ExpressRoute:
Securing Cosmos DB so it can only be accessed by other services in our VNet
To make sure Cosmos DB could only be accessed by our own FHIR service, we used VNet Service Endpoint in combination with a new VNet Integration for the App Service.
Using Vnet Service Endpoint, you can configure Azure Cosmos DB to allow access only from a specific subnet of a VNet: only requests originating from those subnets will get a valid response, whereas requests originating from any other source will receive a 403 (Forbidden) response.
There is also a new VNet Integration, in preview at time of writing, that allows you to configure an App Service to access a resource across Service Endpoints. It’s currently only available from newer Azure App Service scale units.
Configuring App Service with New VNet Integration
The new VNet Integration capability is only available from newer Azure App Service scale units. If you can scale to PremiumV2, then you are in a newer App Service scale unit.
For this we will be using subnet created for our FHIR service in the previous section. Make sure that it doesn't have any Service Endpoints or Subnet Delegation configured.
References
Configuring Cosmos DB with VNet Service Endpoint
References
A couple of other options we tried and discarded
It would be possible to use an Azure App Service Environment (ASE) to run the FHIR App Service in an isolated environment, and pair that environment to a VNet. This would keep traffic between other Azure services and the ASE on the Azure backbone network. The cost of an ASE is high (around £800/month at time of writing) so we didn't explore this option any further. For more info on these Azure services see here and here.
We thought we could force Cosmo DB to accept connections only from the FHIR App Service through IP rules, but the App Service outbound IPs are not static. In the App Service properties there is a list of possible IPs, but they could change when the application scales between different tiers (see: https://docs.microsoft.com/en-gb/azure/app-service/overview-inbound-outbound-ips#when-outbound-ips-change).