React Azure Deployment
Tags: react
Published: 2021-02-09 22:15:03

A continuation of the series...

Let's push our React application to a website. To a windows server running ASP.NET Core 3.1.

Note: Doing this the first time will take about 1 hour, subsequent deploys will take about 20 seconds, because everything is ready to go. 

Azure is free up to $150 USD per month in charges. For a simple website, this means you will never have to pay to host it on Azure. 

> Disclaimer: This is not an ad for Azure. It's just a way to host your content on a website for free.

- Sign up for [Azure](https://signup.azure.com/signup?offer=ms-azr-0044p&appId=102&ref=azureplat-generic&redirectURL=https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fget-started%2Fwelcome-to-azure%2F&l=en-us&correlationId=2B57D354468B619C1E0BDCF347FF60A8) 

- You will have to enter a credit card number. Don't worry you won't be charged until you exceed $150/per month in charges. A small web site won't get near that amount.

- Once you are set up; sign into:
[https://portal.azure.com/](https://portal.azure.com/#home)

- Next click on App Service <sub>( Azure speak for website)</sub> shown below.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0effxzbw2wtwekr5axvu.jpg)

- Then click on the "+Create" button, you may need to click twice.

You should see this:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/17bmqbs44ydzbv7eqjdh.jpg)

- Click on create new and make the prefix RG for Resource Group.  

```
RGReact
```

Then fill in the remaining fields like this:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ktbvvz8o9leyvqmmqxsm.jpg)

**Create the web site**

- On the bottom there is a button "Review + Create", click it.

- Then confirm the site creation by clicking the "Create" button on bottom left once more.

You should see this:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9m9e8ld6pavs4f5d6iyc.jpg)

NOTE: Our first attempt failed. So we just created another one using the same steps above but changed the web site name. 

When the site creates you can "Browse" to it to see it. It should look like this:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0pt2dlwqougsmpfzxx6m.jpg)

 
- If you can't bring your website up, go back and try until you can see the image above.

**Deployment**

- In your VSC (Visual Studio Code) open your react application folder. Then run this command:

```
npm run build
```
Then in VSC go to file/openfolder and switch to the build folder just created. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wzsuepg3up74j9f1i4zz.jpg)

- Note you must install Azure tools next, if you don't have them follow this:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ypebkzay44pjxi6s7vuy.jpg)

Once they are installed click on the triangle highlighted in image below:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/671cwkso252mf1vdch31.jpg)

Then on the blue upload button.

You'll then be asked which folder to deploy which is this "Build" folder, and then to which Web Site, if you have more than one. 

Once the deploy is finished your website is up and running! 

Congratulations on creating your first React Web Site.

JWP2021 Create React Website.