Starting from scratch with Azure
I want to say thank you guys for being here, for being open-minded and honestly being awesome engineers. We’ve been talking about this for a little while now. We work on something called quark.
It’s a streamer platform designed to help streamers. The idea is that it has a bunch of different utilities built into it. Things like bot services, the ability to send our go live versification, do scheduling, all these other things. As we’ve grown as a stream, quark has grown with us. The interesting thing about quark up until literally now has been it’s been hosted in my garage.
We’re moving to the Cloud. We finally were able to work and pick a provider we wanted to go with. We are going to be doing a 5-6 episode series. We’re not doing one video. This isn’t just one sponsored stream. We’re literally partnering with this company to take our platform and put it on theirs.
Secondly, we are going to be refactoring, quark heavily. Another thing, we are going to be replacing everything that exists now, basically as a Cloud service. I want to see how far I can go with not having to manage the infrastructure as I can. Let’s talk about Azure for a second. They don’t have everything yet, but they’re growing, which is really interesting.
When I looked at Azure, I was like, there’s some cool stuff here that’s really neat. This could solve some of our problems. It seemed to really solve a lot of the problems that I needed. Azure is actually getting a lot of traction right now. They’re building really good software. They’re building really good options.
In all honesty, I told you guys a little earlier than I did actually investigate Azure and that’s because I did. After all that being said, let’s go ahead and let’s get started. When you land on that link, you’re going to get sent to a page like this. Obviously, you do get the $200 credit as well.
That happens from the day that you start. You can see here there’s a bunch of different stuff that you can do. All that stuff blah, blah, blah. This is the part I wanted to talk to you guys about. This is the free stuff. Free stuff’s dope. Linux virtual machines. You get 750 hours of a B1S Standard tier.
You have a $200 credit right now that you could just mess around with and be completely fine with not getting charged for anything. You have a month to figure out what you like. Sixty-four gigabytes times 2. This is something outside of your normal disks. Let’s be clear on that. These are high performance disk.
These are database disks and stuff like that. You don’t really have to be super worried about this one in particular, because the Linux virtual machines that’s going to basically cover that one. Anyway, once you sign up, you get directed directly into your portal. I’m going to go ahead and send us to there now.
I’m already signed in and boom, I’m now in my portal. Now, you’re going to see here we have a ton of other things. That is because I’ve already started setting up some things, just some things. You’re probably just going to see this. It’s probably going to say something like Azure Subscription 1, I think it’s what it’s called.
First and foremost to know, you can change that name, but the more bigger thing is you can actually have multiple subscriptions, which is really cool. If we look at this for a second, you’ll actually see that if I wanted to, I could come in here and create a new subscription and immediately have access to it.
What does this mean? This means that I could have five different credit cards in here, and automatically start provisioning my resources to these specific credit card. It’s got the granularity to where I can literally tell it, I want this instance in this subscription, but then I want this instance in this subscription, and so forth and so on.
That’s actually really powerful when you think about it from maintaining Cloud infrastructure, because most companies make billing actually really difficult. That’s one of the reasons why they make their money. Now as you can see here, our subscription is ALT F4 LLC because that’s our company.
I have my owner role and then in it I’ve got $0.16 right now. I’ve got $0.16 that I’ve used and that’s really it. If I click on this, what you’re going to see is a complete breakdown of the subscriptions here. You can see immediately, I can cancel a subscription if I want to. I can rename it.
You can immediately see that they’re already giving me a nice breakdown of basically my pricing. If we talk about just like a plain and simple like wanting to be able to see your billing, wanting to be able to manage your billing, all that stuff, I genuinely really like how they set up their subscription methods.
My goal with you guys is I want to show you guys how to set this up on everything. We’re going to go through PowerShell, we’ll go through Linux, we’ll go through Windows. Cool. I just signed up for Azure. I’m on the platform. Well, what do I do now? The first question I had to ask myself is literally the question that Vtcn asked, which is how do I connect to Azure? I understand that I have the portal, but I’m an engineer.
With a little bit of searching, we can actually do Azure CLI. They have availability for Windows, Mac OS, Linux, and then actually Docker, and then their Azure Cloud Shell. Let’s talk about them a little bit. Say you’re on Windows. Remember that this is Microsoft. Microsoft makes Windows. PowerShell has a plug-in for the CLI.
Here it is. Install Azure PowerShell. Basically, if you don’t want to have to install their CLI and you are a PowerShell user, what you can do is you can actually get the Azure module that has all of that built into it. You can start using PowerShell to setting that up. This is a little bit more lower level from the normal CLI.
If you are somebody who uses PowerShell and you want to automate things with PowerShell and stuff like that, then you can do that. Let’s go ahead and let’s set up this CLI on Windows first. I’m just going to click download the latest release, it asked me to save the file, I’m going to click “Yes”, click this.
It’s an executable. Yes, that’s fine. I’m going to accept, install. It asked me, and we’re going to go through the process. I like the fact that this is very simple. Let’s gives this a few more seconds here. Then as you notice, it basically says that once you’ve got it installed, we’re going to run az login.
I’m going to go ahead and open up my PowerShell now. There we go. Now I’m in my PowerShell. Let me go ahead and move this right here, and let’s do az login. I’m going to do that and that should trigger my email. I’m going to click on this. You have logged in. Perfect. I’m logged in.
There you go. You can see I’ve got my tenant, my ID, my tenant ID, and everything else I need. Now at this point, I am logged in with Azure. I’m good to go, and this response right here basically tells me that I’m signed in. At this point, I should be able to do things like az help. There we go, I can see all of my Azure commands here.
Let’s see if I can pull a resource group. Let’s just do az resource groups. I’m not even trying to read the command line right now. I’m just like, I want to find resource groups and I’m just throwing commands at it here. I don’t even know what the command is, but it says, “Hey, did you mean ‘resource’? Try this: Azure resource list.
” Let’s try that. Resource list. Well, look at this. This is literally every one of my resources. That’s actually pretty dope. I could do a bunch of really neat things with this resource group. For example, if I clicked on “Cost analysis”, I could see that right now in just this resource group, I have accumulated about $0.
16 and we can see the service name in particular is Azure DNS. Now, this Resource Group only has Azure DNS for it, which is fine because it’s a resource group for all my domains, but you can see here, not only that, but I can see it telling me what is being used. Unfortunately, it’s hard to see because of my camera and stuff.
I’ll move this over here for you. If we scroll down, you’ll even see that it gives you the ability of seeing per resource what you’re charging. Let’s talk about this again. We’re are not even building infrastructure yet, and we’re already getting like really cool stuff out of this, which I really like.
If you think about it from an Amazon perspective, this would be ridiculously hard to do. It’s not easy to manage and look at a specific resource cost analysis or a group of resources in Amazon, without basically having to go through a bunch of filters and doing a bunch of different tagging. You have to do it yourself really to do it the right way.
Instead of having to go into a high level explore of my subscription even and being like, what’s the breakdown for my whole subscription? I can go to the resource group itself and cost analysis it, I can do alerts off of it, I can do budgets, and a bunch of other things like deployments and a bunch of other things.
That is really powerful. We’re not even talking about infrastructure, we’re just talking about how it’s maintained. Let’s talk about a little bit now how we can do some more with the CLI. Again, if I do, Azure group list, on PowerShell, I can see that I’ve got that. If I do azure, let’s go back to help.
Lets do az vm list. Same thing. Very straightforward, very reproducible, very simple. Interesting. Azure Search. You can search services. What if we did search and then we did Kubernetes sub-command. What else we got? Interesting. This will give us a list of what? Resource group. Interesting. That’s dope.
I did not know what that did, but now I understand what it does and that’s actually pretty cool. What this allows you to do is basically search within your own resources for a specific thing. Say for example, I was like, what is the ID of that one domain I needed? I’m wondering if I just do altf4 email, then I should be able to search for it.
Let’s do az search and then Help. Search Azure services, admin keys and query keys. I wonder what services are. I’m curious. I’m going go down this road down for a second here if you guys will follow me because I’m curious on what this does. Never mind, I’m wrong. Let me reset. This is a service.
Let’s go take a look at this really quickly. Search. It’s an actual service. I did not know that that was a service. Okay. If you want to add search into it, you can. I thought that was something else. It’s not. Let’s keep moving on. The Linux one is a little bit interesting. I know a lot of us out here are Linux users, so I do want to go over this one really quickly.
I use Arch Linux. Right? If you look here, we’ve got Debian, Rhel, Zypper and install script, but we have no Arch on here. You might ask yourselves, well, hey, BG, how did you get it installed? I actually did the good old fashion way, which is I just did Arch Linux, Azure. If you search that, you will see that there is an AUR repository or a yay repository basically that you can install it with.
If I go here and then I go here, I should be able to do this. Sure enough, you can see that if you use yay-S Azure CLI, you can install it on Arch as well. For anyone who’s using Arch or anything like that or using yay, you can easily use a package manager like that to install it. If not, you can use the package managers that they have as well.
Yeah, you can see here that now I have the Azure CLI being installed. If you have Debian, very simple, just install it via the package manager. Same thing for RHEL, openSUSE, all that good stuff. But at the end of the day, if you can’t install it through anything, they still give you the install-script here.
You can see here that it is recommended to install package manager but if you can’t, run the script. At the end of the day, no matter where you install this, your goal is to essentially always get to that az login stage. Let’s move forward. We’ve got our CLI installed now, but what about the SDK? Say for example, I wanted to start, I don’t know, doing some stuff with Azure, how difficult would it be to me? What is their SDK support like? Let’s go ahead and look at that really quickly.
A lot of Cloud providers basically give SDKs. Let’s go ahead and go to that right now. Let’s say get the SDK, we’ll click on that. Here we go. This page contains all links to SDK library packages. Basically, it looks like their libraries are split up into a bunch of different modules. What we need to do now is we need to pick what we want to interface with.
What I’m going to do now is that I’m going to just click on “NPM”. Azure Storage Blob is Microsoft’s object storage solution for the Cloud. Let’s do this. Let’s go to cd Desktop. Say mkdir azure-sdk-test, cd azure sdk-test touch index.js. Awesome. I’m going to open up my Neovim.
I’m going to grab this. I’m going to say npm init, do all that. Yes. Then I’m going to do npm install –save. Again, many of us have probably done this at least once or twice before where we’ve installed some type of Cloud SDK to upload files to the Cloud. Environment for the setup. We’ve got default Azure credential, we’ve got Blob service account.
Import the package. We’ll do that. Lets do this. It’s mv index.js to index.ts. It seems like there, I actually wanted to use TypeScript. We’re going to have to get the Azure identity package. Let’s go ahead and add that one, which honestly it’s pretty standard. Normally, these would be separated into their own packages, so that’s really not that big of a deal.
Let’s do this, add this here like this. We would need to create a storage account. Let’s just go ahead and do that really quickly. We can, no big deal. Go to portal. Their object storage name is storage accounts. I’m going to click on storage accounts. Boom. Okay. Cool. Pretty straightforward, pretty easy.
I’m sitting here and I’m looking at a list of storage accounts, so let’s create one. Yeah, you can see my subscription that I’m adding it to; my resource group, my location, a name, all that stuff, all good to go. Let’s hit “Create”. When you create something in the portal, you actually get sent to this neat little like deployment page.
But now you can see, boom, it’s done. Go to resource and we can see here now here is my test account, basically. Let’s go ahead and go back here. Now that we’ve created that, let’s say our account in this case was, what I call, altf4test. Blob service client, what are you doing, copy.
There we go. At this point, I have a service client and I’m passing it my default Azure credentials and I’m doing altf4test.Blob.core.windows.net. We’re good with that. I’m not going to worry about any of this other stuff. We’re going to go down, async function, main. Look at you guys creating main functions, that’s cute.
All right. We’ll say const containerName equals and we’ll call this mysweetcontainer. Const containerClient equals blobServiceClient getContainerClient and then containerName. Okay. Then we’re going to create the actual container itself. Will say const, create, ContainerResponse equals containerClient.
But if I run this, I’m thinking we should see a container appear in here. Let’s go ahead and do this and we will do ts-node, node index.js, wait index.js. All right, so if I click refresh, my sweet container, look at that. Let’s actually utilize that. I’m going to go in here, see StreamTest, say I want to be done with all this.
Click on it, delete resource group, if you look here, you’ll see that it says, hey, warning, you’re going to delete it and here’s all the resources inside of it. If you want to, you better put in the name of the resource group. I’m going to type in streamtest, hit delete. Right as I do that, it’s immediately going to start deleting the resource group.
Let’s take a look at a little bit more like the dashboard. Portal, I like it. I liked that they went for cleanliness. I liked that they went for ease of user. I also like that they’re really focusing on training as well, trying to get people on the platform comfortable with the platform and stuff like that.
Yeah. Again, for somebody like me who’s coming from another platform I liked the fact that I could be like, okay, show me your networking options. Show me your container options, right? There’s my container option. I like that, that’s very relatable and nice. I like that a lot. Let’s talk about something that we all use a lot which is Terraform Azure.
I’ve already set this up. I’ve already done this, but we can go ahead and go through it again. What you need to do is you need to follow a couple of steps. You can configure Terraform using the Cloud Shell. You can actually do Terraform in the Cloud Shell if you want to. You can do it in the Cloud Shell.
Or if you want, you can do it via a VS code configuration or a VS Code extension or PowerShell or in a Linux VM. All you need to do is you just really need to access it via the Azure CLI because that is exactly what Terraform uses. We’re going to go in here and we’re going to take a look at their example.
Create a base Terraform configuration file. Now, here it basically just says, hey, you give the terraform provider, the Azure provider, and then you start doing whatever you want. Let’s go ahead and do that. I’m going to say touch main.tf. Now remember, I’ve already authenticated with my CLI, I should not need to do any of that.
I’m just going to copy this whole block here. Again, all I’ve done is authenticated with my CLI. If we talk about every step that was required, signed up, I installed the CLI, basically got it running. We’re going to call this super awesome group. We’re not going to worry about a location, we’re just going to call it that.
The name for the module in this will just be super awesome group. After doing az login and doing my login, I’m going to do Terraform in it because we need to initialize Terraform first. Now I’m going to do Terraform plan. There we go. Then now if I wanted to do apply, yes. Done. For every DevOps engineer out here or out there who deals with Terraform, it’s the same thing.
Login into the Cloud provider, get your access credentials, start running Terraform. Again, say I want to get rid of this now, we’re going to delete the resource. We’re going do terraform plan and you’ll see it’s going to be destroyed. We’ll do apply. Yes. Really quickly before that gets deleted, let’s just refresh.
There’s my super awesome group, but you can see it’s being destroyed now. There we go. Cool. It’s deleted. Now I hit refresh. There it goes. Perfect. We’ve officially set up our CLI, initialize Terraform, done up a basic resource group, apply that resource group and then remove that resource group.
Pretty much no problem. Though I actually have been really curious about Azure DevOps for a while now. Creating Azure DevOps organization. Cool. We can get into actually doing some stuff there. Go to dev.Azure.com, click the “Start Free” button, sign in, create an organization. We’re going to go here and going to say, okay, so get started with Azure DevOps, project name, continue Azure DevOps organization.
Cool. Now I can create a bunch of other stuff. The project name for this one, we’ll call it Quirk because this is the quirk one and it can be public or it could be private. Then the version control you can have Git or you can have Team Foundation Version Control. We’re going to use Git because that’s what we use.
The work process is basic Agile, CMMI, and Scrum. Agile, and we’re going to create our project. Let’s go ahead and click on quirk. Here we are. We’re in our project, our Quirk Project, it’s actually pretty nice. I like the user interface, so those are dashboards you can create. Then there’s Wiki too.
Oh dang, that’s pretty nice. All right, so let’s go to boards. New item. What should be our first item? Create migration plan. If I click on that, we can see that it’s unassigned. I can assign it to myself if I want to and it’s in the state new. It’s unassigned, no comments. It’s under quirk, iteration one.
Instead of creating a migration plan, what I’d rather do is let’s go ahead and actually add something that we’re going to need here. Change type task, that’s what we want. Let’s make it a task, boom, task one, create migration plan. We’ll say create repositories. We will save this, we will assign this to me.
We have our first task, it’s an iteration one and the priority on this bad boy is four, it is the highest priority. We got to get this thing done. This is going to be development. Then in here in the description we’ll say we need to create the quirk service repositories for the following services; discordbot, discordbot_command, encoder, mailer, portal.
This is a library, twitch_eventsub_event, twitch_eventsub_subscription, twitch irc, twitch pubsub,twitchbot_command, twitchbot_event, twitchbot_pubsub, website. Finally, websocket. Now, if I go to boards and then I go to Features, there it is. You can see here it create repositories. If I click on this, we can see the children of that.
Let’s go back to here really quickly. We’ve got boards, backlogs. Let’s go to Repos really fast. Remember, we need to create repos. Quirk is empty, add some code. Let’s go back to repos. Oh, here we go. New repository. We’ll call this one api, Add read me, gitignore. That’s cool.
Your repository will be initialized on a main branch. Okay. We’re going to create a repository and it’s going to be called that, so create. Repository creation in progress. Okay, cool. We got a read me, go ahead and close this a little bit. We got that. We just did that. Now what I can do is I can go back to boards and here’s where we’ve got create repositories, Api repository.
Click on that. We will need to create the API repository or service. Now what I’m going to do is I’m going to go back to repos really quick and then I’m just going to copy this. Then I’m going to go back to Boards, API repository. Then I’m just going to come in here and I’m going to say created new repository and then hit “Enter” and our work is now been completed.
Now if I go back to boards, our boards, state one out of three. API repository is checked off. We will definitely do more with Azure DevOps, there’s a lot here. It’s definitely very interesting.
Source Link: https://www.youtube.com/watch?v=RutOnwt_vLI