I have created an Angular 18 project in IntelliJ and now want to deploy it to an Azure App Service/Web App. I have therefore created a web app in the Azure portal with a Node20 runtime. Now I have installed the Azure Web Service Plugin for IntelliJ and logged in. When I select the project I just created, it only lets me deploy Java artifacts (Invalid Data: Invalid target, please select a web app with Java runtime). What am I doing wrong here? The whole thing looks much simpler on the many YouTube videos. They only ever build the project and select the folder in the dist directory and the rest happens automatically.
5
@esqew thank you for your comments
Deploying an Angular app to Azure App Service through IntelliJ is not possible because when I select the Angular project in the Artifact, it takes the Angular files with the Java runtime version.
So, it’s not possible to deploy angular app to azure through IntelliJ Idea. Instead, I deployed the angular app to azure through GitHub.
- I Push the Angular files to GitHub repository.
- I Selected
GitHub
as Source in theDeployment
section of the Azure Web app.
- I Sign in to GitHub and I fill the Required Details as shown below.
- I used
Authentication type
toBasic authentication
, but you can useUser assigned identity
.
- For
Basic authentication
I enabled theSCM Basic Auth Publishing
.
Below is my GitHub Workflow File:
name: Build and deploy Node.js app to Azure Web App - kaangularapp6
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: npm install, build
run: |
npm install
npm run build
- name: Zip artifact for deployment
run: zip release.zip ./* -r
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: node-app
path: release.zip
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: node-app
- name: Unzip artifact for deployment
run: unzip release.zip
- name: 'Deploy to Azure Web App'
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'kaangularapp6'
slot-name: 'Production'
package: .
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_<key> }}
It is Successfully Deployed to Azure App Service.
I added the below command to the Startup Command in the Configuration section of Azure Web App.
pm2 serve /home/site/wwwroot/dist/<WebAppName>/browser --no-daemon --spa
Azure App Service Output: