I am just getting to grips with deploying my asp.net application via release pipeline in Azure Devops.
Previously, I have been deploying my web app directly from Visual Studio using publish which works fine.
But when i have set this up in a Release pipline in Azure dev ops it doesnt work, when i try and load the page i just get:
'You do not have permission to view this directory or page'
and looking at the deployed files via Server Explorer I can see the files are in a 'Drop' folder
But when looking at the deployed files when deployed directly from VS it looks like:
I know this must be down to how I have configured either my build or release pipeline but i cannot see where.
Release pipeline
I see here that i set the path to the Drop folder, but i added that as without it it was failing....i think
Related
I am new to Azure DevOps. I am trying to perform small home lab projects. One of them is to deploy a "Greetings from Spring Boot!" web app in Azure Web App service with Azure DevOps pipelines, build and release.
I got the source code (Spring boot web app) from a YouTube tutorial and performed the tasks in the tutorial but using GitHub actions (Azure Portal/Home/Resources/select my App Service/Deployment Center/Settings/ configure as source a GitHub repository where my code is). This way was fine. The web page https://my-app-name-just-example.azurewebsites.net/ is showing the message in my source code, "Greetings from Spring Boot!".
But when I try to use Azure DevOps build and release pipelines on the same Azure Web App resource, accessing the URL shows the default web page "Hey, Java developers!". Both build and release pipelines show successfully completed.
https://imgur.com/a/thiMfBQ
From the Azure DevOps build release I downloaded the jar file (demo-0.0.1-SNAPSHOT) and ran it locally on my PC (java -jar \path\demo-0.0.1-SNAPSHOT) and http://localhost:8080/ displays the message in my source code. This means the build pipeline was correct. When I configure and run the release pipeline using as source the build from the build pipeline, the release pipeline shows successfully completed but the web app URL still shows the the default web page "Hey, Java developers!".
I checked https://my-app-name-just-example.scm.azurewebsites.net/wwwroot/ and the demo-0.0.1-SNAPSHOT.jar is there. I stopped and started the Azure Web App too.
Any suggestions? Thank you.
#Jason Pan, Thank you very much for the solution.
I used as a solution the startup command in a new Release pipeline configuration. In my case: "java -jar /home/site/wwwroot/demo-0.0.1-SNAPSHOT.jar --server.port=80". I noticed the name of the artifact in my case from the Build pipeline is artifactId+version from the pom.xml file, so demo-0.0.1-SNAPSHOT.jar .
Then I edited my release pipeline with this startup command, saved it, deploy it and I could see the in the Release pipeline /Initialize job logs the message "[PARAMETERS_STARTUPCOMMAND] --> [java -jar /home/site/wwwroot/demo-0.0.1-SNAPSHOT.jar --server.port=80]" . Deployment was successful. And now Web App URL shows the content of the source code, "Greetings from Spring Boot!". Previously it was showing the default content, the "Hey, Java developers!".
Thank you again.
You can add startup command on portal.
Like :
java -jar /home/site/wwwroot/app.jar --server.port=80
For more details, you can reader offical doc and related post.
1. Built-in images
2. Unable to start spring boot application deployed as a jar
3. Deploy a Spring Boot Gradle application to Azure App Service from an Azure Pipeline
I have an Azure DevOps release pipeline, deploying my code using Web Deploy to Azure Web app to different environments (Dev/ SIT/ UAT/ PROD). Now, I need to include a task to copy/ rename one Configuration file (environment specific), which is inside 'Config' folder, to another file inside the same folder. Please note, the config file is not under the root folder of the web app.
Is there a way to accomplish this using 'post deployment action' or command line script task? I couldn't understand how can I refer the source folder of the web app for the copy operation. I was referring the following page but couldn't find one that will help me to achieve the task. Any help is appreciated.
https://learn.microsoft.com/en-us/azure/devops/pipelines/release/variables?view=azure-devops&tabs=batch
The Post deploy action script is running on azure (through Kudu API): Command
So, if the file is existing on the azure web app, you could copy it through Post deploy action script, for example, Site.css is in wwwroot\Content folder after deploying, then the script could be like this:
Copy Content\site.css Content\site1.css /a
Otherwise, you could store the necessary data in App settings or Configurations of Azure Web app.
We have an Angular 7 application on one git repository and an ASP.NET Core 2.2 Web API on another git repository. We use Azure pipelines to deploy both repos into an Azure App Service.
I have successfully been able to configure the Web API to deploy to the root directory and the Angular client into a wwwrooot sub directory.
However, in order to achieve this I need to configure the wwwroot sub-directory as an application, which makes the application fail with HTTP 404. Once I change the settings to be "Directory" in the Azure app service, everything works as normal.
Is there a way to have the Angular pipeline deploy to the sub-directory while configured as Directory instead of Application?
Thank you,
I solved my issue from within the pipelines. Following this post (VSTS build with multiple repos) I added the FE artifacts to the pipeline and simply copy it's dist contents to the wwwroot folder of the API build folder. Then I simply deploy everything to App Services and now both the API and Angular App are deployed on the same server and working.
Hope this helps someone.
I am facing a weird problem. I deployed my code using Azure DevOps Pipeline Release - it ran successfully, however, the code is not reflecting in Azure Function App.
Here is what I am doing:
Created a Release pipeline with a "Deploy Azure App Service" task. It picks up artifacts from a build pipeline and is configured to deploy to a Function App using Service Connection
When the Release pipeline is triggered it runs through all its steps, and I get a success (see logs below)
However, when I open up Azure portal and navigate to the Function App, it continues to say "Now it is time to add your code" on the Overview tab, and I am not able to hit my API on that Function App
Surprisingly, On the Deployment Center tab of the Function App, it does show the details of the deployment (See details below)
I can also find the deployed zip file under D:\home\site\wwwroot when I log on to the Kudu console
Deployment logs:
Got service connection details for Azure App Service:'myFuncApp'
Updating App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"}
Updated App Service Application settings and Kudu Application settings.
Package deployment using ZIP Deploy initiated.
Successfully deployed web package to App Service.
App Service Application URL: http://myFuncApp.azurewebsites.net
View on Function App Deployment Center Tab:
Deployed Successfully to production
Source Version 6d9c8340ba Build 20190411.1 Release: 3
The Function App endpoint is working, (throwing a generic welcome page) confirming the Function App itself is healthy, but I am not able to access my API.
Additional updates
Here is the structure of the .zip file that is being uploaded to d:\home\data\SitePackages as a part of the zip deploy from Azure Pipelines:
/host.json
/package.json
/proxies.json
/package-lock.json
/func_name/index.js
/func_name/function.json
/node_modules/**
The same code is working locally.
Note: When I go to the Deployment Center tab, I do see this error message, but I think this is related to Continuous deployment through Function App
We were unable to connect to the Azure Pipeline that is connected to this Web App. This could mean it has been removed from the Azure Dev Ops Portal. If this has happened, you can disconnect this pipeline and set up a new deployment pipeline.
Please help me. What can be going wrong?
I was finally able to troubleshoot. #4c74356b41 pointed me in the right direction as the key issue was the package.
Below was the issue:
I had added an archive step in the build pipeline. This was causing the artifact to be zipped before publish
In the release pipeline I was using Azure App Service Deploy task. This internally uses Zip Deploy where App type is set to Azure Functions. Thus, it was zipping my zipped file.
When I remove the archive step, the double zipping was avoided, and it started working.
I'm trying to deploy an Azure WebJob using the Azure PowerShell SDK or Rest API and I'm having troubles finding support for deploying WebJobs. It's super simple to do through the UI in VS or Azure Management Portal but there doesn't seem to be much automation support.
According to some sites, when you deploy an Azure Website with an associated web job, it's supposed to deploy the Web Job automatically but I'm not seeing that happen when I publish the web project in VS and I don't see how that would work after the bits are compiled through TFS.
I've found some great resources that I've tried following but don't seem to be working for me:
http://azure.microsoft.com/en-us/documentation/articles/websites-dotnet-deploy-webjobs/#deploy
http://azure.microsoft.com/blog/2014/08/18/enabling-command-line-or-continuous-delivery-of-azure-webjobs/
Unfortunately, I need to integrate this automation into a standalone deployment orchestration so I can't tie it to MSBuild.
I'd be happy with deploying both the Azure Website and the WebJob together if that's possible. I would imagine there must be a way to automate the uploading of a zip file containing the WebJob executable to the website like you can through the portal but I haven't had any luck finding it.
Apparently according to this post the job just gets put in a folder matching the job name in your websites App_Data folder.
You might have to manually upload the job as a zip file once, but afterwards I assumed you could do some magic in your deployment or in a post build task to build the web job console app and stick it in the appropriate App_Data folder.