New Relic installation via Deployment slots in an Azure DevOps pipeline - azure

We have the below settings that needs to be done for an app service to install new relic extension:
Ensure the "New Relic Agent" Extensions exist within the App Services Deployment Slot.
The files will be installed in NEW_RELIC_HOME : "C:\home\newrelicAgent". Following the deployment the newly created newrelic.config will need to be replaced with the applicable config for the Application Service.
From the files uploaded, rename {serviceAppName}_newrelic.config to simply "newrelic.config " and replace
"*The newrelic files will load with the worker process and starts profiling post restart of the appservice i.e. with the newly initiated worker process.
ost installation of newrelic extension, we need to replace the newrelic.config file in the below directory.
for dotnet framework applications:
C:\home\NewRelicAgent\Framework>
for dotnetcore applications:
C:\home\NewRelicAgent\Core>*
Unique to each file is the 'Appservicename', also containing the license key information:
NEW_RELIC_LICENSE_KEY : "License key"
NEW_RELIC_APP_NAME: "Appservicename"
Could you please help in updating the pipeline with the settings in an Azure DevOps.
Thanks,
Swabha

Related

Azure Devops Release Pipeline - Azure App Service files not updated

Azure App Service Deploy finishes successfully, but the files were not updated.
I'm using the pipeline step version 4.*
The WebApp.zip is retrieved successfully from the build and it contains the files, but in a strange subfolder structure: Content\d_C\a\1\s\Platform\Backend\Backend.WebApp (my path starts at 'Platform').
I already tried to use the WebApp release step, but it says it's not compatible with zip files.
This is the log output of the release step:
2019-05-21T13:09:43.6381219Z ##[section]Starting: Azure App Service Deploy: contras
2019-05-21T13:09:43.6498586Z ==============================================================================
2019-05-21T13:09:43.6498697Z Task : Azure App Service Deploy
2019-05-21T13:09:43.6498814Z Description : Update Azure App Services on Windows, Web App on Linux with built-in images or Docker containers, ASP.NET, .NET Core, PHP, Python or Node.js based Web applications, Function Apps on Windows or Linux with Docker Containers, Mobile Apps, API applications, Web Jobs using Web Deploy / Kudu REST APIs
2019-05-21T13:09:43.6498952Z Version : 4.3.24
2019-05-21T13:09:43.6499008Z Author : Microsoft Corporation
2019-05-21T13:09:43.6499078Z Help : [More information](https://aka.ms/azurermwebdeployreadme)
2019-05-21T13:09:43.6499169Z ==============================================================================
2019-05-21T13:09:44.4804024Z Got service connection details for Azure App Service:'contras'
2019-05-21T13:09:44.9625484Z Updating App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"0"}
2019-05-21T13:09:58.0865664Z Updated App Service Application settings and Kudu Application settings.
2019-05-21T13:09:58.4962410Z [command]"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='D:\a\r1\a\_MoonDesk Test\drop\WebApp.zip' -dest:auto,ComputerName='https://contras-staging.scm.azurewebsites.net:443/msdeploy.axd?site=contras',UserName='$contras__staging',Password='***',AuthType='Basic' -setParam:name='IIS Web Application Name',value='contras' -enableRule:AppOffline -retryAttempts:6 -retryInterval:10000 -enableRule:DoNotDeleteRule -userAgent:VSTS_7c1c6e1c-7491-4898-bc4d-a85345921032_Release__16_26_1
2019-05-21T13:09:59.9100098Z Info: Using ID 'fe8253d8-98f3-4403-9e0d-98ceb9f2a406' for connections to the remote server.
2019-05-21T13:10:11.3653059Z Total changes: 0 (0 added, 0 deleted, 0 updated, 0 parameters changed, 0 bytes copied)
2019-05-21T13:10:11.4450004Z Updating App Service Application settings. Data: {"CloudVersion":"1.4.2"}
2019-05-21T13:10:22.5003712Z Updated App Service Application settings and Kudu Application settings.
2019-05-21T13:10:26.5732176Z Successfully updated App Service configuration details
2019-05-21T13:10:33.4106055Z Successfully updated deployment History at https://contras-staging.scm.azurewebsites.net/api/deployments/161558444226571
2019-05-21T13:10:33.4184229Z App Service Application URL: http://contras-staging.azurewebsites.net
2019-05-21T13:10:33.4378162Z ##[section]Finishing: Azure App Service Deploy: contras
Solved it here...The solution/problem lay in the VS solution, which resulted in an invalid zip content.
https://developercommunity.visualstudio.com/content/problem/587989/azure-devops-release-pipeline-azure-app-service-fi.html

Version 4 of Azure App Service Deploy - ERROR_USER_NOT_AUTHORIZED_FOR_CREATEAPP

This is a follow-up question to this question. The answer in the original question helped me, but I am stuck somewhere else. As a reminder, I want to deploy my application using a publish profile. My web app in Azure has two subfolders inside wwwroot and one of them is called backend. I want to deploy my application to that folder. I am not sure why msdeploy wants to create anything, since the web app is already there - I just need to get the artifacts inside the backend folder.
Here is the relevant part of the log (with some names changed to xyz):
2018-06-14T09:19:25.0295238Z Start executing msdeploy.exe
2018-06-14T09:19:25.0323018Z "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='D:\a\r1\a\artifacts\drop\xyz.zip' -dest:auto,computerName="https://xyz.scm.azurewebsites.net:443/msdeploy.axd?site=xyz/backend",userName="$xyz",password="***",authtype="basic",includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"D:\a\r1\a\artifacts\drop\xyz.SetParameters.xml"
-enableRule:DoNotDeleteRule -retryAttempts:6 -retryInterval:10000
2018-06-14T09:19:25.6154385Z Info: Using ID '89f1210b-39ba-4758-b7ee-76a06407a503' for connections to the remote server.
2018-06-14T09:19:28.0800802Z Info: Creating application (Default Web Site)
2018-06-14T09:19:28.2012951Z ##[debug]rc:1
2018-06-14T09:19:28.2013216Z ##[debug]rc:1
2018-06-14T09:19:28.2013360Z ##[debug]success:false
2018-06-14T09:19:28.2013523Z ##[debug]success:false
2018-06-14T09:19:28.2073234Z ##[error]Failed to deploy web package to App Service.
2018-06-14T09:19:28.2081930Z ##[debug]Processed: ##vso[task.issue type=error;]Failed to deploy web package to App Service.
2018-06-14T09:19:28.2082198Z ##[debug]{}
2018-06-14T09:19:28.2082470Z ##[debug]System.DefaultWorkingDirectory=D:\a\r1\a
2018-06-14T09:19:28.2083178Z ##[error]Error Code: ERROR_USER_NOT_AUTHORIZED_FOR_CREATEAPP More Information: Could not
complete an operation with the specified provider ("createApp") when
connecting using the Web Management Service. This can occur if the
server administrator has not authorized the user for this operation.
createApp http://go.microsoft.com/fwlink/?LinkId=178034 Learn more
at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_AUTHORIZED_FOR_CREATEAPP.
Error count: 1.
I managed to resolve the issue. According to this answer by #starian chen-MSFT, I needed to set the correct parameter in SetParameters.xml. I did this by adding the following to my Visual Studio Build task:
/p:DeployIisAppPath="xyz"
where xyz is the value of DeployIisAppPath element in the publish profile.
The reason is that Azure expecting that site name will be presented twice in scm.azurewebsites.net:443/msdeploy.axd?site=%SiteNameHere%" and the same value as a parameter, by default value from file SetParameters.xml is used for second.
So, you need to modify the value of IIS Web Application Name parameter in xxx.SetParameters.xml programming (e.g. PowerShell or other tasks), after that it should works fine.
Azure staging web deploy fails with ERROR_USER_NOT_AUTHORIZED_FOR_CREATEAPP but not for production

How to setup a VSTS build definition to publish Azure Functions with this configuration?

We are using VS 2017 on a single solution with multiple projects and we right mouse click and deploy 3 C# Azure Function to two different Azure Function apps with slots.
How do you set up the VSTS build definition to accomplish this on every check in?
We are using the DLLs and setting up the function.json this way. I don’t know if we need to deploy differently based on this type of configuration.
"scriptFile": "..\\bin\\target.dll",
"entryPoint": "target.Application.Run"
I was able to create a VSTS deployment through the following steps
Solutions structure
Build Configuration Steps
Sync from master branch
Added Nuget Restore using default options
Added MSBuild Step with the followign optons
Project : vstsSolution.sln (Selected using '...')
MSBuild Version: Latest
MSBuild Architechture: MSBuild x86
Clean: Checked
Create Log File: Checked
Added App Service Deploy for Function App1
Azure Subscription: Target Subscription
App Service Name: Target Function App
Deploy to slot: If you check this it allows you to select the actual slot you want to deploy to
Package or folder: FunctionApp1\bin\Debug\net461
Added App Service Deploy for Function App1
Package or folder: FunctionApp2\bin\Debug\net461
Make sure you selected "Hosted VS2017" Agent Queue for this build.
All Build Steps
Triggers: Enable Continuous Integration. So that both function app deploy every time you check-in.
Continuous Integration

update ServiceConfiguration.cscfg file without need of developer

I am new to windows azure. So i am doing RnD. Can we update ServiceConfiguration.cscfg directly or we have to deploy the role through visual studio.
I am getting below error while updating ServiceConfiguration.cscfg. or we can't update it for staging environment?
"The configuration could not be uploaded for the staging deployment of cloud service ."
Not 100% sure what you're trying to do but there are two scenarios where you would be updating the config file:
You are changing value of an existing item in config file: If all you want to do is change the value of an existing item in the config file, you can do it through Azure Portal as well. There's no need to redeploy the application.
You have added/removed an item in config file: If you have added a new entry in the config file or removed an existing entry from the config file, then you have to redeploy your role.

Install service in windows azure

I would like to know that is there any way to install the windows service on Azure environment? Or is there any alternate way of doing the same?
If I understand the question correctly what you need in Azure is a Worker Role, similar question on Stackoverflow: What's the concept of *worker role* in Windows Azure cloud?
Check out the this blog post 'Migrating Windows Service to Azure Worker Role'
http://blogs.msdn.com/b/joseph_fultz/archive/2010/04/02/migrating-windows-service-to-azure-worker-role-image-conversion-example-using-storage.aspx
Also look at the Windows Azure Training Kit for code & usage sample for Worker Roles in Azure
http://www.microsoft.com/download/en/details.aspx?id=8396
HTH
Another potential option is to use StartUp tasks to install a windows service in either a Web or a Worker Role.
Here is an MSDN article - although it seems a little short on the details.
How to Define Startup Tasks for a Role
Basically you will need to be sure that the installer is copied during the deployment and create a cmd file to execute the installer. Then add a Startup task element to the service definition XML file.
Couple of things to add along with the other answers:
You can install Services with Web or Worker Role through the Startup Task
Alternatively you can also run a process with elevated privilege through the Task Scheduler
Here are the steps to install a windows service on VM running Windows Server 2012 R2:
start your VM in Windows Azure Console and connect to it with Remote Desktop Connector
map your storage as a new drive in your VM:
net use z: \mystorage.file.core.windows.net\endoint /u:myusername verylongkeythatendswith==
Storage key can be found in your Azure Management Console -> Storages -> Manage Access Keys
copy all the necessary installation files to the mapped storage (copy&paste)
copy nssm to a local drive (not z: as it uses MAFS file system and that cannot be accessed with low-level windows API commands)
Create a .bat file with the following entries
set username=xxx
set password=yyy
call d:\nssm install "My service"
"%programfiles%\PathToService\myservice.exe" "-p 8677"
d:\nssm set "My service" ObjectName "%username%" "%password%"
sc failure "My service" actions= restart/60000/restart/60000/restart/60000 reset= 240
d:\nssm start "My service"
Username and password should be the ones you used to create the VM.
run the script. The service should be visible in your services list.
Enjoy!
PS : I used NSSM to simplify the service deployment.

Resources