 Hey, everybody. It's Jay. I am back. My name is Jay Gordon. I am here today to continue on what I was discussing in my last stream, which is Azure Container Apps. But this time around, what we're going to be doing is configuring CICD deployments using an Azure Container Registry, bringing it all together, being able to do push to main deployments, if you will. We'll look at how we have revisions and we'll deploy our application. It's going to just take a little bit, I think under a half hour to do all this. So thank you for giving me some of your time. If you'd like to follow along with today's demo, there is the repository that I'll be working with. It's a really, really simple application. I basically just wanted to give us something that you could just use to quickly get started with. It's a hello world. It's nothing very special. As you can see, it's just a simple hello world that gives us a message on Port 880. Cool? All right. If you have any questions along the way, there is the chat. Feel free to put your questions in there. More than anything, I want to show you a great automated process of getting your infrastructure built for a container app. Container apps are great for microservices. You can put small applications on it. You can put large distributed applications. Today, we just want to work with something real simple and get it built. So let's quickly go over some of the things that we're going to be talking about what we're doing here. Got this little notepad here with my steps. They're also in the notes. So you can go check out the notes if you'd like to get all of this information as well. So we're going to create a resource group because we need a place to keep our resources that we're going to create for Azure. We're going to create an Azure Container Registry. We're going to create a service principal ID, so it creates some credentials, so that we can actually do a deployment from GitHub because things are going to run from GitHub actions in our CI CD process. We're going to build our container from this repository that we've got online. We're going to configure the Azure Container App Service, and then after that, we're going to go into the portal. We're going to set up CI CD to build on a push we may do to the GitHub repository so we make some changes, and then we can actually review and update revisions that are within this service. So I think we'll just jump into it. So one of the things that I'm going to be doing is I'm going to be working in Cloud Shell, and I've already, as you can see here, I've already downloaded the repository, and if you, let's just do a quick cat of app.js. If you see here, it's just pretty basic. It's starting an Express server, it's sending hello world, and then let's look at the Dockerfile, okay, so we'll just cat back our file. And you can see it's an old version of Node. It's creating a work directory, it's copying the package.json, it's doing a run of npm install, it's copying it, then it's exposing port 8080, which app service will then call and send over to port 443 with a fully qualified domain name. All right, so we talked about our steps, our first step is to create a resource group. And creating a resource group really, it's real quick, it's real simple, using Azure CLI, you can do it in the portal. But I'm going to just show you quickly how to do it right here. So az group create, then we're going to give our group a name, and I'm going to call it jagored demo, cool. And then location, I am going to go with Canada central. And the reason I'm going to be going with Canada central is that Azure App Service is in preview, and because it's in preview, it's only available in certain locations. You don't have to have your resource group in the same location as this preview, but I just doing it for some consistency. You could set these as variables if you wanted to, but I'm just going to do it like this because we're demoing it today. So you can see I've gone ahead, I've created my resource group. It is in my account under my main subscription because you can see here, here's the subscription ID, here's the resource group, jagored demo, location, Canada central. I haven't set up any tags or anything special, just created it. So the next thing we're going to want to do is we want to create a private container registry using the Azure CLI. And this is another thing where, create the resource group and then create the container registry. Another way where we could do this if we wanted to in the portal, but I am going to do this quickly within Azure CLI. So az, acr, because we're going to invoke the acr command, create, because we want to create a registry. We'll give it a name, and I'm just going to call it the same, jagored. And then we're going to give it the resource group that it's going to live in. And that will be of the same name, jagored demo. And remember that acr, it should be something unique. It needs to be a unique URL, or I should say domain name. So make sure you pick something unique. That's why I just use jagored demo. Okay, so let's keep going along. We need to set the SKU, the SKU specifies what the complexity, how if you want, or I should say the complexity of scaling this Azure container registry, which is just a private Docker registry hosted on Azure. And so if we go to SKU, I'm going to just use standard. There is a premium one, and that allows you to do things like managing your own keys for your Azure container registry. But we're going to just enable admin, which is going to just create a managed by this service, username and password, excuse me. It's always, we get typos when people are watching you, right? Like I mentioned before, if you have any questions, please put them in the chat. I'd love to hear from you. Also, if you want to get in touch with me on Twitter, at Jay Destra. So let's create this, okay? Oh, so it looks like I need to fix SKU, no problem. All right, so this normally will take a few minutes, we'll go through Azure Resource Manager, we'll tell it, we want to create this registry. It'll create it with this admin service and look, it's up and ready for me to use. What we can do is see here, we get the RJ sign back, we see our admin enable user is true, the location of our registry, which is in my subscription, the location it's in, which is Canada Central, the name, network bypass rules. And so let's go ahead, there's my resource group. Within my resource group, here's my container registry. So you can see it's been created, it's got its login server. We have our access keys here, if we need to use them for some reason, luckily I have them blocked, sorry you can't see them, but it is what it is. There's a bunch of different ways that you can use ACR efficiently. And one of those ways is to be able to do automated builds when you push something through, you push it to your main repository in GitHub, you can have it do it automatically, build and save it into your container registry that built image, we're gonna go through that process now. So let's take a look at our next step. We created our ACR, so we've got create resource group done, we've got create ACR, we need to create a service principle ID for our deployments. So this are gonna be some credentials that we need in order to be able to configure between GitHub and Azure so that we can actually run our deployment. And what I am going to do is create a service principle. And so, creating that service principle is AZ-ADSP, so Azure AD service principle is the commands we're gonna be invoking. Then we're gonna say create or our back role-based authentication that's gonna be able to give us our username and password we need. We can give this service principle a name just for identification purposes. And in this case, we'll just call it demo app GAGourd01 and then the role is contributor. And then we hit enter. And what it's gonna do now is it's gonna create this new role-based authentication under a scope of my subscription. Don't worry by the time you get to see this and use it, it'll already be expired. But what we get here are some important credentials that we're going to need. So I'm just gonna take these copy and I'm going to stuff them in an area in some scratch notes that I have. Okay, so we've created the service principle and if we take a look at it, we get the application ID that's associated with the service principle, the display name that we gave it, the name of the, or this is the app ID, I shouldn't say the app ID, excuse me. This is the client name right here, 4513baba, our password that goes along for our credentials and then the tenant that it lives within. All right, so I know it's a little more information than just building a container, but we need to be able to configure CI CD in order to do that CI CD creation. We need some credentials to be able to set up an authentication trust between GitHub actions on my GitHub account and here in Azure. So all right, we created our service principle and now we want to build the actual container that we're gonna be working with. And so I love the ACR service because it will handle the build of a container right within Azure. And so I've got the command written out. I'm gonna just copy it and paste it in here and then I'm gonna talk through what we can see here. So what we're going to be doing is using the AZ ACR, we're gonna invoke that extension within Azure CLI and then we're gonna do build. And so what it's going to do is it's gonna build our applications container image based on what I have here in the directory that I'm in. Demo app, that's my repo. It's gonna create an image called demo app is the repository and the latest revision is just gonna be the version number. I can call it V1, V2. It's not really important at this point. We just wanna have an image ready to go for when we build our container app. Registry, J-A-Gord demo, the one we've created before, the platform, Linux, you can use Windows if you want. And then what I'm specifying here actually, so I could give a local way of building it but I wanna build it off the place of the source of truth, if you will, which is the actual repository that I've stored everything in. And so you can see right here, I've given my URL. And so if I smack return, what's gonna start happening here is it's gonna start building this container image using the repository that we have, the Docker file that we have. And so it's gonna go through each of those steps that I showed you before, gonna build the Docker image using just node and then presenting port 8080, which is where our node server actually broadcasts to so that we can contact and add our application. So it's gonna go through the process of just building the container image, storing it, running any tests that might be in there. You can see expose 8080 and now it's saving it and now it's pushing up the image. It's a pretty standard process. I think it's a lot easier to be running it in Cloud Shell sometimes. And the reason why is that you're not having to do these builds locally and then push the image that you've created up to the ACR. Let's look, it's gonna automatically push it after we do this build process, all right? So while this is going on, let's take a look at what the next step is. And hey there, thanks for watching, appreciate it. Our image is created, registry right there. So let's go into the ACR here in the portal and we can scroll down to repositories. Within repositories we can see here it says demo app, which is what we've created. And then the latest tagged version is named latest. And so you can see here, here's the manifest with the Docker image, the creation time, the manifestation or manifest creation date. We've got all this information right here, okay? So let's talk about our next step. So we built our container. Now let's configure Azure Container app, the service itself. So I'm gonna do that in the portal just because I wanna show you step by step how we get this done. So we're gonna go to our resource group. We're gonna click create. And I'm gonna just type container app. And there we go, container app, there's the service. It's in preview. And so we'll get this product description, Azure Container apps built on a foundation of powerful open source technology in the Kubernetes ecosystem that extracts, excuse me, abstracts the overhead of infrastructure management orchestration. So it's a great choice for network services, APIs, event process, log running, background jobs, and more. So we can, and yeah, sometimes I have difficulties remembering Docker commands as well. So being able to use this simple AZCLI process of being able to build your images, it definitely helps streamline the process. But once we configure CI CD, we're not gonna have to run those commands anymore. And so let's get into that. So we'll click create here under the product page and now we're given the create container app Azure Resource Manager template creator, if you will. You fill in these, it creates a template that eventually gets pushed over to Azure Resource Manager and then creates the resources we need. So let's create the things that we need to create. We need to give this a name and we're gonna call it demo app, excuse me, JAGord demo app. That's the container application name. We can create an environment. The environment houses our log analytics and allows us to have a isolated space to be able to run our application. And so we create different environments and those environments represent kind of a gated off section. So I'm gonna call this one production and I'm going to keep everything in Canada central. Okay, so quick, let's go to monitoring. We need to have an ant log analytics workspace in a place to keep the logs for our environment specifically. So I'll go ahead and I'll pick this one that I created earlier workspace demo app. I will then click create. So now we have our environment created. When we go back to the portal, once this is all done, we'll take a look at it. So now next we'll go to app settings and you can see that there's a quick start image which gives you its own simple hello world that you can go ahead and utilize. And we went through that in the last stream I did, but this time we don't need to use that hello world container. We're gonna build our own. So we're gonna uncheck quick start image. And then what we're going to do is we've got some different image sources that we could use if we want. In my case, I've created an Azure container registry that we're going to be working with and you can drop it down and it'll say right there. The next, we can see the image that we want. And then the latest version is the tag that we've given it. We don't need to do a command override. We want it to start the way it is. CPU and memory, there's some different options that we're going to have access to and they're all charged based on how much CPU and memory that you're utilizing. I'm just gonna be using the most simple and basic one. Now application ingress settings. We can enable ingress so inbound connections that can actually come to our application. So we can specify whether we wanna have HTTPS ingress with TLS. So you'll get it on port 443. You don't need to create a load balancer. You don't need a public IP. It's all handled for you. So I'm gonna go ahead and click enabled. And now we've got this ability. So if we're building some microservices and we wanted this to be an internal, we can configure it within the virtual network and allow just access. But we're gonna be doing this as a publicly facing application. So we're gonna specify the target port and that's the port our container is actually listening on. And so if we go back, ooh, I hate when that happens. Sorry about that. Let me just gonna close it. So if we go back into our applications code, we can take a look in app.js. You can see it's listening on port 8080. It is the same in the Docker file, expose 8080. So that's the port that we're going to want to specify as our target port. Sound good? All right, we'll go and we'll continue. Now, if we wanted to create some metadata tags, we could do that here. We can name environment, production. We can give the specific resources that we want. All set. So now we'll click review and create. Let's see what I missed. Oh, forgot to give my container details and name. So we'll just call it jgord demo app. Always forget something. Click review and create. And so now it'll validate that all this is ready to go. We can download the ARM template locally if you wanted to, but I'm gonna go ahead and click create. And so now it's going to start the process of deploying our application into our resource group. It's going to take that image in the container registry and apply that into this container. So you can see it's created our workspace. It's creating our production environment. And then once it's finished creating our production environment, it'll create our container app service. And within that, it'll load the image and get everything online. So we're gonna give this a few minutes. And while we're doing that, I wanna share with you some documentation that I've got ready for you to go. So let me hop that into the chat for a few minutes while that's running. So we've got our quick start here. You can create a container registry using the information in that tutorial. We've got creating a service principle. We've got some information on how that's, and you can see our app building is moving along. If you wanna see a doc on build into play container images in the cloud using an ACR registry task, which is what we did. We've got some docs there. We've got all sorts of other information in the chat below. You've got some information in the show notes. And as you can see right now, it's created that production environment. It is creating this app within our resource group. So it's just taking a few minutes and we'll get to that. So while we're doing that, I wanna remind you all that Azure FunBytes is normally every Thursday. I have guests, but this year, I wanted to try to do more of these individual shows so that we can take a look at how to build different small parts of Azure infrastructure working together in the streams because I like to learn in public is the best way to put it. So let's take a look at our application URL. And here's our hello world. Let me make it bigger so you can actually read it. So here's our hello world. And as you can see, I've got a fully qualified domain name here in JDemo app, Purple Stone. These are just randomized names. If you really wanted to, what you can do is go ahead and configure DNS and have a specific username and password, or actually, excuse me, have a specific DNS name that you want everything to go to. So here, if we take a look, we can modify ingress if we want. We have secrets. So if we want to store and share secrets within here, we can create a secrets value. So add the key and a value that we can store within here. We can retrieve those. It's a little bit different than using key vault service. Here's the thing that we're going to be doing next. And we said that we were going to enable CICD to build on a push to the GitHub repository. So to configure that CICD, we're going to go into this continuous, this deployment section within the portal. And we're going to see, I've signed in as my GitHub account. So I've already authenticated. Next, I just want to select my organization. And so this is under mine, the JDestro org, the repository that we're going to be building this from. And you can see I've got a bunch, but we're going to be working with demo app. And then the branch that we're going to be building it from, main. All right. And so now we can show the registry settings of where I want everything. So I specified already my Azure Container Registry. I've got the image name set up right here. The image tag, what it's going to do is every time there's a commit ID given on GitHub, it's going to actually create, instead of using latest, it's going to use that image tag. It's going to specify the OS, which is Linux. The Docker file location. And in our case, it's just Docker file. It's just an example. You don't need to necessarily show that. And then here are our service principle settings that we created before. And so our service principle client ID is going to be the app ID. And so I've got that saved elsewhere. And I'm just going to pop that in there. The next part is the password that we need. And I'm just going to copy that, paste that here into service principle secret. And then the tenant ID we need. And that was the last line within our service principle information. So just to bring it up for you really quickly, go back to my scratch pad. You'll show you what I'm... Here is the name, the password, the tenant. App ID is the client ID that we're going to be specifying. Password is the password we're going to be specifying. And the tenant ID is the tenant we're going to specify. Okay? So we're almost ready to start continuous deployment. We'll go ahead and we'll click start. Go to actions. We can see that we've created an auto deploy file. What is that? Well, it's a GitHub actions workflow. And if we go back to code, we go here to .github slash workflows. You can see we've got here and it's done this to the main branch. It's gone ahead and it's created a auto deploy file, which is a GitHub actions workflow file. It's in YAML. Let me make this a little bit bigger. And what you can see it's going to do here is trigger an auto deployment of container apps when you push to the main branch. Now, if you want it to push to other branches, that's great, we can do that. And I'll show you what happens when you do that. All right? So it'll check out the branch. It'll set up a Docker build. It'll log into the container registry. It'll use the registry username and password. It'll then build and push the container to the registry. It'll then next deploy to a container app and utilize our Azure credentials that we stored as service principles. Okay, the service principle information that we stored when we configured CI CD, okay? So it's gonna build everything based on this. If we go to actions, we'll see that it's gonna run through our build and deploy. So it's finished the build. You can see it's doing all those steps that we mentioned, logging in the container registry, building and pushing, and then after it's built and push, we'll be able to do our deployment. So right now we're here in deploy, it's set up the job, it logs into Azure. That's why we provided our credentials and then eventually it deploys to container app, all right? So it's gonna go through that process and eventually it's going to create a new revision. And revisions are different kind of slots within the Azure app, container app service. Let's close this, we don't need that. And you can see right now we've got a revision, the first revision that we have right here that's been configured. And so there's that ID that we mentioned before and you can see it's got its own application URL. That'll come up. So I'm gonna pop myself down here. That's gonna build, it takes a few seconds. But while that's going on, you can see we're waiting for this deployment to finish so that our newly created CI CD sets up everything, deploys it automatically to our container app service. So it's completed the job, it's deployed. Let's go back to revisions, refresh. And we see now we have a new version that's been up. And so let's take a look at the time, stretch this out a bit. And you can see this is the latest version and it's gone ahead and it's given 100% traffic to it. So we don't need to keep this revision, this is the original one that we created. We don't need to keep that active. We can just remove that one and now we're just using this. But if we wanted to go back, we could. All right, stop. What happens when I want to make a change? How does that CI CD actually start working? So let's go to code and let's go within code and I'm going to go to branch. I'm gonna create a new branch and I am going to call it demo change, okay? So we've created this new branch. We've got it right there, demo change. And I'm gonna go into app.js and I'm just gonna change this from, I'm gonna do all within the browser. We're gonna just go in here and we're gonna change this hello world to hello world from J. Okay, so we'll scroll down, we'll give the commit, just changing hello world output and then it'll commit directly to this branch. So let's commit changes, okay? So we've committed those changes and now let's go to GitHub actions. And you can see that it didn't kick off anything because it wasn't part of the main branch. Because we've got our workflow file set that it's only going to do builds based on new runs from that particular branch. So what we need to do is now compare and pull our request through a pull request. So we're gonna create a pull request here. We don't need reviews or anything so we're just gonna move these through this. We'll create our pull request, we've got our commit here and what we'll be doing is just going ahead and merging that pull request, confirm merge, okay? So we've confirmed the merge and now if we go back to the action section, you can see right there that here's our merged main branch that's gone ahead and begun that change. So it automatically as soon as we committed that change to the main branch, it's GitHub actions workflow new to kick off based on that trigger and start building our new application based on the changes, then it will build the container, push the container with that new GitHub ID as the version number and then it'll go through the process of then deploying that particular image and it'll actually then add it to a revision that we can work with. So let's go ahead, we'll go through the process, it'll complete the job from building and now it's going through the deployment process. So now our new built image that's gone through this whole CI CD process, it's been ready for deployment. So it'll go through the process of running this deployment, it's using our credentials like we did before. So it's not a big change from what you've seen so far in this demo, okay? All right, so we're getting real, real close to the end and those people who have stuck with me, thank you. I do appreciate it, you're wonderful, you're beautiful. I am thankful for you all to be here. So it's gonna go through this deployment process, it'll take a minute or so and then once that's done, we can go over here and take a look at the revisions that we've got. So we still just have the previous version that we were working with but once our other one is completed, let's go back to GitHub, okay? So it's gonna go ahead and finish publishing our newly created container app to, or I should say our newly created image into our container app, all right? So let's just give this a minute, all right? We're moving along, we're getting into this whole process, we're gonna be moving right along and finishing up our deployment. It just takes maybe three, four minutes to actually finish this, because we're only like a minute in, as you can see, a minute and a half. So the build process is fairly quick, the deployment process pretty quick. So it finished, there we go. So let's go over here to revisions. We'll refresh our revisions and we'll see now we've got a new revision version and what we can do is kind of use this as a preview of what we've built. And so if I go here to this particular revision, we'll see that there's no traffic push to it on the public side, but we've got a preview URL right here. So I can click on that preview URL and you can see Hello World from J. But if we look at the original version, it's still, let me grab the original version, excuse me. If we grab the original version of this application, you can see it's still running that initial image, it'll just take a second to bring it up, but it's still running the version that we were working on before, that standard Hello World. So we've got this version of the Hello World and then we've got our new revision. So what we wanna do is make that revision, the public version, the one that's 100% available. And to do that, we just go back into revision management and we can do kind of a blue-green deployment if we want to within here. We can specify, I won't say 80% of traffic to go into one and then eventually switch over the version completely. All right, so what I could do if I wanted to is I could say 80% here to this new version and 20% to the old version or vice versa. But in this case, I'm just gonna go 100 here, zero here and I can keep this active so that if I wanna revert back to it, I can. But I'm just gonna save and now the public traffic is going to start going to our latest built version because I've moved my revision there. And so it'll go through the process of reloading the image and there you go, Hello World from Jay. That's the CICD process, start to finish to create within Azure Container Apps. And so that's everything today that I wanted to show you Azure Container Apps using CICD deployments. There is a ton of docs that you can go through in the bottom of this video, in the show notes. And if you have other questions, you can go to me on Twitter, you can see it's right there, right there at JayDestro, go on there, reach out to me on Twitter. We will be back again on Thursday, Thursday from 11 a.m. Pacific, 2 a.m. Eastern till noon slash three, it's an hour long. I'm gonna be working with Rod Trent, who's gonna be talking to me about Azure Sentinel. So if you've watched this as a reported version, keep your look out on my GitHub, or I should say in my YouTube, you'll be able to watch that version that's coming up. Or if you're lucky enough to be watching live, you can watch it live. So just as a reminder, you can find me on Twitch slash Azure FunBytes. You can also get $200 in credit. If you don't already have an Azure account, go to cda.ms slash 219. And that's really about it today. I really appreciate you all sticking around and being part of this demo. I thought this was a lot of fun. There's a bunch of you watching it and I really appreciate it. I will see you next time. Thank you so much for watching and you have a great rest of your day. I hope your deploy goes great and your code compiles properly. Take care. Bye bye.