Hello @Lilly, Michael !
Welcome to Microsoft QnA!
Usually Azure Storage provides Web Static Hosting on Public storage
https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website
If you want to render a static website stored in a private Azure Blob container using a SAS (Shared Access Signature) URL, you can try this :
First of al allow Anonymous Access , otherwise it would never work
Set Up Your Blob Container:
- Make sure you've set up a blob container in Azure Blob Storage and that it's configured for private access so that the blobs can't be accessed without appropriate authorization.
Upload Your Static Website:
- Upload the content of your static website (e.g.,
index.html
,styles.css
,script.js
, etc.) to the blob container.
- Generate a SAS URL:
Use Azure Portal, Azure CLI, or one of the Azure SDKs to generate a SAS URL for your blob container.
- Azure CLI Example:
-
az storage blob generate-sas --account-name <YourStorageAccountName> --container-name <YourContainerName> --name <BlobName> --permissions r --expiry <ExpiryDateTime> --type object
- Accessing the Static Website Using SAS URL:
Construct the URL for accessing the static website:
-
https://<YourStorageAccountName>.blob.core.windows.net/<YourContainerName>/<BlobName>?<GeneratedSAS>
- Replace
<YourStorageAccountName>
,<YourContainerName>
,<BlobName>
, and<GeneratedSAS>
with appropriate values.- For the root of your website, `<BlobName>` will likely be `index.html` or similar.
- Replace
ALSO : Any internal references for example from index.html to style.css must be with relevant SAS for each file ! It wont work otherwise!
Here is my Index.html referencing style.css
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
<link rel="stylesheet" href="https://srtgggsq.blob.core.windows.net/web/style.css?sp=r&st=2023-09-02T10:56:41Z&se=2023-09-02T18:56:41Z&spr=https&sv=2022-11-02&sr=b&sig=qKxGF8iRYpesdmV5e4tvuOwkAJ4DG2nSvB4MVcz6rUI%3D"/>
</head>
<body>
<div class="container">
I have tried this and it have worked so please send us your input
I hope this helps!
Kindly mark the answer as Accepted and Upvote in case it helped!
Regards