Skip to content

Commit

Permalink
Include the docs from issue #67
Browse files Browse the repository at this point in the history
Big thanks to @fs366e2spm
  • Loading branch information
FBoucher committed Nov 13, 2020
1 parent ab81292 commit 4127467
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 2 deletions.
Binary file added medias/AddCustomDomain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added medias/AddCustomDomainDetails.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added medias/cf_DNS_Rules.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added medias/cf_addSite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added medias/cf_rules_details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added medias/cl_dns_details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added medias/domainProviderDNS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added medias/domainValidated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 85 additions & 2 deletions post-deployment-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,80 @@

## Add a Custom Domain

To know how to add a custom domain to your Azure Function. (coming soon)
(or check [Microsoft docs](https://docs.microsoft.com/en-ca/azure/app-service/app-service-web-tutorial-custom-domain?WT.mc_id=azurlshortener-github-frbouche))
Of course the beauty of a URL shortener is to have short link and this is done the best by a naked domain (domain.com). To realized this you would need to by an expensive certificate with a wild card, and this doesn't fit in the goals of this project. We will achieve it nervertheless by having a secure www.domain.com and doing a dynamic forward of domain.com to www.domain.com.

### 1- Assign a Domain to the Azure Function

Let`s start by Adding a domain to the App Service.

![AddCustomDomain][AddCustomDomain]

From the Azure portal (portal.azure.com), open the ShortnerTools App Service (Azure Function). From the left panel select *Custom domains*. Then Click the **Add custom domain** button in the middle of the screen.

![AddCustomDomainDetails][AddCustomDomainDetails]

This will open a tab where you will need to enter your domain with the `www` sub-domain. In our case it was www.07f.ca.

You will now need to validate the domain with you proviver (in our case it's GoDaddy.com). Navigate to the domain provider and create two new DNS record (TXT + CNAME) like explained in the bottom of the panel in the Azure portal.

Here an exemple from godaddy where:
- The CNAME was created with the URL of the Azure function.
- The TXT was created with the Custom Domain Verification ID provided on the Azure portal page.

![domainProviderDNS][domainProviderDNS]

Once all that is enter. Click the validate button on the Azure portal. If you don't have the green check beside Hostname availability and Domain ownership, be patient as it can take up to 48 hours. (You can always double check that you didn't do any typo any where ;P )

![domainValidated][domainValidated]

When you have it gree you ready for the next step.

### 2- Adding a certificate

The custom domain has been added, we now first need to create a certificate before we can add the binding

![4_AddBinding](https://user-images.githubusercontent.com/52791126/83807076-c81db100-a6b2-11ea-8cc4-1facc50d6dd4.png)

Create a **free** App Service managed certificate as described in the documentation [Secure a custom DNS name with a TLS/SSL binding in Azure App Service](https://docs.microsoft.com/en-us/azure/app-service/configure-ssl-bindings?WT.mc_id=azurlshortener-github-frbouche)


From the left navigation of your Azure Function (same page as before), select **TLS/SSL settings**. Then from the top of the new panel, click on **Private Key Certificates (.pfx)** and then **Create App Service Managed Certificate**.

![Create free certificate in App Service](https://docs.microsoft.com/en-us/azure/app-service/media/configure-ssl-certificate/create-free-cert.png)

Select the custom domain to create a free certificate for and select Create. You can create only one certificate for each supported custom domain.

When the operation completes, you see the certificate in the Private Key Certificates list.

![Create free certificate finished](https://docs.microsoft.com/en-us/azure/app-service/media/configure-ssl-certificate/create-free-cert-finished.png)

Go back to the **Custom domain** panel. Click the **Add binding** link beside the big red "Not Secure" label.

Select your custom domain, the created certificate thumbprint which has been created in step 5 and "SNI SSL" as the SSL Binding

![7_create_certificate_binding](https://user-images.githubusercontent.com/52791126/83808893-d5886a80-a6b5-11ea-9cf0-c3268b57d250.png)

Voila! You can now call your azURLShortener from your custom domain! ✔

> If you are using Version 1, you need to change the URL in the App Service configuration (it's in the admin "App Service") so you can copy the URLs from the Blazor UI
![8_change_azFunctionUrl](https://user-images.githubusercontent.com/52791126/83810560-9c9dc500-a6b8-11ea-9c1c-da2d99f2a79f.png)



### 3- Remove the www sub-domain

Create a account in CloudFlare and add a site


![cf_addSite][cf_addSite]

![cf_DNS_Rules][cf_DNS_Rules]

![cl_dns_details][cl_dns_details]

![cf_rules_details][cf_rules_details]



---
Expand Down Expand Up @@ -39,3 +111,14 @@ And finally, click the **Copy** button to get the URL of your function _with the
[getURL]: medias/getURL.png
[AddCustomDomain]: medias/AddCustomDomain.png
[AddCustomDomainDetails]: medias/AddCustomDomainDetails.png
[domainProviderDNS]: medias/domainProviderDNS.png
[domainValidated]: medias/domainValidated.png
[cf_addSite]: medias/cf_addSite.png
[cf_DNS_Rules]: medias/cf_DNS_Rules.png
[cl_dns_details]: medias/cl_dns_details.png
[cf_rules_details]: medias/cf_rules_details.png

0 comments on commit 4127467

Please sign in to comment.