Azure Devops deploy Yaml to OpenShift - azure-devops

I am Having a Yaml Deployment Config to deploy Image to OpenShift.
It contains reference to Docker Image in Artifactory.
It contains service connection and route information.
Usually I do the deployment from the OpenShift web console from Add to Project--->Import Yaml Json
Now I would like to have this done from Azure Devops pipeline.
Is there any way I could execute this Yaml file deployment from one of the task in Azure devops ?
Or if I first import this YAML from OpenShift web console is there any way further I can handle tagging of images in future releases from the Azure pipeline ?

We can install the extension OpenShift Extension, this Azure DevOps extension offers tasks for integrating OpenShift into your build and release pipelines, for example by executing user defined oc commands.
You can refer to the blog and doc for more details.

I work for Red Hat and have found there are a few ways to work Azure DevOps with OpenShift. 3 Patterns I have found OpenShift Extension, Kubernetes/Helm tasks or a self hosted agent running in a pod within openshift that has the oc tool which can help orchestrate.
I've made a video with an overview of 3 Patterns here : https://youtu.be/hMsvN7ld7E8

Related

is it possible to create azure build pipelines using terraform code?

I want to Create Azure Build pipelines using Terraform code, but not able to find any proper documentation on this. Is it possible ?
I tried terraform documentation, expecting some documentation or video guide how to create Azure build pipelines using terraform code
is it possible to create azure build pipelines using terraform code?
The answer is impossible.
Hashicorp doesn't have a terraform provider for Azure DevOps now.
If you check the azurerm provider, only azurerm_data_factory_pipeline is available, no Azure DevOps build pipeline.
You should look at the Azure DevOps provider From Microsoft. It does contain a resource for build definitions but you will need to pass it the path to an existing YAML file, you can't create the YAML from Terraform.
If you have a "templated" YAML then you could create a process that commits the YAML to a repo then use Terraform to set up the definition.

How to deploy an ASP.Net docker containerized application to an On-Premise Server, using Azure CI-CD Pipelines?

I have a multi-layer Asp.Net Application running. Due to it's multi-layer nature, I have to build a container for it and deploy it as a container.
Is there anyway I can deploy it to an existing server using Azure-Pipelines?
All other support that I am finding online is related to deploying to Azure App Services, however I would like to deploy to an existing production environment.
Is there anyway I can deploy it to an existing server using Azure-Pipelines?
Since you are deploying to the local environment, you can use Self-hosted Agent(Build Pipeline and Release Pipeline) or Deployment Group(Release Pipeline).
Then you could try the following pipeline settings.
Here is a blog about ASP.Net Application Deployment in Docker for Windows.
You could use Command Line Task to run the docker command. In this case, you can move the local build and deploy process to azure devops
By the way, if you have the Container registry Service connection in Azure Devops, you could use the Docker task or Docker Compose task.

Deploy .NET Core Console App to Windows VM using Azure DevOps

We have a .NET Core Console App which we publish to an On Prem VM using publish feature in Visual Studio. Here is how we configure publishing to a file system.
Target location in the image is actually the folder structure of where we want our app to reside on the VM.
How can we configure the same in DevOps. I can't seem to find any good resource on this.
I have created a CI build pipeline.
You can follow below steps to deploy Console App to the On Prem VM.
1, Create a deployment agent on On-Prem VM. create a deployment group from azure devops portal. Follow the first part of this tutorial to create deployment group. Check the official document for more information about deployment group.
2, Create a release pipeline. See document here.
Setup the artifacts(you should have the publish build artifacts task in the CI build pipeline to publish the console app build artifacts to azure devops server.), and add stage for the release pipeline.
Add a deployment group job in the release stage.
see below screenshot to select the deployment group created in the first step, which contains the deployment agent on the ON-premise VM,
Add copy file task to copy the console app build artifacts to the folder on the ON-premise VM
Another workaround is to use self-hosted agent(steps are similar to above using deployment group). Check the detailed steps in this example.
Hope above helps!

Azure devops deploy .net core to AWS elastic beanstalk

I am using azure devops for CI/CD of a .net core application
I am doing a nuget restore/build solution test etc followed by "Publish Artifact like below". All fairly standard
I want to deploy this the AWS elastic beanstalk, and have the following task setup in Azure Devops..
I have tried a number of things but not sure how to get the .net core application deployed to aws beanstalk... The problem i believe is with the location of zip file. what should this be? - Is there anything else needed to be done? It just errors trying to created deployment bundle in the "Deploy to Elastic Beanstalk" task (btw aws connection etc is working fine)
Azure devops deploy .net core to AWS elastic beanstalk
It depends on the output of the previous dotnet publish.
You could get the info from the Deployment Bundle Type:
ASP.NET Core (Source: dotnet publish)
As you can see the source is from dotnet publish task.
Then, the output location of the next option Published Application Path should be based on previous build steps placed the deployment artifacts. It should be the path and filename of the .zip file containing the artifacts.
You can check the details info from the document:
AWS Elastic Beanstalk Deploy Application Task
Hope this helps.
Here is a full tutorial on how to do Elastic Beanstalk deployment using Azure DevOps
You can also use this PowerShell script to automate the end to end deployment instead of using Azure DevOps plugins. It gives your more flexibility on what you can do with your deployments

Azure pipeline - How do I deploy code to Preregistered application

Our devops team have created an application (ex:athena) and registered with AD. They also have given us Service Principle.
The question I have is , how do I deploy my code in GitHub to the application (athena) that the devops team created for me using the “Deploy to kubernetes service” configuration template ?
Apologies in advance, as I am not proficient in Azure and this shows my gap in understanding.
The Information I have are :
Repository - GitHub (I have done the appropriate authorisation and can see the repository)
Service Principle (create by devops team)
Application (created by devops team)
I have created a Container Registry and Kubernetes service using azure portal
Now, I want to use the “Deploy to kubernetes service” configuration template.
Help much appreciated.
If you want to use this Deploy to kubernetes service, you must get two service connection : Azure Resource Manager and Kubernetes Service Connection.
So, first, you need to configure the connection between Azure Kubernetes, ARM and Azure Devops. Enter project setting->service connection, open New Service Connection and select Kubernetes. Input the relevant configure according to your Azure:
And so do with Azure Resource Manager, you can follow this doc to configure it. Here is my ARM connection you can refer:
Then, you can begin your build and release pipeline.
Deploy to kubernetes service task used in release pipeline. In build pipeline, you must run docker build, push task to finish pushing to Azure registry Container.
And then, run this deploy task in release. You can refer to this blog which written by Azure DevOps Labs: Deploying a multi-container application to Azure Kubernetes Services. It has detailed steps you can refer.
In addition, there has two build source type. One is you import your github repos into Azure Devops repos. So the build can be trigger by Azure Devops Repos. And the other is select Github as your build source, in this type, you can triggered directly by your github instead of use Azure Devops repos:
And also, this need you get the service connection with your Github first. Then, authorize it during the build pipeline.