Azure Dev Ops Configuring an IIS 3rd level Site - azure-devops

I am trying to configure an IIS Web Application In Azure Dev Ops / VSTS which has a website at level 3, for example
Sites/Applications/payroll-forms/hub-manager
Applications is a Website
payroll-forms is a was a virtual directory but is now an Application
hub-manager is a application
Here is my Variables and YAML
Configuration type : IIS Web Application
Website Name : applications
Virtual Path : '/payroll-forms/hub-manager'
steps:
- task: IISWebAppManagementOnMachineGroup#0
displayName: 'IIS Web App Manage'
inputs:
IISDeploymentType: '$(Parameters.IISDeploymentType)'
WebsiteName: '$(Parameters.WebsiteName)'
WebsitePhysicalPath: 'f:\Websites\Applications'
AddBinding: '$(Parameters.AddBinding)'
Bindings: '$(Parameters.Bindings)'
CreateOrUpdateAppPoolForWebsite: true
AppPoolNameForWebsite: Applications
DotNetVersionForWebsite: v2.0
PipeLineModeForWebsite: Classic
ParentWebsiteNameForVD: '$(Parameters.WebsiteName)'
VirtualPathForVD: '$(Parameters.VirtualPathForApplication)'
ParentWebsiteNameForApplication: '$(Parameters.WebsiteName)'
VirtualPathForApplication: '$(Parameters.VirtualPathForApplication)'
PhysicalPathForApplication: 'F:\Websites\Applications\payroll-forms\hub-manager'
AppPoolName: '$(Parameters.AppPoolName)'
steps:
- task: IISWebAppDeploymentOnMachineGroup#0
displayName: 'IIS Web App Deploy'
inputs:
WebSiteName: '$(Parameters.WebsiteName)'
VirtualApplication: 'hub-manager'
TakeAppOfflineFlag: True
XmlVariableSubstitution: True
The Error
2019-07-31T14:49:46.1783681Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe" list app "applications/payroll-forms/hub-manager"
2019-07-31T14:49:46.2584534Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe" add app /site.name:"applications" /path:"/payroll-forms/hub-manager" /physicalPath:"F:\Websites\Applications\payroll-forms\hub-manager"
2019-07-31T14:49:46.3231472Z ERROR ( message:Failed to add duplicate collection element "/payroll-forms/hub-manager". )
2019-07-31T14:49:46.4988608Z ##[error]Process 'appcmd.exe' exited with code '183'.
2019-07-31T14:49:46.5431004Z ##[section]Finishing: IIS Web App Manage
I have tried many combinations and struggling to find an example even though i got a 2 level one working fine.

[error]Process 'appcmd.exe' exited with code '183'.
The error code 183 means sorry this files already exists, so I could not create this file since that.
And also, this message can be validate by the previous error message:
ERROR ( message:Failed to add duplicate collection element
"/payroll-forms/hub-manager". )
So according to this message, the issue occurred between Virtual Path : '/payroll-forms/hub-manager' and /path:"/payroll-forms/hub-manager". Please try with run this script by removing Virtual Path. Or, please change /path:"/payroll-forms/hub-manager" as another path value which will not conflict with the value of Virtual Path

Related

Signing messages using PublishToAzureServiceBus task

I'm trying to sign a message using the task PublishToAzureServiceBus. I am using a certificate that is stored in keyvault and using the AzureKeyVault task to download the secret.
My yaml for the step looks like this:
- task: PublishToAzureServiceBus#1
inputs:
azureSubscription: 'AsbQueue'
messageBody: |
{
--Redacted--
}
certificateString: $(signingCert)
signPayload: true
waitForCompletion: true
signatureKey: 'signature'
I've tried several different types of certificate. But I always get this error:
JsonWebTokens do not support crypto provider of type 1.
Is this down to the cryptographic provider im using to create the cert? If so which one should I be using?

Azure Devops Pipeline: There was a failure in sending the provision message: Unexpected response code from remote provider InternalServerError

I have created a new pipeline as part of investigating this issue as follows:
New Pipeline > Azure Repos Git > Start pipeline
I have not edited the base template pipeline code, so it looks like this:
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'
- script: |
echo Add other tasks to build, test, and deploy your project.
echo See https://aka.ms/yaml
displayName: 'Run a multi-line script'
However randomly (at least 1 in every 15), I will see the following warning when running the pipeline:
There was a failure in sending the provision message: Unexpected response code from remote provider InternalServerError
Considering that im using their starter pipeline without any changes, I don't think this is an issue with the yaml, but an issue on Azure DevOps / Hosted Agents side.
I also enabled the diagnostic logs, and found the following in Agent_20220611-100355-utc.log:
[2022-06-11 10:03:56Z ERR JobNotification] Connection to monitor port 49100 failed!
[2022-06-11 10:03:56Z ERR JobNotification] System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (111): Connection refused [::ffff:127.0.0.1]:49100
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at System.Net.Sockets.Socket.Connect(IPAddress address, Int32 port)
at Microsoft.VisualStudio.Services.Agent.JobNotification.ConnectMonitor(String monitorSocketAddress)
[2022-06-11 10:03:56Z ERR JobNotification] Invalid socket address hello. Job Notification will be disabled.
Does anyone have any suggestions?
I switched from windows-latest to windows-2022 and that cured things for me. Which is weird because this says they are the same thing.
Maybe a similar trick will work for you? Try ubuntu-20.04.

Azure DevOps - Unable to load the service index for source

I am running a Azure DevOps pipeline, and I get the following error.
error: Unable to load the service index for source https://pkgs.dev.azure.com/companyName/_packaging/12345678-1234-1234-1234-1234567890ab/nuget/v3/index.json.
error: Response status code does not indicate success: 403 (Forbidden - User '12345678-1234-1234-1234-1234567890ab' lacks permission to complete this action. You need to have 'ReadPackages'. (DevOps Activity ID: 12345678-1234-1234-1234-1234567890ab)).
And I am getting the error from a task whose yaml looks like this.
steps:
- task: DotNetCoreCLI#2
displayName: 'Push the created package to Nuget feed. '
inputs:
command: push
publishVstsFeed: '12345678-1234-1234-1234-1234567890ab'
versioningScheme: byPrereleaseNumber
Any ideas what to be done?
Azure DevOps - Unable to load the service index for source
It seems you have not authenticated your private feed, please try to add the task NuGetAuthenticate
- task: NuGetAuthenticate#0
displayName: 'NuGet Authenticate'
inputs:
nuGetServiceConnections: TestNuGet
And create a service connection for the private feed:

How to use the postgres db on the windows-latest agent used in the azure pipeline?

I have a java maven project that I am building with an azure pipeline with as host "windows-latest" as it contains the correct java 13 version. However, for the integration tests, I need a postgres db and the "windows-latest" agent contains a postgres db, see: link. But how can I use this? I tried to use it by including it's serviceName in the Maven task as service:
services:
postgres: postgresql-x64-13
But then I get the error it can not find a service by that name.
I tried defining the db properties through env settings (see yml below), and then it shows the error:
Caused by: java.net.ConnectException: Connection refused
I also tried running it through a script task through the docker-compose.yml in the root of the project that I use during development, but docker-compose throws an error saying it can't find the compose file, I also doubt this the correct way.
So can I use the postgres db on the windows agent? and how?
My azure pipeline snippet:
variables:
MAVEN_CACHE_FOLDER: $(Pipeline.Workspace)/.m2/repository
MAVEN_OPTS: "-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)"
application_name: clearsky
service_name: backend
mygetUsername: myserUsername
mygetPassword: mytoken
SPRING_DATASOURCE_URL: jdbc:postgresql://localhost:5432/postgres
SPRING_DATASOURCE_USER: postgres
SPRING_DATASOURCE_PASSWORD: root
stages:
- stage: create_artifact
displayName: Create artifact
jobs:
- job: build
displayName: Build, test and publish artifact
steps:
- task: Maven#3
name: maven_package
displayName: Maven package
inputs:
goals: "package"
mavenPomFile: "backend/pom.xml"
options: '--settings backend/.mvn/settings.xml -DmygetUsername=$(mygetUsername) -DmygetPassword=$(mygetPassword)'
mavenOptions: "-Xmx3072m $(MAVEN_OPTS)"
javaHomeOption: "JDKVersion"
jdkVersionOption: "1.13"
mavenAuthenticateFeed: true
In Azure Devops Windows agen, the postgresql is disabled/stop by default.
Here is the configuration doc.
Property Value
ServiceName postgresql-x64-13
Version 13.2
ServiceStatus Stopped
ServiceStartType Disabled
You could try the following command to start the postgresql.
"C:\Program Files\PostgreSQL\13\bin\pg_ctl.exe" start -D "C:\Program Files\PostgreSQL\13\data" -w

Application keep crashing when deploying to Bluemix

We are trying to deploy application to Bluemix using the CF command cf push -f manifest.yml and below is the attached yml file
applications:
- name: service_name_v1.0
memory: 1GB
buildpack: liberty-for-java
instances: 1
path: /Users/admin/Apps/wlp-cb/usr/servers/defaultServer/defaultServer.zip
domains:
- my.bluemix.org
hosts:
- my-service-space
timeout: 180
DEA/2
Instance (index 0) failed to start accepting connections
May 4, 2017 10:10:55 AM
API/0
App instance exited with guid ae937fbe-d88f-48d5-b985-12b3b71b3b8c payload: {“cc_partition”=>”default”, “droplet”=>”ae937fbe-d88f-48d5-b985-12b3b71b3b8c”, “version”=>”94e28b95-27d3-4554-b99b-11d453f40e7f”, “instance”=>”9b723df2d462441caa352e3337b4e230”, “index”=>0, “reason”=>”CRASHED”, “exit_status”=>0, “exit_description”=>”failed to accept connections within health check timeout”, “crash_timestamp”=>1493917855}
May 4, 2017 10:10:55 AM
API/1
App instance exited with guid ae937fbe-d88f-48d5-b985-12b3b71b3b8c payload: {“cc_partition”=>”default”, “droplet”=>”ae937fbe-d88f-48d5-b985-12b3b71b3b8c”, “version”=>”94e28b95-27d3-4554-b99b-11d453f40e7f”, “instance”=>”9b723df2d462441caa352e3337b4e230”, “index”=>0, “reason”=>”CRASHED”, “exit_status”=>0, “exit_description”=>”failed to accept connections within health check timeout”, “crash_timestamp”=>1493917855}
This usually indicates that your server isn't listening on the right port.
I recommend deploying the Liberty Buildpack here and subsequently downloading the source code. This should give you a working Liberty app with the correct manifest to push code to Bluemix.
You list the path to the target artifact as a zip file and the build pack probably does not recognize that artifact type. Try changing it to an executable jar or a war or ear file.