Add custom domain with CNAME record having public endpoint

Muhammad Usman Naeem 0 Reputation points
2023-12-06T18:36:56.1+00:00

HELLO Everyone,

Need Assistance...

I have created a azure spring app under standard plan and also configured vnet injection. So that it will be part of my virtual network and can communicate with my database privately. Now I have created an app under my spring app and assigned a public endpoint so that my IOS app can access it publicly. I want to add a custom domain and it maps it with domain with CNAME record having private endpoint of app. Due to it I cant access the app publicly using custom domain as its routing to private endpoint. If I dont enable the vnet injection and add custom domain then Its map with CNAME record having public endpoint. I need help as I want to enable vnet injection and add custom domain to access it publicly.

Azure Spring Apps
Azure Spring Apps
An Azure platform as a service for running Spring Boot applications at cloud scale. Previously known as Azure Spring Cloud.
124 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,321 Reputation points
    2023-12-11T21:37:52.3533333+00:00

    Muhammad Usman Naeem Thanks for posting your question in Microsoft Q&A. When Azure Spring Apps service is deployed in VNET, applications are accessible only within the private network (via private endpoint). However, the apps can be exposed to Internet via

    1. Application Gateway with two options: Expose applications to the internet with TLS Termination at Application Gateway & Expose applications with end-to-end TLS in a virtual network.
    2. Standard public IP https://video2.skills-academy.com/en-us/azure/spring-apps/how-to-access-app-from-internet-virtual-network?tabs=azure-portal.

    Since you are looking to add a custom domain, I suggest you follow application gateway route and step-by-step guide is described in option 3: Implement an application gateway with a custom domain.

    Solution from doc:

    To begin the setup process, ensure that you have properly prepared your self-signed certificate by including the root, intermediate and client certificates in the certificate chain with the same hostname as your custom domain. You can refer to the following link for more details: https://video2.skills-academy.com/EN-US/azure/spring-apps/tutorial-custom-domain?tabs=Azure-portal#prepare...

    1. Merge the root certificate, middle certificate, and client certificate into a PFX file.
    2. Import the PFX file certificate into Azure Key Vault.
    3. Grant Azure Spring Apps access to your Key Vault.
    4. Import the certificate from Azure Key Vault to your Spring app.
    5. Add a custom domain to your Spring app.
    6. Go to your DNS provider and add a CNAME record to map your domain to <service-name>-<appname>.private.azuremicroservices.io. If this is a custom domain created for testing purposes, you can add the CNAME record in Azure Private DNS zone.
    7. Add an SSL binding to your Spring app.

    User's image

    After the operation is complete, you will be able to access your Spring app using a custom domain from the Virtual Network (VNet).

    Then the same configuration needs to be applied to the Application Gateway. It is important to note that if you are using a self-signed certificate in the backend settings of your Application Gateway, you will need to select "No" for "Use well-known CA certificate" and upload the root certificate(.cer) that was merged into the PFX file in the previous step, under "Trusted root certificate".

    User's image

    In the "Host name" section, make sure to select "Override with specific domain name" and ensure that the hostname matches the one specified in the SSL certificate.

    User's image

    In the "Listeners" settings, add a new listener on port 443 and select the existing certificate with the merged certificate.

    User's image

    For testing purposes, edit your Windows host file and add a record to map the custom domain with the Application Gateway's public IP address. Or if you owned this domain, you could add a A record on domain provider to point to Application Gateway's public IP to make it work.


    I hope this helps with your question and let me know if you have any other questions.

    If you found the answer to your question helpful, please take a moment to mark it as Yes for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.