>> Hi, welcome to the DevOps Lab. On this episode, we're going to
walk you through how you can do your builds and releases through
firewalls onto on-prem servers. >> Let's do it. [MUSIC] >> Hi, welcome to the DevOps Lab. On this episode, we are joined by a very special guest, Zach Totowa. In this series, we're
going to show you-all how you can use Azure
DevOps Services to build and deploy your
application through your company's firewall
into on-premise servers. Now Zach, I get asked this
question all the time, how you deploy through
the corporate firewalls? Do you have a plan? How would
we do something like that? >> Yes. So a lot of people think that the only way to do that
is to poke holes into firewalls and to basically
make it a little less secure. But with Azure DevOps, you
don't have to do that at all. We have this concept of deployment groups and agents that
run on your servers anywhere. It could be behind a firewall, in front of a firewall,
Infrastructure as a Service, it doesn't matter. So really simply, we can get
a deployment group setup. We can set up agents inside these deployment groups and we
can deploy to them that way. >> So if we don't have to
drill a hole in the firewall, does that mean the
agents are reaching out to Azure DevOps Services? >> Yeah. So as long as the agents can communicate with Azure
DevOps Services, they can be used as a deployment
inside of a deployment group. >> Okay. So then this concept
of deployment groups, I guess, we install this agent on every
machine that we want to deploy to? >> Yes. >> All right, cool. So let's take
a look and see how we do this. I guess the first thing we need to do is to be able to
build my application. >> Yeah. So the first
thing you wan to do is, the part of the CI/CD pipeline, make sure you build your app and
get it ready for deployment. >> Okay. I have an old-school
ASP.NET Web App. We use that one? >> Yeah. We can. I'm a Linux tech, but with your help, we can
do that pretty easily. >> All right. Perfect. Let's do that. We'll start with the build,
then we'll figure out how we deploy through the firewall
and do all that good stuff. >> Great. Let's take a look. >> All right. Let's do it. >> All right. So now we're
in the Azure DevOps portal. As you can see, we start out, this is my DevOps-win project
and I'm in the overview. But what I need to do is
setup a build pipeline, the CI side of things for
your ASP.NET application. So we'll come here and we'll
create a new pipeline. Let's go ahead and use
the classic editor. Is your repository inside a
GitHub or in Azure Repos. >> Yeah. I think GitHub. >> Okay. Let's take a look. >> Look for a Mercury core
or Mercury-Health file. >> Okay. Here we go. >> Perfect. >> Great. So I'm going to
use the master branch. This is an ASP.NET apps. So I'm going to go ahead and
use a template which makes it a lot easier to get going
with an app like this. So I'm not very familiar
with ASP.NET apps. What all would I need
to change in here or setup in here for
your application? >> Sure. Well, it's pretty
cool because the template has given us almost like 99 percent
of the steps that we need. Basically, this is a task runner. It's just work it as one task
after another, after another. So we're saying use NuGet,
do a NuGet restore, then build your solution using Visual Studio and then
run all of my Unit Tests. So the first thing we're going
to do is for Build the solution, in my repo, this has a lot of
different solutions in there. So you need to pick the correct one. >> Okay. So I'm going
to go to the "Build solution", and I need to change this. It looks like it's linked,
you "Unlink" that. Let's pick the solution.
Which solution do I need? >> It's going to be under the "Web" and go under "Source" and
then look for the solution. That's this.sln file? >> Correct. >> Okay. >> All right, perfect. So now, this will build my solution
which has everything. It has my Web app, it has my Unit Test, it has a Load Task, it has all sorts of different
kinds of tests in there. >> Awesome. >> So the next step after that, you notice it says Test Assemblies? >> Yeah. Let's take a look. >> Okay. This is where it's
going to run all of the tests. Now, I don't want it
to run all my tests, I just want it to run my Unit Tests. I don't want it to run Load
Tests or my automated UI test. So the way we do that
is through the filter. So go to the Test Filter part. >> Now, here we go. >> I want my TestCategory
to be equal to Unit Test. >> Okay. We're going to go
ahead and set that there. >> Perfect. That's what we need. All right. So this is
actually cool too. One of the things in my solution is going to
be a Database Project. The build artifacts for a database project is
going to be a BACPAC file. >> Okay. >> So I want to make
sure that I publish that BACPAC file back up to
Azure DevOps as well. >> So that's the file
that we need to copy? >> Correct. >> Okay. So on this agent, we can add a task by
clicking this plus here, and we're simply going to copy that. So let's look for a "Copy files" and we've got
that test added now. So this is going to
be for our DAC pack. Is it DACPAC? >> Yeah. >> Okay. For source folder, what should we put here? >> Well, the source,
why don't we just choose the source of everything. So that's going to be
build.sourceDirectory. >> Okay. Got you. >> So we're going to use these
built the Bergdorf variables. >> These are variables that
are built into Azure DevOps? Okay. Awesome. Then for the Contents? >> Let's go ahead and
recursively copy all by Ben directories just because that's where the
DACPAC is going to be. >> Okay, awesome. So
we're doing that with these asterisks/bin/buildConfiguration/
some more asterisks there. >> Perfect. >> We need to set this target
folder. It's saying it's required. >> Yes. So the target is where
do we want to copy this to? So we're going to want to copy
these builds to the staging folder. So it's going to be the
build.ArtifactsStagingDirectory. >> Awesome. That's another variable. Makes it really simple. >> Yep. Okay. Perfect. So
I think we're good to go. >> Yeah, I think that's literally all we need to do to set this up. >> Okay. >> So kick off the build
and let's see what happens. >> Let's do it. Let's "Save & queue". That's going to queue my buildup.
I could write a comment. I'm just going to leave that
blank for purposes of this demo. But it's going to start a run for me. We can watch this run as it
goes through all the steps. >> Yeah. So I really like the build system
inside of Azure Pipelines. It's super flexible. It does basically can do
whatever you want it to do. You can customize this
build to make it do and build any language targeting
any type of platform you want. So how would you do
something like that? How do you customize a build? >> So it's really up to you as to
how you configure those tasks. It can be super robust, it can be as basic as needed. I am a Linux engineer who
uses Terraform a lot. There's even marketplace extensions
for things like Terraform. We actually have a first
party extension or task now. But if there's something that
is not typically used or not first party inside of Azure as far as an extension here,
you can create your own. So it's really anything
that you want to do on these build agents, you can do. >> Yeah. When you talk about
building your own tasks, dude, that's where it
becomes super powerful. So to build your own
task, that's easy to do. It's either PowerShell or node.JS, which translates to anything
you do from the command line, you can get this build
system to do as well. >> Yeah, that's amazing. There are tasks here for Linux
servers for instance, where you can run any Bash
command that you want to. You can also change the agent, the type of agent that you're
doing these commands on from a, I think we're doing
this on a 2016 server, you can change it to a
different type of server if you want to do that. >> Yeah. So we give you three
different types of servers. We give you Windows
Servers that you can use, we give you Max that you can
use for your Build Agents, and also Linux Boxes as well. >> That's awesome. Yeah. >> We are the only Cloud
vendor that does that. It gives you Build Agents
for all three platforms. >> That is super cool. >> All right. Let's go
ahead and check out the build, see if it's done yet. When it's done, we'll keep on going. >> Yes. So building but
we can watch it here. All right. So that's it. It looks like my build is complete. >> Cool. >> So now we can take
a look at the artifact and to see what was
actually built here. Let's drill down and yeah, we can see the application here is- >> It's very very. There
is our entire application. >> That's awesome. Nice. >> So as we can see build very
easy to do inside of Azure DevOps. Now, next time, you're
going to show me how to actually do the release
portion behind a firewall. >> Yeah. For sure. We're
going to talk about deployment groups and then we're
going to actually release. >> Man, I can't wait to see that. >> Let's do it. [MUSIC]