How can I restrict my Custom Domain Azure Static Web App to only be accessible internally and not publicly accessible?

EnterpriseArchitect 6,391 Reputation points
2023-10-06T05:04:06.7466667+00:00

I created the Azure static website and wanted to publish this only to my internal office users across multiple locations.

Each office is connected via ExpressRoute circuit to Azure, so how do I restrict this Static Web app so that it can only be accessed using the Custom domain name I have like: CustomApp1.domain.com ?

Azure Private Link
Azure Private Link

An Azure service that provides private connectivity from a virtual network to Azure platform as a service, customer-owned, or Microsoft partner services.

Azure Static Web Apps
Azure Static Web Apps

An Azure service that provides streamlined full-stack web app development.

0 comments No comments

Answer accepted by question author
KapilAnanth 49,876 Reputation points Moderator
2023-10-06T05:44:47.01+00:00

@EnterpriseArchitect

Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

I understand that you are working with Azure Static Web App and not Static website hosting in Azure Storage

Please let me know if my understanding is incorrect.

I believe you should use a Private EndPoint to make the site only accessible via Private (internal) network.

Your exact requirement is documented here : Configure private endpoint in Azure Static Web Apps

NOTE:

  • If your app has a private endpoint enabled, the server responds with a 403 status code if the request comes from a public IP address.
  • This behavior applies to both the production environment as well as any staging environments.
  • The only way to reach the app is to use the private endpoint deployed within your VNet

Also, you must take care of the DNS Resolution part so that "CustomApp1.domain.com" resolves to a private IP and not a Public IP within your private network.

You can follow this architecture for DNS : Virtual network and on-premises workloads using a DNS forwarder

Please let us know if we can be of any further assistance here.

Thanks,

Kapil


Please Accept an answer if correct.

Original posters help the community find answers faster by identifying the correct answer.

Was this answer helpful?

2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. TP 162.1K Reputation points Volunteer Moderator
    2023-10-06T05:41:09.1533333+00:00

    Hi,

    You could create Private Endpoint and this will cause connections coming from public IPs to be denied. Only connections coming through the private endpoint will be allowed. The site will no longer be available via multiple worldwide points of presence.

    Configure private endpoint in Azure Static Web Apps

    https://learn.microsoft.com/en-us/azure/static-web-apps/private-endpoint

    Please click Accept Answer if above was useful.

    Thanks.

    -TP

    Was this answer helpful?


Your answer

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