Jakub97
Jakub97

Reputation: 59

Cant access deployed HTML/js files in Azure Web App

im very new to Azure so apologise if this is a stupid question.

Can I manually deploy a html and vanilla js project to Azure Web App? (Not Azure Static Web App)?

I have built my files and deployed to a Web App (App Service) that I created via VS Code Azure App Service plugin. On inspection of the directory via the SSH option in my Web App, I can see that all my files have been deployed to /home/site/wwwroot/ which is what I would expect. However when accessing my app URL I get presented with the default "Your web app is running and waiting for your content" page... I also cant access my html files via /index.html as I get "Cannot GET /index.html".

My web app is set up for code deployment with a Node.js runtime, can I not deploy static html files to this app?

Mor info:

I am deploying the following folder:

Folder build:

The build folder contains an "app" folder which has all of the built js and css code. The build folder also has multiple .html files...

I am building the app before deploying it via the VS Code Azure App service extension...

My Azure App service (Web App) Publishing model is set to "Code". When I deploy the build folder to the Web App via VS code I can see that the files have been deployed correctly as they are present in "/home/site/wwwroot" when I SSH into the Web App. However, when I access the web app url the index.html page is not shown

Upvotes: 0

Views: 596

Answers (1)

Harshitha
Harshitha

Reputation: 7392

Deploying Node JS App to Azure App Service from VSCode/Visual Studio needs npm packages to be installed.

  • You need package.json,server.js files to run a Node JS App.

  • I have also tried to deploy using Azure CLI.

  • Create an Azure App Service with Runtime Stack Node. enter image description here

  • Create static files which you want(html/css).

  • Locally, open Azure CLI. Navigate to the WebApp Root directory and run az login.

enter image description here

  • I have referred this MSDoc to run Azure CLI Commands.

Linux:

az webapp up --resource-group MyRG --name StaticAppMay --plan AppservicePlanName --runtime "node|20-lts" 
  • App is deployed successfully but even I am getting the default content page with Linux.

  • Only App Service with windows is working here.

Windows:

>az webapp up --resource-group v-harshithav-Mindtree --name StaticAppMay --plan plan-cinsider-test-eastus --html

enter image description here

Output: enter image description here

One option to server static files is to use Storage Account Static website.

  • Upload static files to Storage Account => Containers => $web.

enter image description here

  • Enable Static Website and access the Endpoint.

enter image description here

  • But as per your requirement(to generate OAuth) token in Azure App Service Authentication, recommended to follow this MSDoc to create Node JS Linux App Service.

Upvotes: 0

Related Questions