How to Host a Static Website on Azure Blob Storage Using Visual Studio Code

Hosting a static website on Azure Blob Storage is a straightforward and cost-effective solution for deploying your site. Using Visual Studio Code (VS Code) can streamline this process by allowing you to manage your website files and Azure resources dir…


This content originally appeared on DEV Community and was authored by Florence

Hosting a static website on Azure Blob Storage is a straightforward and cost-effective solution for deploying your site. Using Visual Studio Code (VS Code) can streamline this process by allowing you to manage your website files and Azure resources directly from your development environment. This guide will walk you through the steps required to host your static website on Azure Blob Storage using VS Code.

Before you start, ensure you have the following:

An Azure account: If you don't have one, you can create a free account.
Basic understanding of Azure Portal.

Install Visual Studio Code
Install Azure Storage extension for VS Code from the Extensions view in VS Code.

Step 1: Set Up Your Project in VS Code

Open VS Code: Launch Visual Studio Code on your computer.

Create or open your website project:
If you already have a project, open it by clicking on "File" > "Open Folder" and selecting your project folder.

Image description

Image description

Step 2: Create a Storage Account in Azure

Log in to Azure:
Follow the prompts to sign in to your Azure account.

Create a new storage account:
Click on Storage account

Image description

Click on Create

Image description

Select:
Subscription
Create new Resource group
Storage account name
Region
Performance
Redundancy

Click on Review and create

Image description

Deployment in progress

Image description

When Your deployment is complete, click on Go to resource

Image description

Step 3: Configure static website settings##:

Go to your storage account in the Azure Portal.
Under Settings select Click on Static website

Image description

Click on the Enabled button
Specify the index document name (e.g., index.html) and the error document path (e.g., 404.html).

Click "Save." This will generate a primary endpoint URL for your static website.

Image description

Image description

Click on Data storage select Container and click on $web

Image description

Click on Upload. Choose the files of your static website (HTML, CSS, JavaScript, images, etc.)

Image description

Uploads

Image description

Step 4: Go to VS Code

Right click then select Deploy to static website via Azure Storage

Image description

Sign into your Azure account

Image description

Deploying

Image description

My Static website

Image description

Another way without using Visual Studio Code is to copy the primary endpoint URL.

Image description

Paste the URL into your browser to view your hosted static website.

Conclusion
Hosting a static website on Azure Blob Storage using Visual Studio Code is an efficient and cost-effective way to deploy and manage your site. Integrating VS Code into your workflow allows you to seamlessly handle your website files and Azure resources from a single development environment. Azure Blob Storage provides high availability and scalability, making it an ideal choice for hosting static content.


This content originally appeared on DEV Community and was authored by Florence


Print Share Comment Cite Upload Translate Updates
APA

Florence | Sciencx (2024-07-07T01:26:41+00:00) How to Host a Static Website on Azure Blob Storage Using Visual Studio Code. Retrieved from https://www.scien.cx/2024/07/07/how-to-host-a-static-website-on-azure-blob-storage-using-visual-studio-code/

MLA
" » How to Host a Static Website on Azure Blob Storage Using Visual Studio Code." Florence | Sciencx - Sunday July 7, 2024, https://www.scien.cx/2024/07/07/how-to-host-a-static-website-on-azure-blob-storage-using-visual-studio-code/
HARVARD
Florence | Sciencx Sunday July 7, 2024 » How to Host a Static Website on Azure Blob Storage Using Visual Studio Code., viewed ,<https://www.scien.cx/2024/07/07/how-to-host-a-static-website-on-azure-blob-storage-using-visual-studio-code/>
VANCOUVER
Florence | Sciencx - » How to Host a Static Website on Azure Blob Storage Using Visual Studio Code. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/07/how-to-host-a-static-website-on-azure-blob-storage-using-visual-studio-code/
CHICAGO
" » How to Host a Static Website on Azure Blob Storage Using Visual Studio Code." Florence | Sciencx - Accessed . https://www.scien.cx/2024/07/07/how-to-host-a-static-website-on-azure-blob-storage-using-visual-studio-code/
IEEE
" » How to Host a Static Website on Azure Blob Storage Using Visual Studio Code." Florence | Sciencx [Online]. Available: https://www.scien.cx/2024/07/07/how-to-host-a-static-website-on-azure-blob-storage-using-visual-studio-code/. [Accessed: ]
rf:citation
» How to Host a Static Website on Azure Blob Storage Using Visual Studio Code | Florence | Sciencx | https://www.scien.cx/2024/07/07/how-to-host-a-static-website-on-azure-blob-storage-using-visual-studio-code/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.