>> One thing that Ithought was interesting here was going back tocleaning up resources.
If I look back at myresource group here, you'll find I will do a lot ofthings like start something, sometimes I'll put a test, or here's another example, I hope you-all can see that, but it's called “deleteMe.
” This was one where I wasjust playing around.
This one is taking acouple of runbooks, and then there's anautomation account.
So it really isn't costing me very much money to run this resource, but let's just say that Idid this before, sorry.
I spun up one of these Azure, how is that pronounced? Hadoop? >> Hadoop.
>> Hadoop? >> Yeah.
>> I've spun up one of these fora research that I was looking at, and I left it running for two days.
Really, it was two days, and I was like, “Oh, crap.
I left that running.
” I had ran up a veryexpensive dual for two days.
So that is where I got into the point of always cleaning upthese resource groups.
I detailed this a coupleof different ways.
One of the things that I'mstarting to do is that, whenever I spin up one ofthese resource groups, there is this optionhere, that is “Tags.
” You can just think of these askey-value pairs of information.
For example, if you are goingto take a resource group, and let's say you've gottwo billing departments.
You've got your [inaudible]Tech Billing Department, and then you've got, let'sjust pretend there's an Accounting Team's Department.
Sometimes you may wantto split out the cost, and you want to say, “We will tag this oneto be for accounting.
This one will be for tech.
” People use these tags fora ton of different things.
I've done a coupleof tips and tricks, here's some examplesof what to use when.
One of the things that I foundthat was important here, and I do have an article that I'll probably bringup in just a second, but I would do something like here, inside of the “Name, ” I woulduse something like “expires.
” So I just start typing”ex, ” and so you can see this is oneof the default names, so it's “expiresOn” because a lot of people have been buildingadd-ons for this, and so with the “expiresOn”, there is typically a format, and so if I knew I'm only goingto need it for a day or two, then I would come in here and Iwould do something like “2020-04”, say I need it for these dates.
Then I could come over and Icould hit this “Save” button, and then once I hit “Save”down here at the bottom, we got this “expiresOn.
” Then from there, obviously I've got this one tag, everything is great, but then we need a way to automate that cleanup becauseeven tweets and stuff, I always forget, butI know if I automate, then I won't forget.
So there was a coupleof ways to do this, and so I usually post some of the things that I learnover on the “dev.
So this was a post that I made.
This was early March ofthis year, actually.
Again, it's more along thelines of I put this together because this issomething that I wanted, and so I'll show you a very quick version of whatI was thinking of doing, and then I'll show youa couple of other ones, and then I'll also give abig shout out here to yet another Cloud DeveloperAdvocate, Frank Boucher.
So inside of mine, I do the same thing, where I set tags.
I use this “expireOn”.
So one of the things that Iused was I used a PowerShell.
So I had Taylor from thePowerShell team on last week.
Anyway, he knows I enjoyworking with PowerShell, and I found this scriptwas already created.
So this script, here'sthe connection name, and we'll go into Azure Automation, which is what I was using for this.
There's many other ways to do that.
But long story short, it connects up to my account, and then from there, if it's not there, then it gives [inaudible]out an exception message.
But then where it actually startsto do the magic is right here, where it searches throughAzGraph or where the date, the time is tags.
expireOn, and then does a comparison betweenthe current date and then it runs “Azure-AZResource, ” andso if you work with the CLR, you work with other automation waves, it's fairly easy to go in and use PowerShell or usewhatever you want.
Azure CLR, your various languages, and then it willdelete that resource.
A couple of the otherthings that's in here is, that I've used personally, Azure Automation.
I found Azure Automationgives you, I think, up to 100 runs per monthfor completely free, and that for my use, again, in this instance, I'm justan individual using it, so it'd be totally differentif you've got a bowl of 1, 000 people maybe inyour subscription ID, but I set up an AzureAutomation account, and then down in here, you couldstart using things like runbooks.
So with runbooks and PowerShell, they link into it.
I set it to create a scheduleand the start date of 07:00 AM, and then to recur every one day, and then I actually had arunbook that was completed.
This using runbook and PowerShell, I can clean this up everysingle day.
It's not in here.
I thought there was a comment, and then somewhere else, somebody asked me about the cost of Azure Automation becauseI thought it was funny.
So you're trying to save money, yet we're spinning out new resources, and so Frank, shoutout to Frank there, he also has put together something that I found extremelyuseful as well, and that is he also automatically deletes the useless resourcesin your subscription group.
So in this project, Frank is using Azure Functions.
He also has this really nice”Deploy to Azure” button, where this is in the “Serverless Library, ” and so youcan click on this and you can deploy it veryquickly to where you're at.
So his solution waswith Azure Functions, and then this is the solutionthat I had with Azure Automation.
So you can go into this, but what this does is by default it gets triggeredevery morning at 05:00 AM and it searches for theseresources with expireOn, which I'm really thankful thatthe team has went ahead and put that as a tag where you don't have toeven type that in anymore.
It's just there as you start.
Once all the expiredresources are deleted, it searches for the emptyresource groups as well.
Now, I've never done a comparison on the charge for anempty resource group, so that could be interestingif there is that.
There's a couple ofinformation here in regards to the same name, the value.
This is a variation ofa PowerShell script.
But I did want to at least mentionthis option as well because with Azure Functions you also get a certain amount ofcompute time per month.
But that's just another way.
What would be interesting, in my opinion, would be to run both ofthese for a month or two, and see that the Azure Automation with runbooks or the Azure Functions, which one costs the most money.
I still think thatwould be [inaudible].
It's fine, I was just was lookingat the picture.
He looks really trainedon that picture, and I don't know if heis really that trained, but on that one, helooks really worked out.
You're actually right.
The wholeAzure Automation part, and again, as you said, the question thatgets how much does it cost? As you said, the first couple ofminutes every month for free, and so you don't end up in a huge amount of cost if youuse Azure Automation at all.
I like it as well.
I use it in my subscriptionsto do similar things, and I think for a long time, it was basically the only way alsoto automate shutdowns of VMs.
I think nowadays this is anative feature in Azure, but for a long time, we had these shutdown runbooks, which basically went out andshut down the resources, and then also next day probably started the Resources automatically.
>> Yeah, exactly.
I've beenin a lot of different worlds.
I've been a Linux user fora long time, a Mac user, and I actually worked onWindows and was one of the people that got the Ship Itawards for shipping Windows 10, but I still love my Bash, and I know you can getWSL and everything, I've been using it in mystream too for Windows, but I just love thosetypes of environments.
So what I did before allof that functionality existed was that I created aCRON job on all my Linux VM in Azure to shut down itself every day at a certaintime in order to do that, and now you can do that automatically in serial on access and more.
I run a PowerShell AzureFunction collecting my weather data every five minutesand it cost five bucks a month.
Wow, that's amazing.
That's really a nice thing.
I didn't even know because Idid not have a clue with that.
So I run a few of those, I mean, not in my account.
I've got a bunch ofdifferent functions.
It's running this wayfor a period of time.
[MUSIC] >> I believe we're just aboutout of time for the day today.