Getting Started with Azure PowerShell

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Thank you so much John, the introduction and history lessons were extremely helpful to fully grasp what is going on

👍︎︎ 2 👤︎︎ u/dizam 📅︎︎ Jan 19 2021 🗫︎ replies

Awesome stuff! Great production and really thorough explanations. Thanks!

👍︎︎ 2 👤︎︎ u/sjosi 📅︎︎ Jan 20 2021 🗫︎ replies
Captions
hey everyone in this video i want to just provide a getting started with the azure powershell i'm not going to go into specific commands for specific functions there's great documentation around each command my focus is more around well how do i get started using it and the authentication authentication and maybe automation scenarios and really where this has come from and when should i be using it so if i think about well we have azure and really we're in kind of the v2 of azure because we have the azure resource manager arm there was the asm the azure service manager before as kind of old decrepit we don't really want to touch that anymore so the azure resource manager and the primary interface to that is there's actually kind of this restful api so there's a rest api now that api i may use if i was writing an application and when it interface with azure but for most of what we're going to do we don't want to directly hook into the restful api now if there's brand new functionality in azure sometimes it may only be available by the rest api so we may need to actually directly interact with it and i can do that through things like powershell but more often we're going to deal with something else that then talks to that restful api now when we get started with azure often we think about well there's the portal and of course the portal fundamentally is talking to the restful api and getting results back that's the portal.azure.com then i can think about various kind of command line interfaces this could be for real-time interaction it could be i want to script things to automate so this could be things like the azure cli and also the az powershell module so we have kind of two options there and they're really functionally equivalent and then of course we have templates and with templates we think about well we have this json based arm template there may also be things like terraform we have things like bicep now and bicep actually kind of compiles down to a json arm template and if we look at all of these different kind of options they're all talking to that restful api now the portal is great for kind of learning it's good to kind of see what's going on but i really should not be creating things in there the cli well that's great for kind of automation stopping starting things like that but once again i don't really think about creating things templates are great for provisioning and changing configuration and the reason we say this is i can all totally create things with cli with powershell but it's not declarative it's not item potent i.e i'm telling it how to do something not what i want the end state to be so if you want to change the configuration i can't just rerun the script i have to use different commands to check is it there already what's a command to change something whereas these templates i can just rerun them as many times as i want if it matches the end state i don't have to do anything if i change the template it will make it so and there's absolute kind of links between these things so from the portal for example well it can call azure powershell through things like azure automation through azure functions so you can actually kind of see they have a link so like from the portal hey i can do this with automation with functions from an arm template i can call powershell this could be within a vm using the custom script extension and then if it's outside the vm the last mile configuration i can use deployment scripts arm templates well we have template specs in the portal to represent arms so there's this whole link between them but they all have their strong points the portal great to get this intuitive view of what's there maybe look at monitoring data the cli is great for automation maybe forming some management tasks templates for provisioning maybe modifying the configuration so they all have their place obviously our focus today is on kind of this azure powershell i did want to kind of just stress the point of where it's all kind of coming from now when we think about the power shell and the same actually for the cli it is cross platform now i'm going to really focus on powershell 7 plus so before there was windows powershell which went up to version 5 and then powershell core which was version they've really merged together with version seven it's not called powershell core seven it's just powershell seven but it is built on the core version now this is cross plat so obviously i have windows we have linux and we have kind of mac os so i'm going to recommend powershell 7 and i'm going to recommend visual studio code as kind of that editing experience and once again these windows linux mac os this cross platform actually applies to both of them and the azure cli that also is when um windows linux mac os the both of them across platform so don't have to pick one over the other because of the platform they're both cross-plat so i'm going to focus on this powershell 7 vs code now with powershell functionality is provided with modules and it's actually been kind of this evolution of the azure powershot modules so it started off we can kind of think about well there was azure so we had the azure module now remember this was in the old days of kind of the azure service manager well then the azure resource manager came along and what they initially did is they actually set this up so you had this switch azure mode so i would change between asm and arm and that was really not very friendly it was not a pleasant thing we wanted to do and then what they introduced was kind of this azure powershell 1.0 where they split the functionality so azure became asm for the arm we had azure r m so you can always think about when power shell is always the least cognitive distance what do i want to do that's going to be the command and you have this verb noun so i could think about with the azure commands it was kind of verb dash azure now that's how it was structured so i could say something like well get azure vm whereas on the arm it simply added rm to the commands so we had this kind of verb dash azure rm noun so now we could have well get azure rm vm so that's how that would kind of map across and then they've evolved it still so that was kind of the azure module the azure rm module and what we actually have now is the a z module now this is only r so now we think about well it's it's verb dash a z clearer now i e get a z vm if you're already using azure rm um there's actually kind of two different things uh we can actually do so the ideal one is there's a tools migration az.tools.migration that will convert your scripts that use azure rm to start using az so that's kind of going this way we have kind of the tools if i don't want to change my scripts today there's actually a way that it creates aliases for all the az commands to azure rm sure scripts will kind of just carry on working there's actually a kind of an enable alias option we are going to focus on this so it's only as your resource manager it's this az module i wanted to kind of understand the history of where it's come from if you ever see azure rm the chances are you can just change it to just a z using the new az module but that's that's what we're going to do so what we'll actually do now is jump over to the environment and actually see some of these things in action so obviously i'm using vs code now i've got like a sample script i've put together here uh in the link in the description the video you can go and get this from my random stuff github repo so if we look at this there's different ways to actually get the powershell module now the easiest is with powershell get this is built in and we can see here if i do look sort of a get command what's in the powershell get module there's all these various commands available to me but there's things like um find is available find module you can see that down here at the bottom there are things around installing modules you can see that here and that's really what we want to focus on now i can view the repositories that i've been configured to use i what i'm going to search and by default you're going to see kind of the ps gallery the powershell gallery there is also an msi version available now the benefit of the msi version is when i install a new version with the msi it will actually remove the old version because one of the key points is this az module is actually a meta module there's actually underneath it a whole set of az.compute dot network there's a huge number of these so if by default when there's a newer version if i go and just do an update module it doesn't uninstall the old ones so over time i'll end up with a huge number of different versions if i do the msi based installation it will actually remove the previous version and just replace it with the new one so that there is a benefit to the msi but it's not that pleasant to actually use it's fairly an interactive thing so here what we're doing is well we can kind of see what do we have right now so if i run this command there's actually different commands i can use i'm doing a get module on a z and i can see when i'm running 5.2 i could also get installed module and once again i can see my version is 5.2 so i'm going to see that here i can always check what's available what's the newest one so if i do find module what i'll see is there's actually a 5.3 now at this point i would go and uninstall the old one that's how i handle this now if i just do a get module a z notice how many different kind of child modules there's are so you can see there's the main az module then it's dot accounts.advisor.aks these are all part of it and you can see way where they actually get installed so if we scroll up just a little bit we can see mine are installed in this c program files powershell modules the reason for that is when i do my installations i actually install them for all users so it goes to my c program files powershell modules if you don't do that then the default is actually going to install it on the current user and it will install it in the dollar home documents powershell modules which i don't want my documents is part of my onedrive i don't want that synchronized everywhere you can see what your various areas are so if i just look at for example my dollar end ps module path these are all the places powershell goes and looks well here we can see the default kind of the my user path is that first part and then we can see kind of the all users part now i'm a version behind i don't really care but what i would do is if i didn't want to get up-to-date i actually will uninstall all of the old modules so i get a list of them and do an uninstall you have to run this from an elevated powershell so for example if i just typed powershell over here you can see kind of got a power shell i would right click and say run as administrator that's now kind of checking hey do you really want to run this elevated and now get my screen back there we go it's running as administrator so i could run those various commands you have to run it elevated for both the install and kind of the remove i'm not going to do that there it would take too much time but essentially that would uninstall them the other thing you could absolutely do because they're just files if i go and look at that path we'll actually see drag that over this is that folder i could just delete the folders these are the modules i could just go and delete them and then do the install again that's my preferred approach um you can do things like allow clobber but then you're going to end up with multiple versions now microsoft do actually provide this script i've got the link right here with this script it will go and uninstall a particular version or all but the most current version so they do provide ways to clean up the environment if you do find yourself with multiple versions but for me i just go and delete the old ones first and then i do the installation now this is how i do the installation this first command notice i do scope all users so that's going to install it in that c program files powershell modules path instead of my documents folder and i actually installed a whole bunch of them because i do things like the azure resource graph i interact with azure tables a lot i integrate with the microsoft graph ps read lines a kind of nice utility to give me some ai based hints of what's coming along with the azure specifically the az tools predictor the only one you absolutely need is this first one the az module if you did want to do an update you can just run update module az but again then i'm going to end up with multiple versions but you've done that you've opened an elevated window you've installed the azmodule so you now have az on your system i have here the link to the az tools migration so that's the module that i could use to convert my azure rm scripts actually two az based scripts and then the link to the document that tells you the two commands to prepare it and then do the conversion i've also got the command to enable the azure rm aliases for the az module and you see it would go and add aliases for every single child module of a z so that's the first thing you have to do so in terms of using kind of the az step one is install it step two is to essentially i have to authenticate so i do an authent now this might be interactive i i'm sitting there and i want to authenticate it might be i have some automation and it needs to authenticate it might be something running in azure and it wants to authenticate so depending on what i'm doing it's going to impact how i think about that authentication now one of the key things here is we're used to in the past we authenticate we type in a username and password we don't do that anymore what actually happens for this this is all based on tokens so when i do this authentication it's actually using a device code flow i get a token that by default i get a refresh token that's good for 90 days every time i use it it's a rolling 90 days so as long as i keep connecting that token's never going to expire i can close the session i can reconnect close reconnect close i never have to do this again it's going to keep that context and i can keep using it so we have to really authenticate once so it's going to give me that refresh token which by default is that 90 day rolling window so if i'm interactive let's go and have a look at this it's going to use a browser control now so if we just go and look if i do connect a z account and i just run that command you'll notice what it did is it jumped over to the browser it asked me which account i want to authenticate with oh it just arrowed for some reason it's going to localhost let's try that again that's kind of weird i lost internet for a second try that one more time but i actually think it worked so it's saying hey i launched browser but i'll run that one more times hopefully it doesn't do something weird everything but it opens the browser i could select a different account and they go all complete you can now return to the application so i didn't have to do anything now that works great assuming the device that i'm running that command on can open a browser maybe one on a device that can't so the other one we can actually use is this device code flow where it will say hey go to this site and type in this code that will then link back to that session and i can still manually do that so if we go back over and i go back over here you'll notice i have this option of used device authentication what this will do is notice what it's saying go to this web page down here on the bottom microsoft.com device login and then when it prompts you type in this code to authenticate so that could be on a completely different machine if for example this one doesn't have that ability so i could just go to that site what is the code so i could type this in and then it's going to do kind of the same thing again what account you want to use okay yeah john sabotec you're good so that's kind of another way if i can't do the browser interactively i can do it that way that's great for the interactive now notice there are other commands um there's like add easy account there's login az account they're all just aliases to connect az account there's one command now what if i'm not interactive what if i'm actually running this as some kind of automation behind the scenes i can't put in a credential that's when we actually get in we need to create an identity that can be used and what that actually becomes is a service principle and that's an application so i create an application in my azure ad an app registration and that app registration can have a secret and or a certificate so now that at registration i'm going to authenticate as the security principle for that act registration that service principle via whatever i create be it a secret i.e a password or a certificate where there's a public private set so i can think about okay there's my azure id and ordinarily we have users that's what i was just doing fine if i need an automation i'm going to do an app registration so that app has kind of that that secret or certificate and again if it's a certificate i keep the private part i give it kind of the the public this knows how they can guarantee i really have that certificate i really am that person and if we look at the microsoft documentation it actually goes through um how to do that so if i jump over super fast so here i've got this for an app and if we follow that link it does the sign in interactive which i just showed so you create the service principle this new ad service principle and name by default it's going to use a secret if i don't do anything else and that secret will actually get returned into this variable you specify or again you can use a certificate and when you create this if you actually go to your azure ad and look at your app registrations well here you can see for example i created an rbac test app registration it's there as an app registration and then from there i can see if i have kind of certificates i could create a new client secret which i could use to then authenticate with it will never show it to you again once you get that client secret you need to keep it super safe so when i think about okay i have an app that wants to authenticate to powershell i do this at registration and that app registration has that secret i.e a password or it's using cert now the challenge if you go the secret path where do you put the secret i can't put it in my code because it's not very secure i end up publishing it to a github repository and then there's a big problem so if i take this approach then really what we have to do is have some kind of vault now in azure that's azure key vault and i would store that and then my script would reference it but you get a chicken and egg problem how does my code authenticate to the vault to get the secret out how do i do that sir i have to still store that private search somewhere securely but i could have that maybe on the machine that's running that piece of code in an exportable fashion makes it harder to really manipulate the other option is if my app that's running this powershell is actually running in azure so i have some kind of resource it could be a vm it could be an azure function which can run powershell i can have something called a managed identity so then this resource actually has an identity in azure ad and only that resource can make a call out to a special endpoint and it gets the token it doesn't have to do anything else it literally just says hey i'm this resource give me my token and for all of these if it's a user an app a managed identity i can do role-based access control the same way i can give them access to all various resources give them roles nothing really differs there this is all about how i actually do the authentication but if i'm actually an azure resource i can turn on managed identity and then just within there authenticate as that so if we go and look here we can see i've got this command use managed identity now i'm not running in an azure resource so this won't work but if i actually go and look at my portal and let's do something non-boring let's look at azure functions so if i look at azure functions they support managed identity now there's system assigned where it does all the work for me and there's user assigned in this case i'm just going to go ahead and look at savtec azure bingo and what we'll actually see is i have turned on the identity so this now actually has an identity in azure active directory for this function i can do it for vms really anything and it actually does all the work for me it automatically loads in the actual identity when the function starts up if i go and look at app files for the azure function what we'll actually see behind the scenes it has a profile.ps1 file and notice the only thing it does well if there's a secret and the az accounts module is available connect az account identity if it has a managed identity it automatically authenticates you with it so if i'm running something in azure and i want to use powershell and i need to authenticate to azure so i want to do things against azure use managed identity and not having to worry about or where do i put the secret where do i do anything else it just inherently is that identity when i turn that on and now i can go and interact with kind of other azure resources so this is just authenticating so we have these different ways to authenticate interactively as an application using the managed identity if i'm a resource running in azure so that's great or then what do we do so the next actual part is we may have access to more than one subscription so you're going to hear about contexts and i can really think about a context as kind of the authentication the token i'm using and a particular subscription it's kind of that combination of factors so if we jump back over now also i didn't really go into this imagine i have an account but i want to actually get a token against a different tenant imagine my account had actually been made a guest in another azure ad instance so it's been given roles there and actually the token against that other tenant well i can actually just pass the tenant name so i can just very easily do hey connect az account dash tenant and then whatever that might be saviletech.com whatever that is and as i mentioned before once i've done that authentication i now have that that token you saw me close this visual studio code and then reopen it i don't i never have to re-authenticate again as long as i'm using this at least once every 90 days that rolling window is going to carry on and i stay authenticated so while you might think oh this is a little bit of a pain in the neck have to do this weird authentication thing well a it's not really a pain in the neck anymore with this new browser control it was a bit of a pain in the neck with the device code but even then i typically do it once and then i kind of stay authenticated so the next thing i now have is i have a context so if i look at my context i'm going against my savile tech dev that's the name of my context and it's using my savile tech dev subscription subscription name and it's going against kind of the azure cloud now there are different clouds if you actually do for example get a z environment you actually see there's different clouds there's the regular commercial cloud produces azure cloud then there's one for china there's one for germany and there's u.s government government chances are you're using azure cloud but that's part of your context as well but you might have multiple contexts when i do my authentication my connection it will actually pre-load a bunch of context i think it's the first 25 that actually are available to me as that identity so if i do a get a z context we can see i actually have three now one of them is a different tenant now by default the names are really not that friendly i'm going to show you a little trick in a second because i like to give them short names so i can switch between them very very easily now i can also look at my subscriptions so now i can see the various subscriptions i have against various tenants i could select particular subscriptions but notice it's saying well what context there isn't really a select a z subscription command again get a z subscription i should actually show this here i'll put it in here if i do get alias select a z subscription what do we think that is it's set a z context so set a z context lets me switch between them now if you if you run that get easy context list available these names are not going to be this friendly so what i like to do is i'll run this command to read them all into a variable called context remember you only have to do this once this is cached on the machine as well so i can close reopen it's going to remember this now i could look at the first one and what you're going to do is go through all of them okay so context zero is several tech dev i can look at context one run that command okay sound will take prod the next one okay that's taboo tech lab so i have a bunch of the different ones and then once i know what they are i just rename them element one two whatever your names would be and then you get these much more friendly names like i've got here so i can super easily switch between my dev prod and lab i could even take out the name sabotec i could just have devpod lab and i could jump between them super super easy but we can essentially see hey now i can just jump between them hey i want to select my production i want to select my lab i just type the command there's this get a z context auto save setting so that's what controls when i create these it shows me where it's saving them and then also and you can see like the cache file the cache directory and if it's actually doing this save if it wasn't you can do enable az context auto save oh what did i just do there i hit the wrong key let's get back again enable easy context auto save so now between sessions it's going to keep it i can clear them but i don't want to do that what if remember is this fantastic uh functionality in powershell that says well what would you do if i ran this command not that i actually want to do that but essentially at this point i have got the module i have authenticated and i'm working in whatever context i want whatever subscription where i have the resources i care about that's great on my machine now there's also things like docker images there's a docker image out there that has kind of the the azure module pre-installed now i drew this kind of thing over here that hey i'm working in azure and we talked about the portal and we kind of talked about some interactions between them well the portal actually has this great thing called the cloud shell and that cloud shell can be power shell or bash these are both linux so the cloud shell is always linux it's actually creating a container behind the scenes and i can really select well do i want to focus around using powershell or do i want more of the bash which we think about more as the cli but the great thing about this cloud shell is it has the modules it has the latest azure cli it has the latest az module just there for you also it's going to authenticate you with whatever account i'm currently authenticated to the browser as so if i'm just kind of on some random machine and i want to quickly just get to powershell or the cli and just do some commands quickly well if we jump over to the portal if i go back just to home for a second let's close that down see this little icon up here at the top if i click that you'll see it's opening up my powershell i could also do bash notice it has the azcli available as well so i can absolutely do kind of easy let's see what my version is so i have the az cli as well so this is just really what i want to write things in is it powershell is it the bash but i have access to both of them the azcli and the powershell module if i do get module a z list available and there's that latest azmodule and i can at this point just to get a z resource group format table i don't have to do anything i don't have to authenticate i'm just there i can also just go to shell dot azure.com so if i don't want the rest of the portal i just want to quickly spin up a shell well i can go to shell.azure.com notice i have exactly the same options and i can go nuts i can just do this from within here now the other nice thing this has and i can run this locally as well there are powershell providers if i do a get ps provider these are some of the providers i have available and you'll notice you have this ships one down the bottom you have ships and it's azure now ships is this simple hierarchy in powershell it lets you walk various types of resources as if it was a file system my subscriptions my resource groups my objects so that it's just baked in to this shell so i can actually move to azure so from here i could do cd azure i could do dir and now i can see my subscriptions i could go cd savile tech if i could type dev subscription and dir well now i can see i've got different resource groups so i could go cd resource groups dir there's all my resource groups okay cd rg that oh wrong one i think it's the usa there we go okay so then within here i've got this whole bunch of different things so i could go into microsoft dot storage dir and then i have storage accounts so basically i'm traversing my arm resources as if it was a file system so that's what this ships provider does now i'm going to be honest i don't really use this very much but if you just want to kind of browse around if you're kind of new to this stuff it might be kind of useful to go in but the key point is it's just available to me additionally one of the nice things this has as well imagine i wanted to actually do some editing i can just open up this kind of a special version of code so if i just do code dot this is built on the open source monaco editor if i do code dot it actually opens up kind of like this vs code environment where i could now go and i could see the various files i have i could create new files i could edit them it's just a great little editor in that cloud shell i can hit the kind of three dots here in the top right and then i could close it open other files open a command palette really anything i want to do so it really is this this powerful environment that i can leverage so yes i use powershell most of the time on my local machine but don't forget if i'm ever in some kind of environment and i just have access to a browser and i quickly want to run a couple of commands hey go and open the cloud shell also like the azure app on your phone i can get access to that shell and i quickly do a little bit of powershell or cli to do those things so a little bit i try to make sure you're aware of that kind of cloud shell environment so yes i have all these different things but just remember kind of i do have kind of the cloud shell for that super easy access that brings all those things together and then ultimately do stuff uh you've you've got the module you've authenticated once now you've got that rolling 90 day window if i have multiple subscriptions pick the context i can always switch between them now i just want to do stuff now in terms of well what am i going to do the easiest way to kind of get started is remember azure really is all around that least cognitive distance so i can think about well what is it i want to do and then what would i actually do to solve that so i can do a get command and then i could look at a particular module so let's say az resources and then show me all of the nouns remember they're the types of object and then sort it so i run this command these are all of the nouns either types of resource available in the az.resources module and one of the things i'm going to see here is things like resource group that's obviously one of the big ones first things we ever do and i can see well what are the commands for resource group okay well i can export get them create a new one remove them and set it i could run a command so here i'm doing get a z resource group now i'm using ft and the reason it's complaining is in scripts you shouldn't use kind of shorthand aliases it doesn't like it so one of the things it's kind of saying is hey look you really shouldn't do this stop it that's bad it wants me to replace it with kind of format table like that because it's saying hey ft was an alias don't do those things but now i'm using that so i'm going to look at all my resource groups and then i was saying hey i just want to see the resource group name and the location and then i'm getting that data i could do other things for example now i'm going to change so i'm going to do select a z context i'm going to jump over to my prod that's all i had to do now i'm going to say well let's look at my virtual machines and hey there's all my vms i have now remember regular powershell applies here the pipeline is super powerful in powershell the point of the pipeline is with regular scripting i run a command what i get out is a text string so it really limits what i can do with that with powershell what it outputs are objects so i can pass those objects to another command it can then look at all of the different aspects of the objects the functions with the objects pass it to something else so it lets me have this pipeline to pass those objects down so i can do really complex things in a very very simple command so in this case what i'm actually going to do is i can think about well i want to see if the vm is running so on top of get azvm i add dash status so if i just run this without the rest of it so i'm pushing f8 well now i can see the actual power state so the power state says kind of vm running vmd allocated vm running etc so what i could now do is well i'm going to pass this get status notice i had a command here that just shows it in a basic kind of output i'm going to pass it to a where object command where the power state does not equal vm running so that shows me the ones that are deallocated and then i could pass those to start azvm now i'm doing what if so it's not actually going to do anything but what it showed me is hey this one command would get a list of all my vms find the ones that aren't running and start them so very very easy i can do things i already showed you the get a z environment i can look at all of the regions so get azlocation will show me all the regions available what providers they have i could look at things like what vm sizes are allowed in south central us okay i could see well what is my usage in south central us what is my current value and i'm sorting these in a descending order so i can see well total regional virtual cpus 15 out of 100 i'm using 10 for the bs series i've got eight virtual machines i've got premium managed disks so it's really super cool what i can do with a powershell i'm actually going to store that region as a variable i can look at templates so if i actually was doing now again i don't really want to do provisioning in powershell because again it's not idempotent it's not declarative but there may be times you do maybe you're just not ready for templates yet i like scripting it's still better than trying to do it in the portal which is manual you click things wrong at least with a script i can put it into a version control system like git and i hit some level of consistency between executions instead of making sure i click the right buttons the right way but even if i'm just investigating what's available maybe i'm not creating it here i want to see what templates are available so what i'm doing in here is hey show me all the image publishers for kind of south central and there's a lot of them and then i can kind of say okay well what are all of the image offers let's cancel that for microsoft windows server okay there's a whole bunch of those um which ones actually this is for the windows server one and then which ones for 2019 data core and i can see all the different versions that i could then go and use i can do things like well what are the various azure vm extensions that are available and there's a lot of them i can interface with the azure resource graph and that's phenomenally powerful remember the resource graph gives me kind of sub second access of course any subscription i have access to regardless of really how much resource it's a lot more efficient if i was trying to write a powershell script to find all the vms then get these properties about the vms doing get azvm and then it's very inefficient it's going to be very very slow whereas the resource graph is going to be super fast so i can call the resource graph from my powershell script which is what i'm doing here so in this script what i actually do is i'm trying to find a particular virtual machine based on the guest os name so here i'm doing a computer name and this is a separate module az resource graphs you'd have to do an install module a z resource graph so i'm setting a computer name and i'm creating a search query so i'm looking for any resource that's a virtual machine where the os profile computer name either guest name is that name and i'm joining it with the subscription list so it's actually going to tell me the subscription is in as well so i can actually create that bunch of code and i'm just going to try and run it so i'm using the search easy graph and calling that query that i've defined up here and if i run that watch okay so that would normally work uh it's some token weirdness with the tenant where i actually have the resources but i promise you that normally would work and show you the resources but being added interface with that resource graph is kind of a super useful thing to do deploying arm templates now my azure master class i go into a massive detail about that but over here you can do like a new az resource group deployment but essentially there's documentation on anything you want to do now i can go and find the command so if i know i'm doing something about virtual machines i want to do a new vm or i can do a get command it's going to be in the az compute module and it's showing me all the different commands that have the word vm in them so okay there's a new azvm and then i can say well get help dash examples it's going to show me all the different ways i can use new azure vm i could say we'll get help online and it will open up a browser and show me the new azvm with all the documentation all the examples of how to use it if i didn't know what i was doing i could say what a azure powershell create storage account chances are okay create azure storage account create storage account and here it shows me well portal powershell cli template and then creating it in the portal powershell cli and that really applies to everything so i see zero point in me now trying to go through a whole bunch of different commands for creating a storage account um the documentation's there the key point when you're getting started with powershell is more about well what do i want to do in terms of the installation the authentication those contexts and where you want to use it i think a powershell was phenomenally powerful for me doing quick interactions seeing what's there starting stopping doing management i tend to try and avoid it for provisioning because it's not item potent it's not declarative but you could when i started out i definitely did create things with powershell it's just it's better for you longer term to think about templates for that stuff but for automation for management actions the powershell the cli is super powerful so i hope that was useful again the the file that i have used here um that's linked below in the description the video it's in my random stuff github repo and remember that it does update fairly frequently so you would just go through you can go and check and just remove the old one install the new one if this was useful a like subscribe comment and share is appreciated there's a lot of work goes into creating these but essentially good luck if you're not sure what saints going to do add that what if or at least confirm to make sure you go go and do something super bad um but until next time take care you
Info
Channel: John Savill's Technical Training
Views: 11,894
Rating: 4.9874215 out of 5
Keywords: azure, azure cloud, powershell, az module, azure powershell, getting started azure powershell, learn azure powershell, azure context
Id: RQMdJ-9-lxY
Channel Id: undefined
Length: 52min 31sec (3151 seconds)
Published: Tue Jan 19 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.