hi welcome in another episode of cloud and five minutes today I want to show
you how to install all the software you need in your VM automatically also
if you prefer Ihave an English version of this video just click here in top-right corner
hello again let me introduce myself I'm Frankie Busch a Microsoft as your MVP
based in Montreal in Canada what I want to do today is create a def box so a
virtual machine for development and install automatically all the software I
need I really do that using chocolaty
chocolaty is a package manager that is available online and you can find
multiple package or application it's a little bit like a PT get on Linux but
it's available for Windows so a common would look like chuckle install and then
the package you want here let me show you a simple script that I am using so
here I have show Co install and then Visual Studio code
chucko install get chuckle install no GS what I want to do today is use that
script while I'm creating my virtual machine and Azure let's get started
today I'm on a new boot into machine but it could be anything else I'm I will use
vs code to edit my arm template and I want to introduce you to extension are
pretty cool the first one is that one here as your resource manager tool will
give us intelligence and some validation of the script the second one is here the
Asha resource manager is snippet it's very useful you just type in and we'll
generate this the structure the schema for us so let's get started so to use
those scripts let's remove this to use it you just need to be in adjacent file
so here I am in adjacent file so to use the extension I just need to type arm
and we'll suggest me so by default the arm alone will give me a skeleton and
empty skeleton so now what I want to do is go in the resource section here and
type again arm but this time I will pick the arm windows VM or in fact arm VM
windows because I'm on my dev box to be at the windows I do that and now I have
pre-selected bunch of places in the file and I just need to type the name of my
VM so I'll call it Frank dev box no typo by doing tab let's jump to the
next section so now it's the administrator name so we'll use Frank
and as a password jazzy ball 16 Walla that's it
so we'll save that so right now this is perfect it's a functional arm template
if I use that and deploy it it will create a Windows machine but I also want
to install application until you that I will leverage the custom script
extension so if I go in the azure documentation here I see the custom
script extension for Windows and I have all the prerequisite and the explanation
and but here that's the part I need so we'll use that part I will paste it here
so I don't need this extension I'll remove it and replace it by mine
voila so now I don't need this dependency remove it and I mean here
oops to place the name of my VM since it's
the dependency so computer VM and def box here see the first extension we
install it mentioned the very get validate the schema and it says that
this name is not good so we'll remove it like that
so def box now the dependent so the extension will wait until my VM is
created to use the custom script extension your script need to be on a
blob store it needs to be available online would it be in a blob storage or
publicly online in our case we'll be using the it's on github so it will be
publicly available online so I don't need that I will use this command so
this command will call powershell and call a script the script will be
download from the URL to the local machine and then execute so here what I
want to do is I will remove that and we'll use a
variable so here I have a home and I will call it strip URL ah a square
bracket here complains that the variable doesn't exist let's create it go on a
top in the variable section voila and now I need the value to do that
we'll go back on my get page oops get page here I want to use that scrip so I
will go in the raw version here and I will use this URL as my ear L for my
script so place paste it here save it and I think we are good to go
oh no we are not good to go so one more thing so if we look here at the
publisher of Hurons queue we see that the VM will be created based on the 2016
data center it's a really good machine but for my def box I would like to add
visuals so pre-install on it so I want to change that so let's have a look and
try to find ask you to search or skew we'll go using the azure CLI so to
connect you do as your CLI and you do a Z log in and then you will be using AZ
account set and you select the account you want and then what we want is look
for publisher so to do it well go easy VM image because we want to look into
the images available in the market and will list the publisher and we specify
location because the available image could change based on location and
that's a lot of images available mine is something Microsoft I think visual
studio so let's go here Microsoft is also so this is the one I'm
looking for so now we'll be looking for the offer
so it's cleared and now well list again so VM image list offers same location
and now we pass the publisher a lot less options perfect the one we are
interested is a visual studio so we'll pass that and now we'll search for SKU
so now as your VM image and we list SKUs we pass the publisher and the offers
like that and we see all the images that are available so I will use that one
with Windows 10 perfect now let's use those information inside our arm
template voila so here I wanna replace those three information so now it's
Microsoft Visual Studio visual Joe and the Windows 10
voila our script is now ready to be validated why because it's a very good
practice you will save a lot of time by validating all your script before trying
to create the deployment so as usual let's go back to the terminal and we'll
do it clear so we need first a resource group so let's create one call I will
call it cloud in five minutes location is us as usual we pick what's
best for you so our next command is as your a group deployment but this time is
a validate not create or pass the resource group it's important it's a
mandatory parameter and we'll pass the files or JSON file that we just create
perfect let's see if it pass yes it is so we could see here everything is
perfectly fine great now it's time to create it so let's clean everything so
here I have a Zi group deployment this time create I specify a name for my
deployment it will be useful so Frank dev box demo will find that in the
portal it could use it and we could also use a command line to see the status I'm
passing the resource group force and the like file I put verbose just to have a
little bit more detail so let's run it you should think about seven minutes so
while it's running let's go in the portal and and see what we can see so in
the azure portal let's refresh that I should I have now perfect having five
minutes so see we already have few component that are created it's really
useful to use the arm template because as your walls check and validate and you
will paralyze everything that is possible to do so it's the fastest
deployment you can have to know a little bit more about deployment we go here in
the left side and we click on deployment option and we see have we ever Frank
Frank dev box demo deployment it is still deploying and if we if we click
here we'll see all the status and we see that it's been 56 seconds since it was
created I will be back to you when it's done
job done perfect it took 6 minutes 35 seconds not bad for a VM with Visual
Studio install and all the software you need pretty cool now let's go and remove
the stuff into it so to do that we'll go back in the resource group or go in a VM
to get the IP it is copy that come here remove this top
when you paste
so here we are in so obviously visuals geo is pre-installed we have visuals to
your code and if we have a look get is also present just here and I had no GS
no GS is here too so what's left what else could you do well of course
you could customize your list and install all the application you need you
you could have multiple lists two different kind of purposes I will change
the arm template and you know move the password as a parameter and probably the
URL so you could match those you can take the arm template and put it also in
github and that way with one click you could install it and of course you could
add the Atocha down to the VMS if you don't know how to do it just look here
the video I explain everything and don't forget to subscribe see you next time
Thanks you
Không có nhận xét nào:
Đăng nhận xét