How to make backend appservice accept the traffic only from the frontend appservice?

KT 190 Reputation points
2024-10-20T14:10:56.3633333+00:00

Hi all,

I'm trying to secure my backend App Service by:

  1. Blocking all public internet access
  2. Only allowing access from my frontend App Service

What I've tried:

  • Added IP restrictions in the backend App Service's networking settings
  • Whitelisted the frontend App Service's outbound IP addresses
  • However, I'm still getting 403 errors when the frontend tries to access the backend

Questions:

  1. What's the correct way to configure this setup?
  2. Do I need to use App Service Environment (ASE) for the frontend to properly communicate with the backend's private endpoint?
  3. If not using ASE, how can I make the frontend App Service successfully connect to the backend App Service through private endpoint?

Any guidance on the proper architecture and configuration would be much appreciated.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,968 questions
{count} votes

Accepted answer
  1. Shree Hima Bindu Maganti 4,925 Reputation points Microsoft External Staff Moderator
    2024-10-22T12:03:01.17+00:00

    Hi @KT,
    Thank you for your Response!

    Yes, configuring secure communication between frontend and backend App Services using private endpoints and VNets in Azure and it has been successfully implemented. When configured properly, it ensures secure access without exposing your services publicly.
    However, authentication between frontend and backend is a key part of this setup. Without proper authentication (such as Managed Identity or OAuth), even when network restrictions are correctly set up, the backend might still reject requests, leading to 403 errors.

    For reference, here's an official Microsoft document that can guide you through these steps:

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Deepanshu katara 16,720 Reputation points MVP Moderator
    2024-10-21T06:25:46.9666667+00:00

    Hello , Welcome to MS Q&A

    Answer to 1questions-->

    To secure your backend App Service by blocking public internet access and allowing access only from your frontend App Service, follow these steps:

    Restrict Incoming Source IP Addresses: Use network security groups (NSGs) to restrict incoming traffic to only allow access from the frontend App Service. Configure the NSG to permit traffic from the IP address of the frontend service.

    Access Restriction Rules: Configure access restriction rules based on service endpoints. This ensures that only requests originating from the frontend App Service are allowed to reach the backend.

    Private Endpoints: Consider using private endpoints for the backend App Service. This way, the backend can only be accessed from within the virtual network, effectively blocking public internet access.

    Application Gateway: If you're using an Application Gateway, set it up to route traffic to the backend App Service, ensuring that only traffic from the Application Gateway is allowed.

    By following these steps, you can effectively secure your backend App Service.

    References:

    **Answer to 2nd question-->**You do not necessarily need to use an App Service Environment (ASE) for the frontend to communicate with the backend's private endpoint. However, deploying your app in an ASE can simplify the process since the ASE is already integrated into your virtual network. This allows for secure connections to backend resources without additional configuration. If your backend resources are accessible within the same virtual network or through private endpoints, the apps in an ASE can connect to them directly.

    References:

    Answer to 3rd questions

    To connect a frontend App Service to a backend App Service through a private endpoint without using an App Service Environment (ASE), you can utilize Azure Private Link. Here are the steps you can follow:

    Create a Private Endpoint: Set up a private endpoint for your backend App Service. This will assign a private IP address from your virtual network to the App Service.

    Configure Networking: Ensure that your frontend App Service is in the same virtual network or has access to the virtual network where the private endpoint is created. This can be achieved through VNet integration.

    Disable Public Access: To enhance security, you can disable public network access to the backend App Service, ensuring that it can only be accessed through the private endpoint.

    Test Connectivity: After setting up the private endpoint and configuring the networking, test the connectivity from the frontend App Service to the backend App Service to ensure that the connection is established correctly.

    This approach allows you to securely connect your frontend and backend App Services without exposing them to the public internet.

    References:

    Please let us know if any further question

    Kindly accept answer if it helps

    Thanks

    Deepanshu


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.