DEV Community

Henry
Henry

Posted on

How to host a Static Website on Azure App Service( Using Azure CLI)

*Step 1. Open Power shell on your computer *

Image description
Image description
*Step 2. Download Azure CLI for either “windows” or “Mac”
Go on Google, search for “Download Azure CLI” for your computer version and install it *

Image description
*Step 3; After Installation, open “Power shell” and login into Azure portal by entering the command below
“az login” , then “check your default browser, a window is meant to be open for you to login to azure portal. *

Image description
Image description
Image description

*Step 4: After Login, the above pictures shows, then proceed back to power shell to confirm you are logged in *

Image description

Step 5: Create a resource group or use an existing resource group which you have already created
To create a resource group on power shell, enter the command below ** **_“az group create –name “Resourcegroup” –location “eastus” _

Image description
**
Step 6: Create a Web service plan, by entering the code **
_“az appservice plan create –name WebPlan –resource-group “Resourcegroup” _
Image description
Image description
Step 7: Create a Web Application to run **
**“az webapp create –name “MyWebApp” – resource-group “Resourcegroup” –plan “WebPlan” “

Image description
*Step 8: Check Azure portal, click on App service on the home page, check the empty website if its running *

Image description
Step 9: Check if the empty web app is running , click on “Default domain” or copy the link and paste in a browser
Image description
Image description
Then back in webapp service in the azure portal, search for “advance tools” and click “Go”
To access the back end of the hosting service.
Then Click “Debug console” and select “CMD

Image description
Image description
*Then navigate to raw file page *

Image description

Image description

Image description

Image description

*Then edit the above raw code, by inserting the raw code of the website you want to host from an IDE into this page.
And save
Step 10 : Then go back to the empty web page and refresh Congratulations, you have hosted a web page on AZURE PORTAL *

Image description

Image description

Top comments (2)

Collapse
 
duncan_true profile image
Dun

Great step-by-step guide! Do you have any tips for troubleshooting common issues that might arise during this process?

Collapse
 
busybrain profile image
Henry

Thank you @duncan_true ,
There are 2 sections where issues could arise

  1. Issues on power shell, maybe the syntax entered is not correct or while trying to login to Azure portal from power shell , you encounter some network issues, to solve them, is just like looking for syntax errors or sometimes read through the "error" messages written in red
  2. On Azure portal , there could be issues, maybe assigning resource groups or app services, if validation are not successful, you might need to reopen a new app plan or web app service

But for me major problems will be on power shell such as syntax errors

I hope its helpful