SIMPLE HACK to change your Azure Cloud Shell life for the BETTER!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay guys I know that's click baity title but if you have clicked on this I promise you give me a couple of minutes this will improve your life with Cloud [Music] shell okay so in po shell land I've got a bit of code here and I want to point out a setting so I've got a function called test file existence here and all this thing is going to do is check if a file actually exists and if it does it should say file found path or file not found path but there is a thing here that is a little bit different in this code and that's this line here for write verbos um so let's see what happens when we run this I have a directory that's got some files in it some files like file one file two and so on so forth if I go and run this block of code here just to run this test file existence and then actually just look for file 1.txt and file file a I know that file one does exist but file a does not exist but let's go and run this in fact let's go and run this first without the verbo switch you'll notice I get nothing I get no output you get nothing because these outputs have been specified as right verose if I go and throw on the verose switch now at the end of it what happens is I actually get an output essentially is actually writing these lines this is a common Trope inside shell and it's a very common Trope that you find inside Azure which is kind of not suppressing just errors but actually suppressing output let me show you something in Azure a few moments later so I'm over here on my Azure portal and what I'm going to do is create myself a new Resource Group just to do this test and just to show you something so let's go into Resource Group here I'll do it manually we'll call it temp we'll leave it in East us we will hit create great okay now I want to go to GitHub so here in my GitHub I have my a104 repository this is what I use to teach some A14 classes I'm just going to grab the uh the S the hdps link here for it and I'm going to drop into the cloud shell I'm going to pull this down because you can do git clone and pop that inside there just to pull this into my cloud shell there's some stuff that I want to go and grab from inside here more specifically an arm template okay so we just go into that path of that git repository and inside here I have some templates and inside these templates I've got some templates that I use for demos now there's one here called VM custom script which is perfectly fine cdbm custom script LS that we've got an Azure deploy Json if you've seen some of my videos before if we just run code we can see inside here this arm template has actually got a deployment for a virtual machine in it that's cool let's go and close this down this is not the point the point here is what happens when I deploy this thing so I'm just going to run new a resource Group deployment here and I'm just going to oops not do Dash file we need Dash template file to start deploying this it's going to deploy to the resource Group name of Temp and we're going to deploy an admin username of Mike admin and a password over here 1 2 3 4 and a DNS label prefix of uh I don't know test VM okay that'll be perfectly fine at the moment now here's the issue look at what's happening here okay right there I'm deploying an armed template this could take a long time to actually deploy and I can see nothing my shell is locked up at the moment now I could run this as a background job and there is a video on scheduled tasks that I've done so go check that one out but what we actually want to see is some kind of output going on here now let's try that process again but slightly different so let's make another Resource Group I'll call this temp two inside here I'll hit review and create and I'll hit create now what I'm going to do is in my cloud shell I'm going to add a slightly special switch to the whole the whole thing here so before I run any command if I go and just pop this in dash verbos preference equals continue what this is going to do is going to turn on that for both functionality not just for one command but this entire session okay so let's try and rerun this process again let's do new AC Resource Group deployment with thej deployed. Json Resource Group name is temp 2 admin username is Mike admin uh password is that and we'll set the DNS label prefix as temp mik VM test and we'll go and run this now what we should have is check this out we've got this verbos outut but actually coming through we can see exactly what this thing is actually doing so it's looking at the template is valid checking the template deployment status it's provisioning these IP addresses it's working and crunching through all of this process so I can actually see some output I can see something that's actually happening when I'm doing something like an arm template deployment way way way nicer here just so that we know something is actually crunching and working along now we could see the same sort of stuff if we and click the Bell icon up here and we have a look at the events in the activity log we could also see this by actually looking at the uh Resource Group itself but it's nice to know that our shell hasn't actually crashed and is actually doing something now if you close your Cloud Shell at this point and open it again you'll need to add in that same verbos preference equals continue for the session uh for it to be turned on for the next session as well we could also use this for individual command s- verose but just remember this not all commands have verose output because the verose output if we look here has to be written into the code of the command you're actually using normally if it's a nice Microsoft command and it's something that you've got like new- a resource Group deployment then yes that will normally have that built into it but if you're using random scripts you find on the internet they might not be as tidy you might not have the Bose output so this works for most of the things you're going to do but just bear in mind that it won't work for absolutely everything but it should improve your life here with Powershell and that's how you improve your life with Powershell Cloud shell and actually see some outputs for what you're doing and you know the routine # like And subscribe and I hope you enjoyed this video and we'll join me next time goodbye
Info
Channel: Mike in the Cloud
Views: 283
Rating: undefined out of 5
Keywords:
Id: 2H2Qki65hT0
Channel Id: undefined
Length: 7min 25sec (445 seconds)
Published: Fri Feb 23 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.