How to host a Static Website on Azure App Service( Using Azure CLI)
Published: 2024-05-19 18:30:34

**Step 1. Open Power shell on your computer **

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ss5hfiu58ihm4pnk14qn.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xtwjnrj49ensx9dxlq1s.png)
**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tf7cet1f7e4uitfhlh9h.png)
**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jsqwqjct9p1d9knb6wmo.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e6tay6qovuc7u0znl1mq.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qmmx0w4luvqszq9tqsfa.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/07spiukxlz2vggvg9jnp.png)

**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7z43qqt4tm4314fqg2l.png)
**
Step 6: Create a Web service plan, by entering the code **
**_“az appservice plan create –name WebPlan –resource-group “Resourcegroup” _**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iknttedzir8bn8zlb2r4.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q4o61yyv8y01yun7a5ei.png)
**Step 7: Create a Web Application to run **
**_“az webapp create –name “MyWebApp” – resource-group “Resourcegroup” –plan “WebPlan” “_**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/avigsuzrm1a85ik1d06n.png)
**Step 8: Check Azure portal, click on App service on the home page, check the empty website if its running **

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l11km8sfmqzw5hdemsyy.png)
**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gi9bdyw4k82wmzb3i4of.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5binmg01kq9ocpi3dyu7.png)
**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wo0ctxnys44un69kseo3.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hbha1hxr52q5a2d4od6n.png)
**Then navigate to raw file page **

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2rldi0zd43ie98qy2ndu.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dfzc2yrrtlhl4ottrqsa.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3i9lhit2eu7pt6mv4j73.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nn7g3ithtbrjyl1w1xez.png)

**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ttu2rvkp969xwtd3lfu.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g0p52xgcuzcdb8xji1nu.png)