-
Notifications
You must be signed in to change notification settings - Fork 0
z Using a custom domain
This is for TRE Developers only, there's nothing for TRE Users on this page.
The SDE as deployed in Azure will have a URL in the cloudapp.azure.com
domain. To use a custom domain, e.g. sde.bartshealth.nhs.uk
, there are a few steps to go through:
- Add redirects for your custom domain.
- Obtain an SSL certificate for your domain.
- provide a DNS CNAME entry from the host domain to the hostname in Azure.
- upload the certificate to the SDE in Azure.
- configure the Application Gateway to use the certificate.
There will be documentation for this appearing in the TRE codebase at some point, but it's not released yet. So, go to App registrations in the Azure portal, and find your application, You want the UX version.
![05 App Registrations](https://private-user-images.githubusercontent.com/153200306/364473241-7a4beaa4-eadd-4a34-8d04-f10e586f804d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNDcxMjYsIm5iZiI6MTczOTM0NjgyNiwicGF0aCI6Ii8xNTMyMDAzMDYvMzY0NDczMjQxLTdhNGJlYWE0LWVhZGQtNGEzNC04ZDA0LWYxMGU1ODZmODA0ZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQwNzUzNDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jMzk2NDVjOWM0YThjMDAyMjJiZjdmNTI1N2RlMTE2YjFkYTg5MWIyMDZiYWY5ZmI3N2NkZWE5MGNlMmVjNmNmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.FpU_xS2VsG_THL-uefT4L8AI9ksQRqm265LCgJsQrhM)
Go to Manage -> Authentication, then + Add a platform. Choose Single page application.
![06 Add platform](https://private-user-images.githubusercontent.com/153200306/364473862-51804264-0eac-42f5-bfa2-0c4d90ec6b39.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNDcxMjYsIm5iZiI6MTczOTM0NjgyNiwicGF0aCI6Ii8xNTMyMDAzMDYvMzY0NDczODYyLTUxODA0MjY0LTBlYWMtNDJmNS1iZmEyLTBjNGQ5MGVjNmIzOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQwNzUzNDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zM2Y2NmMxMmI4ZDYwOTRiZjAxZGQyYWUwMDYwMzUxNmUzMGE5OTljYWU0MzJjYTVlNDZhNGRmYTQ5MGM1YmE4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.C0QGrCWyTQXO79QQVc78Y4W2BEHQnlyhDnRud-bXZMA)
Add your custom domain URL there, with the https://
prefix. Don't add a trailing /
. Click Configure.
Click + Add a platform again, and repeat, with the URL https://<your-domain>/api/docs/oauth2-redirect
. Your list of redirects should then look something like this:
![07 Redirect URIs](https://private-user-images.githubusercontent.com/153200306/364475725-603c9f89-a35d-4058-b6d4-ecfe73b43146.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNDcxMjYsIm5iZiI6MTczOTM0NjgyNiwicGF0aCI6Ii8xNTMyMDAzMDYvMzY0NDc1NzI1LTYwM2M5Zjg5LWEzNWQtNDA1OC1iNmQ0LWVjZmU3M2I0MzE0Ni5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQwNzUzNDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02ZWRmNzQ4OGE4NzZiYmNiNDhmOThmMTFiNTRlNjBhMzNkODA4Y2NhZTk1MThiNTU2OTA0ZWY3NWMzYzZhYjc3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ASjXlX4yqjvgnkmCWeEFUAsfLa_-ChIVjqvuWG-4t04)
This involves sending an email to someone, and handing over some money. Ask Steven how.
You will need a certificate (<something>.pfx
file), and the password for that certificate.
Note that the TRE documentation refers to using a custom domain with a certificate managed by letsencrypt
, but that doesn't work with bartshealth.nhs.uk
. Our domain is protected against allowing anyone other than Digicert from issuing certificates, so letsencrypt will fail.
This also involves an email, but no money (AFAIK). Ask Steven, again...
Go to the key vault in your core resource group, then Objects -> Certificates, you should see one called letsencrypt. That's the one that needs updating. It's unfortunate they gave it that name, but we're stuck with it unless we want to modify the code.
![01 keyvault](https://private-user-images.githubusercontent.com/153200306/364460832-ed4df8fa-26cd-416a-a7ec-db91c5b5a0ba.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNDcxMjYsIm5iZiI6MTczOTM0NjgyNiwicGF0aCI6Ii8xNTMyMDAzMDYvMzY0NDYwODMyLWVkNGRmOGZhLTI2Y2QtNDE2YS1hN2VjLWRiOTFjNWI1YTBiYS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQwNzUzNDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yNGYwYWJhNDc1OWRmYTAwNjUzMGVmYTg5NjQyMzU5ZjAwNDY0MzYxZTZjMDgyMjFmMDQ1ODI4YWViMGU5ZmVjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.0JxzCGcbuGOMgWkVCUNMaLkibBPj9PCNXq0RgJwp40E)
Click letsencrypt, then + New Version. Change the Method of Certificate Creation to Import, locate the certificate file on your local drive, and put in the password. Then Create, and your certificate should be correctly imported. Check that your new certificate is the current one, and that the import and expiry dates are as you expect.
![02 certificate](https://private-user-images.githubusercontent.com/153200306/364461468-9ead3270-8aeb-466b-ab3a-22d2aa3debe1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNDcxMjYsIm5iZiI6MTczOTM0NjgyNiwicGF0aCI6Ii8xNTMyMDAzMDYvMzY0NDYxNDY4LTllYWQzMjcwLThhZWItNDY2Yi1hYjNhLTIyZDJhYTNkZWJlMS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQwNzUzNDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04MGE1NDA2ZDhkYmMzYjZmZGU4MzFjMWRjMjU3OTY4MjZjYzdhOThlMTNkMTU2NDA3ZjVjMDg4MGQzZmVmODFlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.nYTgeUexoHUq-qgZLTngLfYu34WkyhhcFHO1YK6rKYk)
Now that your certificate is there, you have to tell the Application Gateway to use it. Go to Application Gateways in the Azure portal, find the one with your TRE ID in the name, and click on it. Then go to Settings -> Listeners, then the Listener TLS Certificates tab.
![03 Listeners](https://private-user-images.githubusercontent.com/153200306/364463090-a79b18cc-23cd-4a8b-a122-0df63c15e5cb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNDcxMjYsIm5iZiI6MTczOTM0NjgyNiwicGF0aCI6Ii8xNTMyMDAzMDYvMzY0NDYzMDkwLWE3OWIxOGNjLTIzY2QtNGE4Yi1hMTIyLTBkZjYzYzE1ZTVjYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQwNzUzNDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wYjhhMTQ1ZTczYjQ0NTRkNjgyNGYzZDJiN2QyMzZmYjhiZjZhZDVlODViMmRmMDIwMWNhMmMyYTliOGQyYTEzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.jK7a0Ufep4N88p3elAzv4B9FFADw8N7Vf2LE9BFGOrY)
Click + Add certificate, select Choose a certificate from Key Vault, provide a name, then find your key vault from the dropdown, and choose the letsencrypt certificate.
![04 Add listener certificate](https://private-user-images.githubusercontent.com/153200306/364465018-32b161a7-5458-4de0-a760-9df3439ba2c8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNDcxMjYsIm5iZiI6MTczOTM0NjgyNiwicGF0aCI6Ii8xNTMyMDAzMDYvMzY0NDY1MDE4LTMyYjE2MWE3LTU0NTgtNGRlMC1hNzYwLTlkZjM0MzliYTJjOC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQwNzUzNDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iMmJjZmViNTZhNTBlNTRiMjcwMjQ1ODIwNGY5YWZjOWJmMjVlNWQxYmU0Zjk2YjE0NzVlMjEwNzczYzY5ZGQyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.loJU8XEXmJRFczL-20MlflWDmbuogdkDjQ3nnJjnKIE)
Go back to the Listeners tab, double-click on httplstn-secure. From the Certificate dropdown, choose the certificate you just uploaded, and Save.
That should be all you need to do. Enter your custom domain in the browser, and it should take you to your SDE.