You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Deploying your apps to Azure hosting services means moving a file or set of files to Azure to be served via an HTTP endpoint.
4
-
ms.topic: how-to
5
-
ms.date: 08/31/2022
2
+
title: Deploy JavaScript apps on Azure
3
+
description: Deploying your JavaScript applications to Azure allows you to use the power of cloud computing, ensuring scalability, reliability, and global reach. This guide walks you through various methods to deploy your JavaScript apps to Azure, from manual deployments to automated CI/CD pipelines.
#customer intent: As a JavaScript developer new to Azure, I want know all the ways to deploy code to Azure so that I can choose the best process for my application and situation.
7
8
---
8
9
9
-
# Deployment choices for your web app to Azure
10
+
# Deployment JavaScript app to Azure overview
10
11
11
-
Deploying your apps to Azure hosting services means moving a file or set of files to Azure to be served via an HTTP endpoint.
12
+
To deploy your JavaScript-based app to Azure, you move a file or set of files to Azure to be served via an HTTP endpoint. The process of moving the files is called deployment.
12
13
13
-
Common methods of moving files to the Azure cloud include:
14
+
## Prerequisites
15
+
16
+
* Azure subscription - [create one for free](https://azure.microsoft.com/free/ai-services?azure-portal=true).
17
+
*[Node.js LTS](https://nodejs.org/).
18
+
* A GitHub account if you plan to deploy from a GitHub repository.
19
+
20
+
## Deployment methods
21
+
22
+
Azure offers various deployment methods to suit different needs. Here are some common methods:
14
23
15
24
| Method | Details |
16
25
|--|--|
17
-
|[GitHub Actions](/azure/app-service/deploy-github-actions?tabs=applevel)|Use this for automated or triggered continuous deployments.|
18
-
|[Visual Studio Code Extensions](https://marketplace.visualstudio.com/search?term=azure&target=VSCode&category=All%20categories&sortBy=Relevance)|Use this for manual, testing, or seldom deployments. Requires that you have the extension for the service installed locally.|
19
-
|[Azure CLI](/azure/app-service/tutorial-nodejs-mongodb-app?tabs=azure-portal%2Cterminal-bash%2Cvscode-deploy%2Cdeploy-instructions-azportal%2Cdeploy-zip-linux-mac%2Cdeploy-instructions--zip-azcli)|Use this for manual or seldom deployments. Requires that you have the extension for the service installed locally.|
26
+
|[Azure Developer CLI](/azure/developer/azure-developer-cli)|Ideal for developers who prefer command-line tools and need to automate the provisioning and deployment of resources.|
27
+
|[Visual Studio Code Extensions](https://marketplace.visualstudio.com/search?term=azure&target=VSCode&category=All%20categories&sortBy=Relevance)|Suitable for manual, testing, or infrequent deployments. Requires the relevant Azure extensions installed locally.|
28
+
|[Azure CLI](/azure/app-service/tutorial-nodejs-mongodb-app?tabs=azure-portal%2Cterminal-bash%2Cvscode-deploy%2Cdeploy-instructions-azportal%2Cdeploy-zip-linux-mac%2Cdeploy-instructions--zip-azcli)|Useful for manual or occasional deployments. Requires the Azure CLI installed locally.|
29
+
|[GitHub Actions](/azure/app-service/deploy-github-actions?tabs=applevel)|Best for automated or continuous deployments triggered by changes in your GitHub repository.|
20
30
21
-
Other deployment methods may exist, based on the specific service. For example, Azure app service supports a wide variety of deployment methods:
31
+
Other deployment methods exist, based on the specific service. For example, Azure app service supports a wide variety of deployment methods:
22
32
*[From ZIP file](/azure/app-service/deploy-zip)
23
33
*[With FTP](/azure/app-service/deploy-ftp)
24
34
*[Dropbox or OneDrive](/azure/app-service/deploy-content-sync)
You can redeploy to your App service using any of the provided methods even if you didn't use that method to originally deploy. You may have some configuration before redeploying if you are switching methods.
39
+
You can redeploy to your App service using any of the provided methods even if you didn't use that method to originally deploy. You may have some configuration before redeploying if you're switching methods.
Depending on your application's complexity and deployment needs, you can choose to build your JavaScript app either before or during deployment:
46
+
47
+
***Build before deployment**: For complex or lengthy builds, package your application into a zip file and deploy it. A deployment package allows you to control and test the build before deployment.
48
+
***Build during deployment**: For simpler builds, use the Azure-provided environment variable SCM_DO_BUILD_DURING_DEPLOYMENT=true to build your app during deployment.
49
+
33
50
## Deployment slots
34
51
35
-
Use [deployment slots](/azure/app-service/deploy-staging-slots) to deploy your source code to a staging environment and warm up the environment before deploying to your production slot.
52
+
[Deployment slots](/azure/app-service/deploy-staging-slots) in Azure App Service allow you to create separate environments for staging and production. The use of slots enables you to test your app in a staging environment before swapping it with the production slot, ensuring a smooth and error-free deployment. Learn more about deployment slots.
53
+
54
+
Don't use deployment slots to mix deployment purposes. All deployment slots share the app service so you need to make sure the traffic patterns and intended use of all slots are the same. If you need to have a hosted test or stage environment that should be a separate app service.
55
+
56
+
## Deploy with Azure Developer CLI
57
+
58
+
The Azure Developer CLI (azd) simplifies the process of deploying your app to Azure. Follow these steps:
59
+
60
+
1.[Install](/azure/developer/azure-developer-cli/install-azd) the Azure Developer CLI.
61
+
1.[Find an existing project](https://azure.github.io/awesome-azd/) which uses many of the same resources your project uses.
62
+
1. Initialize a local version of the project for use as an infrastructure template for your own project.
63
+
64
+
```bash
65
+
azd init --template <template-name>
66
+
```
67
+
68
+
1. Create the resources and deploy the code to Azure.
36
69
37
-
Do not use deployment slots to mix deployment purposes. All deployment slots share the app service so you need to make sure the traffic patterns and intended use of all slots are the same. If you need to have a hosted test or stage environment, that should be a separate app service.
70
+
```bash
71
+
azd up
72
+
```
38
73
39
74
## Deploy with Visual Studio Code
40
75
@@ -43,9 +78,9 @@ To deploy or redeploy your App service app with Visual Studio Code, complete the
43
78
1. Install the related Azure extensions, for example [AzureApp Service](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice) or [Azure Functions](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions).
44
79
1. Open the Azure explorer. Select the Azure icon in the primary side bar or use the keyboard shortcut (<kbd>Shift</kbd> + <kbd>Alt</kbd> + <kbd>A</kbd>).
45
80
1. In the Resources group, selectyour subscription and service.
46
-
1. Right-click your service then select **Deploy to Web App...**.
81
+
1. Right-click your service thenselect**Deploy to Web App...**.
47
82
48
-
:::image type="content" source="../media/azure-app-service-vscode-extensions/deploy-or-redeploy-app-service.png" alt-text="Deploy or redeploy to App service with Visual Studio Code":::
83
+
:::image type="content" source="../media/azure-app-service-vscode-extensions/deploy-or-redeploy-app-service.png" alt-text="Deploy or redeploy to App service with Visual Studio Code":::
49
84
50
85
## Connect to your Azure hosted environment
51
86
@@ -54,7 +89,7 @@ To deploy or redeploy your App service app with Visual Studio Code, complete the
54
89
55
90
## View files in Azure hosted environment
56
91
57
-
There are several ways to immediately see the files in your hosted Azure Web app or Function app. If you are using slots in your hosted resource, you need to make sure you are on the correct slot before viewing files.
92
+
There are several ways to immediately see the files in your hosted Azure Web app or Function app. If you're using slots in your hosted resource, you need to make sure you are on the correct slot before viewing files.
58
93
59
94
* View files in [Azure portal](https://portal.azure.com) - select **Console** under Development tools for your hosting resource.
60
95
@@ -72,6 +107,7 @@ View your HTTP endpoint from the service's Overview page on the Azure portal.
72
107
73
108
:::image type="content" source="../media/howto-deploy/azure-portal-hosting-url.png" alt-text="View your HTTP endpoint from the service's Overview page on the Azure portal.":::
74
109
75
-
## Next steps
110
+
## Related content
76
111
77
112
* [Deployment tutorials using Visual Studio Code](https://code.visualstudio.com/docs/azure/deployment)
113
+
* [Hosting apps on Azure](/azure/developer/intro/hosting-apps-on-azure)
0 commit comments