My first deployment on Azure
Tags: beginners, azure, react, node
Published: 2022-01-04 14:11:44

To deploy your application on the Azure 
You should have a Microsoft Azure Account. You can get a free account for one month.
Refer below link to create Azure account:
[Azure Account](https://azure.microsoft.com/en-us/free/)

Azure offers a number of ways to host your application code. The term compute refers to the hosting model for the computing resources that your application runs on. 

If you want to deploy your application on the managed platform by selecting the runtime, An App Service is the right choice.

**Which service should you choose?**
 Azure Virtual Machine, which is considered as IaaS (Infrastructure as a Service) and the other one is Azure App Service, which is a PaaS (Platform as a Service). We will discuss which service is better for different use-cases, and what are the differences between these two services.

**<u>Azure Virtual Machine</u>**

![Infrastructure as a Service](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/333162as33qxcponxhwx.png)


**<u>Azure App Service</u>**
![Platform as a Service](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wl4kjn0zjc26cidsdhoa.png)

- Azure Virtual Machines is detailed as "It provides on-demand, high-scale, secure, virtualized infrastructure".
- Azure VMs are more expensive to run in comparison to Azure App Service.
- Developers describe Azure App Service as "Build, deploy, and scale web apps on a fully managed platform". Quickly build, deploy, and scale web apps created with popular frameworks 
- Azure App Service requires much less managerial efforts in comparison to Azure Virtual Machines.
- Azure App Services do not offer Pay-as-you-Go. Hence, you’re paying for the service plan, even if you’re not using it.
- Azure App Service have constraints in comparison to Azure VMs in terms of scalability. Hence, Azure VMs are preferred for apps, which have scope to expand for future.
- The development of app is much simpler and faster in Azure App Service.
- Azure VMs offer developer more control over the environment. Like, one can’t choose underlying OS of VM in an Azure App Service.
- There may be constraints for the support of certain programming languages on Azure App Service. In that case, one has to use Azure VM to create environment for the programming language.

Use below configuration for deployment:
**<u>For NodeJS Application:</u>**
Build provider: App Service Build Service
Runtime stack: Node
Version: Node 16 LTS
Operating System: Linux
Deployment: Bitbucket

Refer to the following link:
[Deploying Your NodeJS App on Azure](https://dev.to/bashirk/the-painless-way-to-deploying-your-nodejs-app-on-azure-part-1-14fi)

**<u>For React Application:</u>**
Build provider: App Service Build Service
Runtime stack: .NET
Version: ASP.NET V4.8
Operating System: Windows
Deployment: FTP deployment using FileZilla

Refer to the following video link:
[Deploy ReactJS application to Azure cloud using 3 different ways | FTP | Kudu | CI/CD DevOps](https://www.youtube.com/watch?v=3wF99gvBFcw)

**<u>Note</u>**:

- In App Service, application settings are variables passed as environment variables to the application code
![Configuration Settings](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2phokob022em8u0faj1e.png)

- .NET framework and IIS require a web.config file to identify application folder structure for navigation.  

```
<configuration>
<system.webServer>
<staticContent>
    <mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
    <rewrite>
      <rules>
        <rule name="Main Rule" stopProcessing="true">
                <match url=".*" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
                <action type="Rewrite" url="/" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
</configuration>

```

**<u>Conclusion</u>**
There is a lot to Azure. These are basic steps of the deploying React and NodeJS application on App services. Understanding of which service should you choose App Service or Virtual Machine for deployment?