how do i get webapp deployment information using AZ CLI - deployment

I am trying to get the app deployment information from a webapp using az cli
basically this info that i can get from AZ portal deployment center, but i am trying to get this using az cli:
information i am trying to get is:
Branch, build and release, with date of deployment.

Using az webapp deployment module you can configure the CI/CD of the webapp but there is no command to list the deployments from CLI . So , after looking into resources.azure.com , Found that the Deployment details can be received from Azure Rest Api's.
https://management.azure.com/subscriptions/<subscriptionId>/resourceGroups/<resourceGroupName>/providers/Microsoft.Web/sites/<WebAppName>/deployments?api-version=2020-12-01
Example:

Related

Azure Devops deploy Yaml to OpenShift

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

Azure Devops Release not update Azure WebApp

I did an initial deployment to an Azure WebApp on Linux via a direct publish from Visual Studio. The code just echoes out some text and the page comes up successfully. I can update the text in the code and re-publish. And the new text displays on the web.
Now I am trying to deploy it via Azure DevOps rather than a direct publish from Visual Studio. I created a rudimentary build and release pipeline in Azure DevOps.
I updated the text echoed out in the code then ran the build pipeline followed by the release pipeline. The Deployment status says that everything was successful. I went through the logs as well and there are no error messages. However, the website page text has not changed. Also restarted the App Service in Azure but the change is not reflected.
The release pipeline has one artifact which is linked to the latest build. And one stage which is "Azure App Service deployment" with the right subscription and the right App Service Name linked.
Release Pipeline
Any idea what I might be missing?
Here is the output from the deployment step -
Blockquote##[section]Starting: Deploy Azure App Service
==============================================================================
Task : Azure App Service deploy
Description : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
Version : 4.163.9
Author : Microsoft Corporation
Help : https://aka.ms/azureappservicetroubleshooting
==============================================================================
Got service connection details for Azure App Service:'myAppName'
Package deployment using ZIP Deploy initiated.
Deploy logs can be viewed at https://myAppName.scm.azurewebsites.net/api/deployments/xxx/log
Successfully deployed web package to App Service.
Successfully updated deployment History at https://myAppName.scm.azurewebsites.net/api/deployments/xxx
App Service Application URL: https://myAppName.azurewebsites.net
##[section]Finishing: Deploy Azure App Service
Thanks in advance, Jake.
I was able to create an empty Azure Service directly within Azure. Then pushed the code to this new Azure Service via DevOps. Now it seems to be working as expected. Only other difference is that I had created this as an App for Windows rather than App for Linux. Anyway, the update is working now.

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.