Deploy a Web App from the CLI
Beginner10 minTrending
Create and deploy a web application to Azure App Service directly from the command line using az webapp.
Prerequisites
- -Azure CLI installed
- -Active Azure subscription
- -az login completed
Steps
1
Create a resource group
Resource groups act as logical containers for all related Azure resources.
$ az group create --name myapp-rg --location eastus
Pick a region closest to your users for lower latency.
2
Create an App Service plan
The plan defines the compute resources. B1 is a basic tier suitable for development.
$ az appservice plan create --name myapp-plan --resource-group myapp-rg --sku B1 --is-linux
3
Create the web app
Creates the App Service instance with the specified runtime stack.
$ az webapp create --name myapp-unique --resource-group myapp-rg --plan myapp-plan --runtime "NODE:20-lts"
The app name must be globally unique across all of Azure.
4
Deploy your code
Deploys a zip package of your application to the web app.
$ az webapp deploy --resource-group myapp-rg --name myapp-unique --src-path ./app.zip --type zip
5
Verify the deployment
Opens the deployed web app in your default browser.
$ az webapp browse --name myapp-unique --resource-group myapp-rg
Full Script
FAQ
Discussion
Loading comments...