How to add restirction that only Azure CDN can access the static website in storage accounts container. No direct access of static website blob URL

635 views Asked by At

I have created a blob container and made it a static website hosting, where inside the $web folder I have put all the build files of my react application. Please refer to the below image

enter image description here

And I have enabled the CDN for the storage account. Add the below rules

enter image description here

Azure CDN URL - https://ghcrablobcdn.azureedge.net

Static Website URL - https://ghcrablobcdn.z13.web.core.windows.net/

Now I want to make that only Azure CDN can access the static website URL, Direct access to the Static Website URL has to be prohibited or it shows 404, like that.

How can I add this restriction?

Do I have to add any network restrictions or like that?

your help or solution would be appreciated

1

There are 1 answers

0
Harshitha On

Thanks @gunnarpeipman for the clear steps.

Do I have to add any network restrictions or like that?

Yes, we need to configure few options in Storage Account =>Networking Section.

Select the Public network option as shown below and Add new virtual network

enter image description here

enter image description here

OR

As mentioned in the MSDoc, we can configure our storage account with SAS - Shared access signature to restrict the access.

enter image description here

Now configure the CDN to use the generated SAS token.

Navigate to the CDN => Endpoint => Origin

enter image description here