Introduction to AZ-204 Certification
- Designed for developers working with Microsoft Azure.
- Covers deploying web apps, Azure Functions, application integrations, and Azure API programmatic interactions.
- Recommended path: Start with AZ-900, then AZ-104, followed by AZ-204.
- Exam difficulty is higher compared to AWS and GCP developer certifications.
- Study duration varies from 20 to 50 hours based on experience.
Azure Functions and Serverless Architecture
- Serverless services are fully managed, scalable, abstract infrastructure.
- Azure Functions are event-driven, with triggers and bindings to integrate with input/output services.
- Azure Functions require a storage account for state and code management.
- Authorization levels: anonymous, function (API key), admin keys.
- Debugging available via log streams and live metrics.
- Hosting plans: Consumption (serverless, scales to zero), Premium (pre-warmed), Dedicated (App Service Plan).
Azure Virtual Machines (VMs)
- Highly customizable with choice of OS, compute, memory, and storage.
- VM size and availability linked to image type selected.
- Three connection methods: SSH (port 22), RDP (port 3389), Azure Bastion (browser-based).
- VM management includes update management for OS patches.
- Differentiation between Linux and Windows VMs for licensing and resource needs.
Infrastructure as Code with Azure Resource Manager (ARM) Templates
- ARM templates are JSON-based declarative scripts for provisioning Azure resources.
- Template components: schema, parameters, variables, functions, resources, outputs.
- Support modularity, testing, validation, deployments tracking, and integration with CI/CD.
Azure Containers
- Azure Container Instances (ACI): fully managed Docker container execution.
- Supports Linux and Windows containers with quick provisioning.
- Container Groups group related containers on same host.
- Azure Container Registry (ACR): managed private Docker registry for container images.
- Supports image build automation and integration with Azure DevOps and other pipelines.
Azure App Services
- Platform as a Service (PaaS) for hosting web apps, APIs, and mobile backends.
- Supports multiple runtimes: .NET, Java, Node.js, PHP, Python, Ruby (partial).
- Supports custom container deployment.
- Features deployment slots for staged deployments with traffic swapping.
- Scaling options include manual scale-up and auto scale-out based on metrics.
- Supports WebJobs for background processing in Windows environments.
Azure Storage Options
- Types include Blob, File Shares, Queues, Tables, Disks.
- Performance tiers: Standard (HDD) and Premium (SSD).
- Access tiers for Blob storage: Hot, Cool, Archive based on access frequency.
- Storage Explorer and AZCopy CLI tool facilitate data management.
- Lifecycle management enables automated data tiering and expiration rules.
Azure Active Directory (AAD)
- Cloud-based identity and access management service.
- Supports users, groups, managed identities, and guest users.
- Editions vary: Free, Office 365 Apps, Premium P1 and P2 with advanced features.
- Supports multi-factor authentication (MFA), password reset, and role-based access.
- Integrates with on-premises AD using Azure AD Connect.
Azure Key Vault
- Secures cryptographic keys, secrets, and certificates.
- Supports hardware security modules (HSMs) compliant with FIPS 140-2.
- Enables key management, rotation, backup/restore, and access control.
- Supports certificate lifecycle management and integration with certificate authorities.
Azure Monitor and Application Insights
- Azure Monitor centralizes telemetry data collection, analysis, and alerting across applications and infrastructure. For an in-depth understanding, see Understanding Cloud Computing: A Comprehensive Guide to AWS and S3.
- Provides metrics, logs, and traces for observability.
- Application Insights focuses on application performance monitoring with out-of-the-box language SDKs.
- Supports manual and auto-instrumentation.
- Features include usage analytics, custom event tracking, sampling to optimize costs, dashboards, and workbooks.
Azure API Management (APIM)
- Manages APIs including securing, versioning, documenting, and analytics. To expand knowledge on API management concepts and best practices, refer to Unlocking Azure DevOps with the A400 Certification: A Comprehensive Guide.
- Components: APIs, products (API groups), developers, policies, and gateway.
- Supports various API definitions: manual, OpenAPI, WADL, WSDL.
- Provides powerful policies for authentication, caching, transformation, and throttling.
- Developer portal allows API consumers to explore and test APIs.
Event-Driven Services
- Event Grid: serverless event routing service for reacting to resource changes with custom or system topics.
- Event Hub: big data streaming service for high-throughput event ingestion and processing.
- Azure Service Bus: enterprise messaging service supporting queues (point-to-point) and topics (pub-sub).
Redis and Azure Cache for Redis
- Redis: open-source in-memory data structure store used for caching and fast data access.
- Supports strings, lists, sets, sorted sets, hashes, bitmaps, streams, etc.
- Azure Cache for Redis is a managed Redis offering integrated with Azure for high performance and scale.
- Common use cases include session storage, caching, real-time data and queues.
This study guide integrates essential concepts, capabilities, and practical advice extracted from the AZ-204 course content to aid candidates in mastering Microsoft Azure development services, preparing for the certification exam, and applying Azure skills in real-world scenarios. For a broader certification preparation strategy, you might also find the Ultimate Guide to Azure DevOps Certification Course: Pass the Exam with Confidence useful.
hey this is andrew brown your cloud instructor exam pro bringing you another complete study course and this time it's
the microsoft azure developer associate also known as the az204 made available to you on freecodecamp this course is
designed to help you pass and achieve microsoft issued certification and the way we're going to do that is by doing
lecture content follow alongs a practice exam and have cheat sheets for the day of the exam so you can prove on your
resume your linkedin you have that as your knowledge you can go get that cloud job or get that promotion and tell you a
bit about me i was previously the cto of multiple ed tech companies 15 years industry experience five years
specializing in cloud i'm a nativist community hero and i've published many many free courses just like this one i
love star trek and coconut water and i just want to take a moment here to thank viewers like you because it's you
that make these courses possible and the best way to support more courses just like this one is to purchase the
additional study materials at az204 so you can get access to study notes flash cards quizlets downloadable lecture
slides downloadable cheat sheets practice exams ask questions get learning support but if you sign up
right now for free you'll get a practice exam and cheat sheet there's no credit card required the free stuff does not
have a trial limit so you do not have to worry about it vanishing it's not a demo uh if you have if there are updates to
this course they'll be in the youtube descriptions on free code camp so watch out if there are corrections additions
modifications to make sure you're using the latest version of this course and if you want to keep up to date on upcoming
courses the best way to find that is on twitter i'm at andrew brown on twitter and if you do pass i love to hear uh you
know your success story um or what you'd like to see next so there you go hey this is andrew brown from exam pro
and we're at the start of our journey asking the most important questions first which is what is the azure
developer associate so it's a microsoft certification about the azure platform focused on multiple ways to deploy web
apps to azure a deep dive into azure functions i mean seriously deep a broad look into application integration
services which azure has a lot of to the point where they have ones that cover the same purpose and lots of
hands-on with azure cli sdks or programmatic interactions with azure services so anything to do with the
azure api the course code for the azure developer is the ac204 not to be confused with the 104 but it is very
complementary to the other course which we'll talk about when we talk about the roadmap and i do want to point out that
microsoft azure is a very code and script driven uh platform compared to aws and gcp so it's better having
developer knowledge and i actually consider it a must when we're working with microsoft and i'll explain why here
in a bit so who's the certification for we'll consider the 204 if you are a web app developer looking to pick up cloud
skills or transition to a cloud developer role you are a cloud developer cloud engineer who needs to integrate
azure services into your app or deploy your app to azure or you need to learn a lot about azure functions to build
service workloads but as a note i kind of feel that this is an essential certification at the associate level and
so looking at a roadmap i always suggest people to start with the az900 which is the fundamentals because it's going to
really help you get not just introduced to azure but also the test taking
experience because it is a much difficult and different experience than the other two providers
and generally from that we usually recommend to go with the administrator the 104 because that is a broad amount
of services and that is the most common use case why people are on microsoft azure because they're usually i.t dev
shops but as a complimentary usually after that i would recommend to go to the
developer the az204 because the nature of azure is that a lot of the ui it like is script driven so when you are in the
portal uh you have to touch script more often than not or you might run into features that simply do not exist in the
portal so you have to use scripting so really to be a proficient pers person working on azure you need developer
programming experience and so i always pair these two together now where you want to go after that is up to you a lot
of people like to go the solutions architect or the devops engineer expert there's a bunch of other
associates and i consider these kind of like uh like mid-level specialties where you can do those there's of course more
certifications than we're looking at that is actually here but you know these are the most general
ones here so you know hopefully that gives you an idea that you should probably take the developer after your
associate and then after that you go wherever you want in terms of difficulty the azure
developer associate is i would say two times harder than the aws developer associate and three times more difficult
than the gcp associate and i'm talking about the exams not necessarily the application
of being a developer in the platform but just the fact that the way azure makes their exams is they really want to test
for practical knowledge so it's not about conceptual or strategic information not to say that there isn't
those kind of questions on exam but it's a huge focus on do you know how to actually set things up and do you know
the nuances of them so you're going to see a lot more labs than normal in my courses for this particular study course
how long does it take to pass well it depends on you but to give you a general idea if you're a beginner so let's say
you had the az 900 but not much hands-on experience you've never written code or attack role then you're looking 50 hours
even if you've taken the easy to 104 it's still going to take this long because it's a different uh different
beast than the 104. if you're experienced so you already have practical knowledge working on azure uh
you've deployed apps to azure you have a strong background in programming you're looking at 20 hours and so i like to uh
set a goal of somewhere in between so 30 hours average study time so for lectures in lab that's going to uh take up 50 of
your time so you know we're looking at it's probably more uh labs and lecture and then the other part of it is 50
practice exams so i recommend you study one to two hours for 20 days and really do spread that out because if you do too
much of it together uh you have a a good chance of forgetting information so you know make
sure you spread that out and make sure that it's it becomes part of your long-term memory so where do you take
the example you can do it in person or test center or online from the convenience of your own home so
microsoft delivers exams via two different uh providers psi online pearson vue and those are online proctor
exam systems both of these providers have their own test center networks so whether you want the online experience
or in person it's just to be up to you i strongly recommend if you can to go in person it's less stressful if you have
the opportunity if you can't you have to do your home it's up to you which one you want to choose they're more or less
the same i like pearson vue but some people like psi so
it just depends if you take a couple you'll decide which one you like and if you're wondering what the word proctor
means it means there's a supervisor somebody is monitoring you as you taste taste uh take the exam to make sure
you're not cheating that's the whole idea behind it to make sure these are legitimate uh scores so what does it
take to pass example you're going to have to watch video lecture memorize key information you have to do hands-on labs
and follow along within your own account you i would recommend paid exams to simulate the real exam i'm going to help
you out by giving your first exam for free no credit card required just sign up on exam pro and um you know you can
go get access to that and other free additional content that i strongly recommend that you do
for the content outline we got five domains each domain has its own weighting that determines how many
questions in a domain will show up and azure is interesting because they do a range of questions so it's not a
guaranteed of a certain amount of questions on exam it's going to be between ranges so the first developer or
sorry develop azure compute solutions develop azure storage implement azure security monitor troubleshoot and
optimize azure solutions connect and consume to azure services and third-party services in terms of the
grading you've got to get about 70 percent to pass and they use scaled scoring so
uh you know it's not always exactly on the dot but you for the most part if you get 70 percent you should pass in terms
of um amount of questions is between 40 to 60 you probably see 55 questions so you can afford to get about 12 to 18
wrong some questions are worth more than one point there's no penalty for wrong questions some questions cannot be
skipped and for the formatted question you've got multiple choice multiple answer drag and drop hot area case
studies all sorts of kinds of questions that you'll encounter much more difficult than the az 900 for sure
in terms of the duration you get three hours so that's about one minute per question but of course different
question formats are going to be different uh you have 180 minutes for the exam time your seat time is 210. so
you have about um 30 minutes um in terms of the whole time that you said schedule so even if you have 180 minutes you have
to consider the entire time to get logged in and all that other stuff so time to review instructions reading
accept the nda complete the exam provide feedback at the end and i'm telling you if you're taking this online
show up early because so often you're fiddling around with your license to try to get to scan properly and then they
don't like it so you have to scan it twice so you know if you can show up an hour early and make sure you block that
time this exam is valid for i believe two years before recertification so you know
there you go [Music] hey this is andrew brown from exam pro
and before we dive into azure functions we need to understand what is serverless so serverless architecture generally
describes fully managed cloud services and i say generally because um you know that definition of serverless can be
highly contested about what can be serverless and what can not be serverless so it's not a boolean answer
of yes or no but some services are more uh serverless than others to a degree and so you know the way to help you
understand serverless is the way i define it is i look at the following characteristics one thing for a
cloud service to be serverless is that it should be highly elastic and scalable highly available highly durable and
secure by default another thing is that it abstracts away the underlying infrastructure and are built based on
the execution of your business task so you're not really worried about how many cpus and things like that maybe they are
abstracted into like virtual cpus or away from what the original
hardware software is using the idea is that it's a simpler value then the idea is that serverless can scale to zero
meaning that when it's not in use you're not paying for anything and the most important thing is you're paying for
value so you do not pay for idle servers and just to kind of reinforce that idea that um
that uh it's a degree uh my friend daniel who's really big in the service loves to describe it as like the energy
rating system so the idea is that uh when you go to buy an appliance such as um you know a washer or dryer they'll
tell you how energy efficient it is and that's kind of the idea behind serverless services and uh you know
we're going to be talking about function as a service but function of service does not necessarily guarantee that it's
a serverless service but we'll talk about that in the next slide okay [Music]
all right let's talk about function as a service also known as fast so here's kind of a diagram that i like to use to
visualize it but we'll get to it in a moment here so what is function as a service it allows developers to focus on
just writing pieces of codes also known as functions and it has event driven integration trigger functions based on
event data or to emit event data so it's not just a matter of having a piece of function or code that you write in a box
but the fact that it has to be event driven generally multiple functions are
orchestrated together to create a serverless application sometimes also known as microservices functions
generally only only run when needed and so function as a service is not serverless on its own
so fast function as a service it's only serverless if it's fully managed and it scales to
zero just to take a closer look at this graphic here so the idea is that if we're talking about the underlying
infrastructure it's of course running on some kind of physical server and from there you'll have a host
operating system and then you it could be a hypervisor and then from there you could have a
virtual machine running a container runtime like the docker daemon um or you know it could be
there are some os's that are optimized to run a container runtime without a hypervisor
but the important part is the idea is that you're just deploying these little pieces of functions and they generally
will go into a container so you might have a container runtime
that is specifically configured for ruby or it might be configured for java or python or net and then the idea is
that you're dropping that code and that code's getting scheduled into that container
but hopefully that gives you kind of the general idea of what function as a service is
[Music] hey this is andrew brown from exam pro and we are taking a look at azure
functions and this is a function as a service fast offering that allows developers to focus on writing code and
not worry about maintaining the underlying computing infrastructure and so here is our
visualization so we can kind of break down the anatomy of how azure functions work so the first thing you'll need is
an function app and this defines the underlying compute for a collection of functions so a function act defines the
hosting runtime and global configurations then you have the functions themselves these represent
code along with application runtime configuration so the idea is you can say i want this to be a python function a
net function etc etc there's always going to be a trigger so a trigger is the chosen event
data that will cause the function to execute and you can only have one trigger
you have input bindings these are one or more multiple data sources that will be passed to the function when a trigger
occurs so the idea is you can pull in data from a variety of different azure services at the time of trigger which is
uh quite nice and then you have the output bindings these are one or more data syncs that
will receive outputted data from the function on successful execution they say syncs you could say consumers if you
like and also azure functions at least as of today has four different versions you
really do want to just use the latest version there could be a version 5 out by now i
don't know but you know just be aware that you're always using the latest version but
in practicality you probably won't be able to tell the difference between the versions but just make sure you're using
the latest okay [Music] all right let's take a look at storage
considerations for azure functions because every function app requires a storage account to operate and if that
account is deleted your functions are just not going to work so kind of a small visualization of your function app
linked to a storage account so azure functions uses the following storage types in the storage account it's going
to vary based on use case so for blob storage it maintains binding state and function keys for azure files file share
used to store and run function app code in a consumption plan premium plan as your files is set up by default but you
can create an app without azure files under certain conditions for cue storage this is used by task tubs in durable
functions we have a little section on durable functions and then for table storage used by task hubs and durable
functions as well so there you go [Music] okay let's take a look here at the
anatomy of a single azure function so here is a screenshot of visual studio code because this is where you're going
to be writing your functions you can write them somewhere else i sure don't know where but
they have really strong integrations with visual studio code but the idea here is that we have a
visual studio code plug-in installed that allows us to manage our remote functions and we have
local projects but let's take a look at some of the files that are in here so we can understand what kind of files matter
to our functions the first is functions.json this is configuration of a single function defining bindings and
we talk a lot about bindings uh in the azure functions section of this course there's the code itself in this case
it's a javascript file we have the func ignore that's just like a git ignore file but it's to ignore files like files
to be not packaged right so like when it actually deploys the function you don't want those files included but
you might use them in local development we have host.json this is global configuration of all functions at the
function app level then there's the local project itself this is just where the function is
stored locally and a lot of times you're moving that code to uh to the remote storage on azure and if we were just to
open that up you can kind of see the same files being mirrored so we have the name of the folder so host json function
json index etc local settings json package json things like that
so i'll just kind of erase a little bit of this out of here but you get the idea and it'll make a lot more sense when we
start making functions which we absolutely do in this course critical for the az204 so
but we'll do that soon [Music]
all right let's take a look at authorization levels this determines what key if any needs to be present when
making a request when a function is getting invoked and the authorization levels can be one of the following we
have nominus function and admin so anonymous means that anybody can invoke the function so if it's an
https request in order to trigger it anybody can trigger it
for function you'll need a specified api key this is the default value when you're creating your functions generally
recommended as the means to use or you can have it so that it has to use a main key
to be required yes it's called master key i'm just going to use the word binky and for integration if you're trying to
figure out how to change the authorization levels after you've deployed a function you're just
going to click on your https trigger and from there you can switch the authorization level now that's not
always the case there's some cases where you're not able to change it via the portal
um and that just has to do with you know the type of runtime you're running whether it's a custom run time
but yeah that's where you're going to do it there and you can change it after the fact after creation okay
[Music] let's talk about how we would debug our azure function well you have this
ability to turn on uh streaming logs and this allows you to see near real-time logging when errors occur and it's not
as simple as that because there are two options for streaming a file log the first is built-in logging stream
and so the idea is that you have the app service platform lets you view a stream of your application log files and then
there's live metrics stream so when your function app is connected to application insights you can view log data and other
metrics in near real time in the azure portal using live metrics stream and log streams can be viewed both in the portal
and in most cases the local developer environments such as visual studio code now when i
was doing this i was trying to turn it on and i did not get any logs in near real time but i think the reason why was
because the hosting that i had it backed on wasn't on app service platform so i think it really does matter where you
host it um and so you know maybe we'll explore that in the follow along to see if we can see your real-time logs
but yeah there you go [Music] all right let's take a look at the key
concepts for azure functions these are not exactly my words but i will uh provide exceptions here as we describe
this stuff but the idea here is that we want to get broader knowledge about azure functions so azure functions are
lightweight and can be serverless and they can be and this is only going to be dependent on how you host them and we'll
talk about that in a moment azure functions are easier to write and deploy usually write deploy than
full web applications uh that can be true the idea though is that you are uh you might have to
do less coding in some regards but then you might have to do more in other places
like application integration so i would say that it shifts the responsibilities of what you have to
work on but you it is better i think azure functions are fast execute because there is no at large application startup
time initialization or other events fired before the code is executed now true that large applications there are
those downsides to them but the the trade-off here is that if you're using serverless functions then you will be
dealing with cold starts um and so cold starts just means that uh you know
when you're when you have a function that hasn't been used in a while that's going to have to boot up an environment
so you know there is that trade-off now in many cases you can
pre-warm or have continuously running compute but if you do that then you're not
necessarily leveraging serverless like to be able to scale to zero but you know you do get trade-offs azure functions
execution is triggered when an event is fired that is true azure functions do not need any infrastructure and it has
zero maintenance well they do have infrastructure it's just that you don't generally have to worry about the
infrastructure in terms of azure's implementation of functions you do have to think a little
bit more in general about the infrastructure underneath as opposed to google cloud or aws but at least you
have a lot of options on azure and it has zero maintenance well the infrastructure that's true but um
the your code itself you know if you're using python 2 and microsoft says hey we're going to expire or uh deprecate
the python 2 runtime you have to use python 3 well then you're going to have to
upgrade that stuff so that is your maintenance so there is management code but
that's no different than any other provider azure functions can be built tested deployed in the azure portal
using a browser only if you're using windows so uh if you are hosting on linux there are definitely
lots of limitations in the azure portal if you're using windows then there's no problem in most cases
you should just use windows because you're not going to be able to tell the difference
in most cases but if you want to take the full advantage of being able to work in the
portal absolutely use windows azure functions are easy to upgrade and doesn't affect
other parts of the website again this is subjective based on uh the code that you have to upgrade right so
or functionality that they change so you know generally it's true it can be easier in isolate to update parts of
your application because they're all little functions but there are exceptions to that azure functions use
industry standard protocols probably https here and communicate with other apis databases and libraries that's true
you only pay while your functions are running that is true if you use the serverless model if you're continuously
running virtual machines behind the scenes then you are going to be paying all the time azure functions
automatically scale to meet the demand of traffic that is true underneath azure will provision more service containers
that is true azure function scale scale to zero cost can depend on your hosting azure function has built-in
monitoring via azure monitor which it absolutely does and it can integrate or has built-in ci cd via azure devops
which is very nice azure functions are event driven and will be triggered based on event data and emit event data
absolutely and if they didn't then it wouldn't be functioned as a service but there you go
[Music] all right let's take a look here at use cases both business and technical for
azure functions so for business use cases you can use them for scheduled tasks reminders and notifications
lightweight web apis sending background emails running background backup tasks doing back-end calculations there are
technical use cases such as sending emails starting uh starting a backup ordering processing
task scheduling database cleanup send notifications messages iot data processing so azure functions are best
suited for smaller apps that have events that can work independently of other websites originally i had some text in
here that said like azure functions were not suited for large applications but more of these menial
jobs around a larger application which is not true you can build a whole application out of functions
now whether that's easy to do with azure functions is another story because it has to do with cold starts and things
like that but i i definitely think you can but this is just kind of give you creative ideas of
how you can use azure functions outside of the normal use case of just building a web application so there you go
[Music] all right let's take a look at vs code extension because this is going to be
the primary way that you are going to be working with azure functions so in order to productively work with azure
functions you'll need the visual studio code azure functions extension and so what
you'll do there is install that once it's installed and you have an azure icon
in your activity bar with the side bar drawer you can look for functions i'm going to get my pen tool out here so the
idea is you install this and then now you have at the top here the functions
tab so you can manage azure functions it's possible to use azure portal to create and update windows host hosted
azure functions but in practice it's not an easy experience with linux it's impossible
this is a very kind of different experience compared to something like aws or google cloud where you can do
basically everything in the cloud but with azure functions you really
really really rely on visual studio code you can use visual studio for net and c-sharp app functions i've never done it
myself but it is an option out there so there you go [Music]
let's talk about runtime so what is an application runtime an application runtime is a compute environment
configured with the necessary software and system configuration to run a specific type of application code so
here uh if we were to create an azure function we have some options and you
can see runtime stack so azure provides multiple applications and runtimes for popular programming languages just going
to highlight that out there because i don't see my my arrow but uh it has things for uh net
so that's c sharp java node.js that's both javascript typescript powershell core python there's my uh
there's my nice arrow there um unfortunately does not have ruby at the time of recording this i really would
like them to have it but if you want something that's not there what you can do is implement your own custom handler
i believe they have an example either for rust or go in the documentation or let's say you want to do ruby
that is something that's on the 204 exam but in practice it's really really really hard to get a working custom
handler and i say that by i tried to make a ruby one it didn't work i tried their tutorial it didn't
work i reached out to the person that wrote the tutorial they couldn't get to work i went to support they couldn't get
it to work so in theory custom handler sounds great if you can figure it out um so you know if there isn't a custom
handler uh follow along you'll know why um but uh yeah that is an option on the table the runtimes provided by microsoft
are just docker containers you can see them on the docker hub um and you know a lot of times you know containers and
functions are strongly related because they're generally almost always running on
containers okay [Music] all right let's take a look at windows
versus linux hosting so when you create an azure function app you can choose either windows or linux as your host and
this actually it makes a big difference based on the capabilities that are available to you
and we're talking about things where there could be performance differences functionality limitations feature
differences but generally you know when we're using microsoft it's always good to attempt to use windows when possible
because their whole ecosystem is built around windows and not so much linux one example here
is that if you are using a linux hosting for azure function apps you cannot edit the function after it's
been deployed and that is a very major inconvenience so just consider that when deploying functions i usually can't
tell much the difference between linux and windows so i'll just choose windows so i
get that additional functionality if you need to determine the exact os that is being used what you can do is go to
docker hub repository because again all these uh all these images or
runtimes are stored on docker hub and there we can see the windows images and the linux images
and notice for linux there is a lot more variation where windows is just the nano server 1809 so that's the windows server
1809 whereas linux there's a little bit more options and mostly debian but you do have one down here that's ubuntu but
there you go [Music] all right let's take a look at templates
for azure functions so azure provides function templates to get you started with common functionality scenarios this
is going to happen when you first create your function now you don't have to use one but definitely this is the route
that you should want to go especially if you're choosing http trigger which is very common so
to choose the template you're going to be doing that in visual studio code so you don't do it in the portal but let's
just kind of walk through the templates we have available so we have http so triggered by http request and returns an
http request you have a timer so triggered based on a schedule blob storage triggered when files are
uploaded updated in a blob storage container cosmos db triggered when processing a
new modified cosmodb document cue storage triggered by azure storage queue messages
event grid so triggered by event from event grid so many azure services can be triggered
as a function through event grid okay as we cover event grid in this course
a lot of sources can be ingested into event grid event grid is serverless event bus integrated with azure service
as we do cover at other parts intercourse uh event hub so triggered by an event hub event so
this is for streaming service bus queues are triggered by a bus queue this is messaging service bus topics the
triggered by uh an event from a bus topic so this is a pub sub model then you have send grid so triggered by an
email event in a third party service center if you ever send grid it's just for sending out emails
and so there's a lot there does it set up the bindings for you probably i never really noticed or checked but i would
think that if you were to set one up for blob storage you would get the binding set up for you in your
function json but we will look actually next at function json
configuration because that is what is next in the course [Music]
so for every single function there is a function configuration file called function json and so there's the
structure there it defines the functions triggers bindings and other configuration settings when you choose a
template you're going to get some default stuff there let's talk about three main things under bindings so you
have the type of binding which is just the name of the binding which will affect the other attributes
that are underneath often that you'll have a direction like in and out uh and then there's the name and the name is
going to vary so for c sharp it's an argument name for javascript it's the key valued list but it's what is used to
bound data in the function and we will definitely cover a lot about bindings because bindings is super
important but just so you know function configuration file again is for trigger
bindings and other configuration settings [Music]
another file that you'll find in your function is a hosts dot json and uh this is for configuring global configuration
options for all functions within the function app here is an example one uh so
as extension for http you can see it has a rope prefix things like that it's setting a custom header and there is a
lot of stuff you can configure here for options so we can do aggregators application insights blob console
cosmodb extensions and then you know http cues retry send grid a whole host of things
and you know not super important for the exam but definitely in practice you will be
going this fall uh and configuring things need be but there you go [Music]
let's take a look at plan services for azure functions and we have three to choose from consumption function premium
and app service plan very different very interesting uh options for you to decide where you want
your compute to run and how your compute to run for functions you do not see a bus or google cloud doing that but the
flexibility here is very interesting so the first is consumption plan and this would be considered serverless and
because it's serverless it can scale to zero and because it can scale to zero that means that uh
generally we will have cold starts so you only pay for the time your code or application is running billing is based
on the number of executions and the duration of each execution and the amount of memory used just pay while you
have functions running and scale it automatically even through long loading times then you have premium
plan these are functions premium this is where we have pre-warmed uh pre-warmed compute underneath so the user has
designated a set of pre-warmed cases which are already online and ready to react instantly azure provides any
additional computing services that are required when your function is running you pay for the constantly pre-warmed
instances including any additional instances needed to scale the azure app in and out azure functions host
instances are added and removed based on the number of incoming events so um you know the idea there is that
you're not waiting for the container runtime to spin up it's already running but it's not going to scale to zero
and you know i mean you can still say that it's serverless in some regard i would consider that now being a fully
managed service but not necessarily serverless but you know that's debatable the last
here we have dedicated plan this is with app service plan and this is where we're doing vm sharing and this one is
extremely unique uh you do not see this in any other cloud provider but this is where when you use app service
for other apps your functions will run on the same plan virtual machine at no extra cost you may scale it out manually
by adding more virtual machine instances for an app service plan you may also have
auto scale enabled optional when you have existing underutilized virtual machines which also operate other
instances of the app service so i think what happened was um
people were using apps app service right platform as a service and they just had un under they weren't utilizing all of
the virtual machine compute and so a customer must have said hey can i just
take my functions and utilize or utilize the unutilized compute on my plan and that's azure's
like sure and they made that a thing so it's just like an interesting way to
save money but it is one of those things where it is a little bit hard to understand because it's not uh as
isolate or modular in terms of functionality where we see other cloud service providers but those are your
three plans so there you go all right let's take a look at triggers and bindings for azure functions we
talked about them before but let's give them a little bit more attention so triggers and bindings let you avoid
hard-coding access to other services and abstracting away boilerplate code keeping your functions lean
because the idea is that you won't have to add that code into your functions so
here is our graphic which represents a function we have input bindings output bindings we have a trigger there so what
is a trigger a trigger is a specific type of event which causes the function to run
it defines how a function is invoked and a function must only have one trigger uh triggers can have associated data which
is often provided as the payload of the function and you know as we saw in the introduction that we can have multiple
sources of inputs that that get added there in this example here we have http but we're bringing in data from
blob storage as well and obviously the main trigger uh which http is an input as well so you can have
additional inputs at the same time then we'll take a look here is what is a binding
um and so my arrow's a little bit messed up but the idea is binding is defined if your
function is connected to another service so we have input bindings and output bindings
so the data from bindings is provided to functions as parameters bindings are optional and a function can have
multiple input and output bindings optional but often used which we'll find out but let's take a
look at what supported bindings are in the next video [Music]
all right now let's take a look at what supported bindings are available for azure functions there's quite a few here
and we'll quickly go through them just so you have a scope of idea so we have blob storage azure cosmos db
um or cosmodb i always want to add that s in there azure sql dapper which is a
run time we cover it in the course it's a runtime for distributed applications for
microservices event grid event hub uh http web hook that's gonna be the most common one you'll use iot hub kafka
mobile apps notification hub that's for push notifications queue storage messaging rabbitmq that is an open
source um viewing system sendgrid which is for sending emails service bus which is both
queuing and pub sub signal r which we don't really talk about much in this course but it's an open source.net
library to send asynchronous notifications to client-side web applications table storage timer uh
twilio all right and so what's also important to note and sorry i could not make this graphic better i really really
did try to present this better but it's just there's so many here but um the idea is
that some don't support triggers so like azure sql does not support triggers mobile apps notifications don't table
storage and twilio does not then you can see we have a big gap of inputs for a bunch here and a bunch there
it's not super important to know for the exam but the fact that that you don't get triggers inputs and
outputs across all services and there are some cases where the api version matters so like if you are using
version one some things are not going to be supported and even some cases version two like mobile apps notifications don't
have um uh don't have support so in some cases you do have to use uh version one
functions but most cases you'll be using version four so hopefully that gives you kind of
a broad idea of supported bindings but we're not done with bindings we'll be looking at more of it okay
[Music] let us talk about binding directions so all triggers and bindings have a
direction property in the function json file the direction of the triggers is always in and the input output binds
either is in and or out and some bindings support a special direction called in out
which a little bit confusing but it's nice to have a extra option this idea is we have a direction and triggers again
are always in and then you have in out and in and out um the trigger is defined alongside the
input and output binding so trigger will have the same as the input type but with trigger appended so for example if we
have blob that would be our input binding then we'd have blob trigger as the trigger and that's how you would
know the difference right so again just iterating see where it says uh a type here if it was just http
then it would just be a a binding but if it's a http trigger then it's a trigger with a with also an
in binding if you use the in and out only the advanced editor is available
via the integrate tab in the portal just so you know because there's a visualization of integrations that we
see in the azure portal and so they're talking about that in and out option there okay
[Music] okay so now what i want to do is just go through a few scenarios of triggers and
bindings to help cement the idea of their utility so we'll take a look at our first scenario so every hour you
want to read a new log file delivered by your application and you'll need to transform the data to be ingested
in your nosql or sql database that resides in cosmodb so here is our visualization we have our
function which is python for fun it's going to output the cosmodb so we need a binding out to there
it has a trigger um here that's just triggered by an acp request to the timer and we got
the blob storage so you use a trigger timer i guess actually the http shouldn't even be
there i think that's just a mistake but you use a trigger type timer because it's a scheduled job that will run at a
specified time the trigger will be in for the blob storage and out for cosmodb because whenever function runs it'll be
on a timer and when it executes it'll read data from blob storage process the data from blob storage and then write
some data in cosmo db so the key thing here is that this runs on a schedule you're not you're not
even though it's there you're not uh invoking it like with a an api request this is invoked on schedule let's take a
look at scenario two every time someone signs up to your application you want to trigger an email so here there is an
http request coming in and it's going to send out to sendgrid to send out that email so you want to develop an api that
allows you to send an email after request is received and you'll use http trigger because it's
an api that will be triggered based on this request for the bindings you uh you won't be accessing any data well the
function starts so the in direction is none and you'll be uh you'll use send grid
for the out direction which allows you to send messages via email looking at our third scenario consider a scenario
in which you're using a cue service and you want a function to process a storage message in one queue and enter a new
message in another so the idea is you have a queue again it's fun it's triggering something and it's going to
output to something so in this case you'll want to use um into it says consider uh scenario q
service where you want to function the storage message in one queue and enter in another so probably
this this icon's old but we probably should have this icon repeated twice because this is the sendgrid logo so
just imagine that we have we took this icon and we put it over here very sorry for that uh graphical error but um the
idea here in this case you want a trigger type of queue and a binding type of cue for the direction out because
you're not accessing the queue in the in direction you read the data from one queue and process it to create a new
message and then to write to a different queue which may or may not be connected to another service or function so there
you go [Music] all right let's take a look here at
bindingexpressions so in function json file and the function parameters code you can use binding expressions that
resolve to values from various sources so most expressions are identified by wrapping them in curly braces i say most
because there's an exception where you do not use curly braces but the idea is that
it allows you to have kind of dynamic content within your functioned json file and there are a variety of
different binding expressions we have app settings trigger file name trigger metadata json payloads
guid current date and time let's go take a look at what those look like the first is app settings so when
you want to change configuration based on the environment you're going to use percentage science this is the only case
where you use percentage signs uh it's confusing because it's the first example instead of curly so notice that
there's curly sorry percentage signs there um
and then for trigger file name this can be used to change the path of a file name works for both in and out
directions so here we have the curly's here to say for the file name
for trigger metadata many triggers provide additional metadata values these values can be used as input parameters
for c sharp f sharp or properties for context bindings and objects in javascript so for example if we're doing
azure queue storage sugar supports the following properties q trigger dq id etc etc
uh and then you'll notice that they are available here's the cq trigger is here q trigger
that's typed in camel case mode for json payloads when a trigger payload is json that means the the the data
being passes json you can refer to its properties and configuration of other bindings and the same function in the
code so you know if the payload was blob name and then hello helloworld.txt
do blob name and that would put that here okay um and
if some of your properties and your json payloads are objects you can use the dot notation so that's just a common
thing for json or yeah json or javascript um for for if you want a globally unique identifier
you can just do rand guid and you'll get something that looks like that if you want to have the current date and time
you do date time you're going to get the current date and time in this format so there you go
[Music] let's take a look at local settings file this is a file we saw uh when we were
looking at the anatomy of the local files and so the local settings file stores
app settings and settings used by your local development tools this file is called
local.settings.json is expected to be at the root of your project folder because the local settings json may contain
secrets such as connection strings you should never store this in a remote repository so make sure you add it to
your dot git ignore file here's an example of one so first we have is encrypted so when the setting is true
all values encrypted with the local machine key for values these are a collection of
application settings used when running a project so notice we have function worker runtime azure web storage uh or
job storage mybinding connections things like that the host customize the functions host
process when you run it locally and then connection strings used only by frameworks that typically get connected
strings from the connection strings area there okay okay so as your function core tools lets
you develop and test your functions on your local computer from your command prompt or terminal so it's a cli
uh and you type in func and allows you to do a whole host of things so let's take a look at the commands we have for
top level commands we have init so create a new function project in a specific language logs get the logs for
functions running in kubernetes cluster new creates a new function in the current project based on a template run
enables you to invoke functions directly which is similar to running a function using the test tab in the azure portal
start starts the local runtime host and loads the function project in the current folder deploy which was replaced
with function kubernetes deploy then we have command groups that contain their own set of sub
commands so we have func azure so this is when you're working with azure resources durable for
durable functions extensions for managing extensions if you're doing working with kubernetes
and azure functions you can do that if you are messing with settings that you do settings if it's with templates for
this available templates you can do that so there you go [Music]
all right let's talk about custom handlers these are lightweight web servers that receive events from
function hosts and they can be written as long as it supports http primitives and these are
really great in situations where you want to have a run time that is not supported for like a
language like go rust ruby uh or a runtime environment for a specific technology where you need a
bunch of libraries preloaded like ruby on rails or deno and so within your function
function json the idea here is you'll have a custom handler section and this is going to just basically define the
executional execution path because it basically is running a program custom handlers you can use
triggers and inputs and output bindings via the extension bundles
okay so let's kind of visualize that so we really understand that this is like a separate thing that's running
so the function will pass along the payload to the custom handler the communication between the function and
custom handler is via https requests and response the custom handler runs on white lightweight web servers
the underlying compute will likely vary based on what service plan is chosen so it's going to be other places i couldn't
really figure out where they were the custom executable for the custom handler is bundled along with your
function code so there's that there uh some some things about the application structure
to implement a custom handler your application must have the following a host json file a local settings json
file a function json file uh a command script or executable which will run on the web server
uh and then the following diagram shows how these files look on the file system for a function named myq and a custom
handler so here you can just kind of see it's not the prettiest but i mean it
gets the point across the idea is you have a folder here's your function json and this one happens to use an
executable in practice custom handlers are super super hard to do uh and i think i mentioned this before
but you know i was trying to set up a ruby one and it didn't work and i try to set up
the the tutorial one that's in the docs for rust or go that didn't work i reached out the person that made it that
didn't work i reset the azure support they didn't know how to do it so um if people running custom handlers if anyone
figures it out please tell me uh hopefully i do figure it out and we get included in this course if we don't just
understand if i couldn't do it then i don't it's not a big deal if you don't know how to do it okay but for me i
personally would have loved to run ruby because that's my favorite language to use
and that's what i would use on azure functions [Music]
okay so let's say you are making a custom handler you deploy it and you end up having an error that says runtime is
unreachable what do you do well not a whole lot but i can i can tell you that there are some things that you can
narrow down because a runtime could not be running for multiple reasons um so
uh you know the idea is that the runtime couldn't start and so there are some common reasons that azure suggests that
it could be so it could be storage account was deleted storage account application setting was deleted storage
account credentials are invalid storage account is accessible daily execution quota is full
app is behind a firewall so there are your possible reasons for things to go wrong uh i just wanted to share that you
know i ran into this and i i didn't necessarily get through it but i i wanted to share it to you possible
solutions okay [Music] hey this is andrew brown from exam pro
and we are taking a look at durable functions so durable functions is a serverless
compute extension of azure functions that allow you to write stateful functions the extension introduces two
types of functions so we have orchestrator functions this defines stateful workflows implicitly
representing state via control flow and entity function which manage the state of entity explicitly representing state
they define workflows in code so no json schema or designers are needed but honestly i would like one because other
providers like aws have like no code solutions so it's kind of weird they try to make it like sound like an advantage
but it isn't really an advantage they can call out functions synchronously and asynchronously uh the
output from uh from the called functions can be saved to local variables they automatically
checkpoint their progress whenever the function awaits local state is never lost if the process
if the process recycles or the vm reboots so durable functions currently support
the following languages so we have for c-sharp javascript python f-sharp
powershell and powershell seven to use durable functions you need to install a library specific to your language in the
root of your function app project such as npm install durable function so there you go
[Music] all right so if we are going to be having stateful functions we are going
to need a variety of different patterns for setting up
different kinds of serverless workloads let's take a look at them the first is function chaining so this is the pattern
of executing a sequence of functions in a specific order often the output of one function needs to be applied to the
input for another function durable functions allow us to implement this pattern concisely in code then you
have fan out fan in so this is this is a pattern of executing multiple functions in parallel and then waiting for them
all to finish fanning out can be completed with normal functions by having the function send multiple
messages to a queue fanning in is much more difficult because we have to write code to track when the q triggered
functions end and store function's output the durable function extension handles this pattern
with relatively simple code we have async http api so this pattern addresses the problem of coordinating
the state of long-running operations with external clients a common way to implement this pattern is to have an
http call trigger the long-running action then redirect the client to status endpoint then they can pull to
learn when operation when the operation is complete durable functions provide built-in apis that
simplify the code we write for interacting with long-running function executions the monitor pattern refers to
a flexible recurring process in a workflow such as polling until certain conditions are met a simple scenario
such as a periodic cleanup job can be addressed with a regular time trigger but it is interval but its interval is
fixed making managing instance lifetime difficult durable functions enables flexible recurrence intervals task
lifetime management and the ability to create multiple monitor process from a single orchestration a little bit more
here so we have human interaction so many automated processes involve some form of human interaction humans are not
always available and responsive as cloud services which makes invoking humans an automated process tricky so
automated process must must allow for this and they often do so by using timeouts and compensation logic
then we have aggregators so stateful entities this pattern is about aggregating event data over a period of
time into a single addressable entity the data being aggregated may come from multiple sources be delivered in batches
or may be scattered over long periods of time the aggregator may need to act on event data as it
arrives external clients may need to query the aggregator data so there you go
let us take a look at azure functions on kubernetes now i don't think this is on the exam but i just thought it was very
interesting a thing that azure functions can do uh and so i just kind of wanted to run quickly through it so you can
deploy any azure function app to a kubernetes cluster running on k running k-e-d-a if you don't know kita it is
kubernetes event-driven auto-scaling uh service and allows you to set up auto-scaling based on events from
various cloud native services and third-party services so in this case
it could be for azure azure function apps and so when we were looking at the core
uh core tools azure power tools whatever you want to call it um they had an opera they had the option to
deploy to uh kubernetes so i'm gonna assume that you'd probably be running an aks azure kubernetes service uh but
let's just read through some of the things here so kubernetes-based functions provide the functions runtime
in a docker container with event drive driven scaling through kita
kita can scale into zero instances with no events occurring and out to n instances so it scales to zero it does
this by exposing custom metrics for kubernetes auto scaler so horizontal autoscaler using function containers
with kita make it possible to replicate serverless function capabilities in kubernetes cluster these functions can
be deployed using aks virtual node features for serverless infrastructure i'm really curious like how they're
running and like other things there but that's outside of the scope of this course but you know if you're into
kubernetes and i do have a kubernetes course um you know it's just interesting to see that that is a functionality
there and so i just wanted to call that out for our kubernetes fans okay [Music]
hey this is andrew brown from exam pro and we are looking at azure virtual machines which makes it easy for you to
choose your own os compute memory and storage and launch a server within minutes
all right so let's take a quick look here at vms for azure and this is a highly configurable server that relies
on virtualization meaning that you're running a server without having to actually buy and maintain physical
hardware that runs it you will still have to manage things at the software layer so you would have to apply your
own os system patches and installing the configuration packages but the nice thing is that you're not dealing with
that hardware it's just going to work for you and some things i want you to know about azure virtual machines is
that the size of the virtual machine is determined by the azure image uh and so the image defines the combination of
vcpus memory and storage capacity the current limit on a per subscription basis is 20 vms per region i would think
that if you wanted more you could just use another subscription i don't know if they have service limit increase for
that but that might be possible as well azure vms are billed at an hourly rate an instance uh or a single instance that
you launch is going to have availability of 99.9 percent when you're using premium disk if you have standard disk i
have no idea what it is um but it's going to be less than that if you want to get 99.95
availability you're going to have to launch two instances within an availability set and you can attach
multiple manage this to an azure virtual machine now just to give you uh like a quick
visual of what's actually happening when you launch an instance because when you do launch a virtual machine there's
going to be other networking components that are going to be created or associated with you and you definitely
need to know all these components here so i have this nice diagram we're going to do a quick run through with it and i
want you to just know that when you do launch a virtual machine it actually does give you a list of all the
components that it creates this is actually very common with most azure services and sometimes what they'll do
is they'll put it within a resource group for you so that they're all grouped together which is very nice
but let's just run through these common components that you need to know such as the network security group and this is
going to be attached to your network interface it acts as a virtual firewall with rules around ports and protocols so
that is what's protecting our virtual machine you have the network interface that handles ip protocol so that's how
the virtual machine talks to the internet or other things on the network you have the virtual machine
itself or the instance that's a the version or the uh instance that is currently running
it's going to get a public ip address assigned to it so that's how um people from the internet can actually access
the virtual machine and then you have to launch it within a virtual network uh and so that's you're
going to have that v-net so you'll either you'll either choose one or you'll be creating one uh during that
wizard process so there you go [Music] so now let's take a quick look at the
options for operating systems on azure vm and let's just define what an os is uh so the os is the program that manages
all other programs in a computer and the most commonly known operating systems are windows mac os and linux and when
you want to launch a virtual machine the way you determine what operating system you use
is based on the image that you choose okay and
azure has a marketplace so they have so many different kinds of operating systems you're going to have every
possible option you want and microsoft has also partnered with specific companies to make sure that they're
providing you images that are updated and optimized for the azure runtime so let's do a quick run through of these
supported or partnered os's so we have seuss we have red hat ubuntu debian freebsd
then you have flat card container linux rancher os which is for containerization but nami binami is more like images that
have preloaded software on them they're very popular for their bitnami wordpress you have mesosphere
and then you have images that have docker with it so you have a lot of options open to you there and i always
forget about jenkins and jenkins is on the end there now if you want to bring your own linux version you can totally
do so all you have to do is package it into a virtual hard disk or a vhd if you've never heard of vhds uh these
are these are just uh virtual hard disk formats that you can create using hyper-v software which would be on your
windows machine and just be aware that azure doesn't support vhdx which is a newer format it
only uses vhd okay so there you go [Music] so let's take a quick look here at cloud
and knit and this is something that's not going to be on your exam but it's something you absolutely should know and
need to know because it's an industry standard and it's just something that uh you might like if i didn't show it to
you no one's gonna show it to you so let's just get to it and so cloud init is this multi-distribution method for
cross-platform cloud instance initialization and it's supported across all major uh public cloud providers so
azure aws gcp it's provisioning systems for private cloud infrastructure and bare metal installations so what is
cloud instance initialization well this is the process of preparing an instance with configuration data for the
operating system and the runtime environment and so uh the idea is that you're going to have cloud instances
that are initialized from a disk image and instance data right so the image is whatever the the the vm image is but
you're going to have data such as metadata user data and vendor data and i'm not going to get
into all the data i just want you to know the one which is the one you'll be working with is user data
and so user data is a script that you want to run when an instance first boots uh and so um
if you've ever used aws and you launch an instance you'll see a box in the the wizard that says user data and that's
what this is uh in azure i don't think they make it as clear i don't think they call it user data but if you're
pragmatically doing it with um arm templates when you're doing infrastructure as code
that is what you're doing you're using cloud in it underneath i just wanted to make that association to you so when you
see that word user data you think cloud init and so cloud in it really only works
with linux distributions so um it should work with all the linux distributions on
azure i'm pretty sure it's not being used for windows machines but there you go
[Music] azure virtual machines come in a variety of different sizes that are optimized
for specific use cases and the way azure groups these are into types so that would be like general purpose compute
optimized and sizes and sizes is kind of a weird word because i've seen in other places in
their documentation called series or sku family so you'll see me using those three terms interchangeably they
definitely confused me when i was looking at it at first but let's just go quickly through some
of them there's a lot of them so they're not going to be all of them on the list here
but we'll just quickly go through it so the first is general purpose these are balanced cpu to memory ratio testing
development small to medium databases and low to medium traffic web servers this is pretty much what you're going to
be using unless you work for a company that has a lot of money and the one you're going to see the most is called
b1 because it's super super cost effective and that's the one i'm always using when
i'm launching linux machines you'll see me using it through follow alongs here in this course the
next one here is compute optimize so that's high cpu uh uh to memory or ratio good for medium
traffic web servers network appliances batch processes and app servers so this just has more cpu here uh the most
common one is the fsv2 or the f series then you have memory optimized so high memory to cpu ratio great for relational
databases being able to hide large caches and in memory analytics and we have a variety of skus there
then you have storage optimized so these are high a disk throughput and if and ideal for big data sql no school
databases database warehousing and large transactional databases and we just have lsv2 for those
then you have the specialized ones for gpu for heavy graphic rendering video editing model training and
interferencing with deep learning so available with single or multi multiple gpus and so we
have a variety of skus there and then you have your hpcs your high performance compute and these are the the most fast
and powerful cpu virtual machines with uh with optional high throughput network interfaces all right and i just want to
point out that there are more here um but uh i'm just showing you ones that are occurring so there are previous
series um here like we're not showing basic a all right like the a series is not being shown here now when you want
to actually go see this full list here it's very easy you just launch up a virtual machine and uh you're going to
be able to choose two things you're going to choose the first the image so that's going to be
what do you want to run right so it's going to be ubuntu or windows machine and then you're going to
choose your standard size image i believe that if you choose certain images not all sizes will be available
to you because some images have to be optimized for
those uh series sorry i'm just drinking some tea here uh and so there's that b1 series
and you can see in canadian dollars it's 9.72 which is a pretty good price for me and you can explore all the costs in
azure which is really nice you don't have to go to a separate marketing website you can just open it up and you
can just sort by the lowest cost which is what i always do and they have a lot of filters there so
there you go let's quickly talk about azure compute units so azure compute units
also known as acus provides a way of computing comparing compute so cpu performance across azure skus remember
we said skus is the same thing as sizes or series so you'll just see us varying the terms
on that acu is currently standardized on a small so standard a1 and you saw prior that a1
is a previous series so it's not something that you generally be launching but everything's based off of
that one and those are given a value of 100 it's just an arbitrary number to um give it a
point against other machines and all other skus then represent approximately how much faster that sku can run a
standard benchmark i don't fully understand the math behind uh their their stuff here but i generally get the
idea here and i'll just show you quickly a quick comparison so here we have the a1 to a4
series against the d1 d14 series a1 is our baseline at at 100 acus
and it has a ratio one to one from vcpus to core and so you can see that for d1 to d14 it says 160 points to 250 points
and so if i did the math here right i think i did uh it's going to be basically 60 to 150 percent more
performant than choosing an a1 to a4 so that's how that works so there you go [Music]
so here's a neat feature that azure virtual machines allows you to do and you can actually do this with a lot of
different services with azure and it's the azure mobile app and so what you'll notice is that when you're using virtual
machines they might have this little qr code and if you have the app installed what you can do is scan that code but
honestly you don't even need to scan the code if you just have the app installed connect your account you can
log in on your phone and check out the virtual machine how it's performing and you can take basic actions there i
believe as well you can access the cloud shell so it's pretty darn cool um and so i just wanted you to know about that and
if you haven't just go ahead and install it on your phone i think it's available for
um android and ios i have an android phone so i didn't check ios but um yeah go check it out
so sometimes when you're launching a virtual machine you'll have the option between generation one versus generation
two when you're choosing images and i want you to know about uh this stuff here and to understand it we need to
know a little bit about hyper-v so hyper-v's is microsoft's hardware virtualization product and it lets you
create and run a software version of a computer called a virtual machine and each virtual machine acts like a
complete computer running an operating system and programs and so if you're still kind of
wondering what hyper-v is if you've ever heard of virtualbox which is used for running vms on mac and linux
this is the this is basically the exact same offering it's just windows offering okay and it already comes pre-installed
on windows 10. so you might have to toggle something on i can't remember it because it's been a long time since i've
had to configure it but the point is you have a windows machine you're already
ready to start using hyper-v and hyper-v has two generations of virtual machines so the first one was generation one and
this uh this will support most guest operating systems and then generation two supports most 64-bit versions of
windows and more current versions of linux and freebsd operating systems and there are these two here but
neither one or two is bad so they both have their own use case so it's not like you should always use two
and there's a big list online but we're not going to get into that full list but anyway so we see that hyper-v has
generation one and two vms but azure also has them as well but they're not one-to-one the same as hyper-v
generation so if you look up hyper v uh like the hyper v generation um feature set you might not have that in azure so
i wouldn't rely on that list but what i definitely want you to know between azure gen 1 and gen 2 that's a
key difference is that gen 1 is bios-based architecture and gen 2 is u-e-f-i
based boot architecture and if you've ever built a video gaming machine you definitely know the difference between
these two if you don't it's just the way the machine boots up it's the first screen you see
um and it's going to change what kind of configuration options you have and you you uh uefi has a lot of great features
in it so for instance it has secure boot which verifies the bootloader is signed by a trustee
authority and you can have larger boot volumes up to 64 terabytes
and if you want to know more you'll just have to look up uefi because i'm not covering it in this course i just want
you to know that's the the key difference there and hyper vvms are packaged into virtual hard disk formats
so that's going to be either vhd or vhdx files okay one thing you might want to be able to
do is actually get into your virtual machine and we have a lot of different options available to us in fact we have
three ways to connect to our virtual machines we have rdp ssh and bastion and so if you don't know these things we're
going to walk through them right now the first is secure shell and this is a protocol to establish a secure
connection between a client and server this is how you can remotely connect to a
azure virtual machine via a terminal ssh happens on port 22 via tcp port 22 is something you should absolutely
remember as ssh and you will generally use an rsa key pair
to gain access you can also use username and password but most people don't do that anymore
another way of getting access to your machine is by using rdp which is remote desktop protocol this is a proprietary
protocol developed by microsoft which provides a user with a graphical interface to connect to another computer
over a network connection basically what it means is that it's going to open up a window and you're going to be able to
see like another windows desktop in it and control it remotely so this is how you can remotely connect
windows server to a virtual desktop rdp happens on port 3389 via tcp and udp i think there might be some other ports
but this is the port that you need to know i just remember from aws because there
were some extra ports i had to configure but that's a different story
then you have uh your bastion which is your third option and so azure bastion which is actually an
azure service is a service that you can deploy lets you connect to a virtual machine using your browser and azure
portal and so the reason why this is so useful is that
if you have let's say a chrome desktop which doesn't actually
it can't actually use ssh client or can't use the rdb client this just gives you another way of using the
browser so you don't have to install those clients but we'll get into that shortly
here okay [Music] so let's take a closer look at ssh and
the most common way to access your vm or to authenticate yourself uh so that you're allowed to get into your vm with
ssh is by using ssh key pair and so the idea is that you're going to have to generate out two keys that's why
it's called a key pair there's two keys and so you'd use that command ssh hyphen keygen hyphen t rsa and that is
something that is definitely etched in my memory it's definitely something you want to memorize because it'll be with
you throughout your entire career and so you're going to have a private key and a public key and so the way these keys
work is that the private key should remain on your local system and not be shared with others and the public
key is going to be stored on the vm and when you go ahead and ssh you're going to provide your private key
as part of the ssh command and it's going to try to match it against the public key to
authenticate you and so that is what you normally do ssh hyphen i provide the public key see where it says dot pub
that's how you know it's a public key and then there's the actual address of the server um and that's how you're
gonna gain access okay so let's take a look at the process of using rdp
so the first thing you'll want to do is download the rdb file so when you go and try to connect to that virtual machine
you're going to go ahead and download the rdp file that's going to download this rdp uh
this file that has rdp extension you're going to double click that file and you're going to be prompted to fill in
your username and password this uh this username and password is what you specified when you created your virtual
machine and i just want you to know that if you are on a mac you can install the remote desktop
client from the apple store but if you're on windows you already have rdp client installed there's
nothing extra that you have to do [Music] so let's take a closer look here at
azure bastion and this is an intermediate uh hardened instance that allows you to connect to your target
server via ssh or rdp and it will provision a web-based rdp client or ssh terminal i'm going to tell you honestly
i never really thought of this use case for bastions prior to this but the reason
like bastions are good or have still a utility these days is because some people are using a google chromebook and
they're not going to have a terminal so they can't use ssh or if they're on windows they can't sell the
putty client or if they're on windows they can't they won't have the
remote desktop client and so the only way is through the web because a google chromebook's all a browser and so this
is one of those utilities for a bastion now bastions don't necessarily are just for this use case they're definitely a
very good and secure way to connect to your virtual machines and having a way of auditing who has access to what
but this is the use case that azure is putting forward with bastion here and so the idea is that when you want to create
a bastion you're going to have to add it to a subnet uh in your v-net or you're gonna have to
make a new subnet and it has to be called azure bastion subnet and it has to have at least a size of four slash 27
so 32 addresses so that's what you're gonna have to do so um you'll just have to go in and add
in that subnet there and then once you do uh you can go ahead and launch your
bastion so let's first take a look at rdp uh and so rdp uh we saw how to do it but let's see what it looks like with
with azure bastion so what you do is you say connect with azure bastion for your windows machine that's going to assume
that you want rdp you're going to just put in your username and password as you normally would and boom you're in your
machine that's all it takes let's take a look at how you deal with ssh so you know if you're using a linux server
it's going to obviously want to use ssh because you don't have rdp for that and so
you can actually use either the ssh private key or the the username and password
i recommend using always ssh private key let's take a look at that process so
you'll enter your username in and then you can switch over to ssh private key and then
the dot pem file which is downloaded locally to your machine which is your private key you can just
uh select it and then that will upload it and use it in the comparison and boom you're in your machine so
that's just kind of a cool service that they have there let's just do a quick comparison between
windows and linux servers this is going to be very obvious for people that are used to
running windows workloads but for those who uh grew up on linux i just want to make
sure you understand some of the caveats of windows that you might not be used to so
obviously azure allows you to run both windows and linux instances or vms
and so let's just talk about windows first so when you launch a windows server just like your desktop computer
it needs a windows license to run whether it's windows 10 or whatever windows server you're using but
i just want you to know that when you launch your your server you don't necessarily have to have the
license on hand and so if you launch a server without a license um all it's going to do is say windows
is unactivated and you're going to take some manual step to activate that license and i just want to tell you that
so that you're not afraid of launching a windows machine because you think you're going to get charged a license fee uh
it's not going to happen you have to take some manual intervention to do that so do not worry about launching that
windows machine you can bring your own license via a hybrid license so some people like
enterprises already own their licenses and they just want to uh they already made a deal with microsoft and so they
just want to reuse those instead of using whatever azure provides because it can be cheaper
you're going to set a username and password because you're using rdp to access the machine so you're not using
your ssh key pairs um windows machines require
larger instances okay so if you're running windows 10 or whatever it needs a lot more memory and so you're
gonna have to run it on a b2 which is a lot more expensive than a b1 and that's because it runs a full desktop
environment all the windows servers do this and so this is generally why i like
running linux so just be aware not to keep your windows server running for very long if you
don't have a lot of money and you're just learning to pass the certification let's talk about linux really quickly
here most versions of linux require no type of license so i think like you can get red hat you
might need a license for that if you want support you set either a username password or ssh key pair you can utilize
smaller vm sizes because you're not running a full desktop experience could you run
like a full desktop experience possibly i haven't ever tried to do it on cloud myself
uh unix and like space uh are unix and linux-based systems traditionally are terminal based environments right so
you're going to be sshinging into them and you're not going to have something visual okay so there you go
[Music] so let's talk about update management at the start of this section for virtual
machines i had said that there was some uh requirements ongoing software patches
and things that you had to perform on your virtual machines and so that is something that you have
to take care of but if you wanted to automate that process this is where you can use update management so that's what
it'll do it'll install operating system updates and patches for both windows and linux
and not only can it do it for your virtual machines on azure but it can do it on premise and even in other cloud
providers okay and the way this is going to work is
you're going to go to your operations tab where it says guest plus host updates and you're going to click on
update management now update management looks like it's its own service but it's actually using
azure automations under underneath and so that's what is installing the agent and the agent is
the microsoft monitoring agent mma so that's how it knows what to do you have to get
that installed on your machine so update management will perform a scan for update compliance a compliance scan is
by default performed every 12 hours on a windows machine and every three hours on a linux
machine it can take between 30 minutes and six hours for the dashboard to display
updated data from managed computers and i just wanted to point out a little bit about azure automation so because it
does more than just obviously update management but azure automation you can enable update management change tracking
inventory start stop vms during off hours features for your servers and virtual machines and these features have
a dependency on on a log analytics workspace and
therefore required linking the workspace with an automation account so there is a little bit extra that we have to have
but there you go [Music] hey this is andrew brown from exam pro
and we're going to be launching our own bastion using azure bastion services so there's two ways to set this up we can
go to bastions over here and create a bastion this way or we can create one after we've created a virtual machine i
prefer the latter so let's go ahead and do that and launch ourselves a new virtual machine and so we could either
use launch a windows server or a linux server today i'm going to be launching a windows server
and what we'll do is go down here i'll make a new group we'll call it the enterprise
and as we do that we'll just name this uh enterprise d
and we'll launch that in canada centra or us or central us that's fine with me uh 2019 data center gen 2 is totally
fine if you go here you're trying to find it you go hit select
and we'll choose gen 2 data center it is expensive but uh we're not going to be using this for very long
for the username i'm going to put data and for the i'll just make it azure user
to make our lives a bit easier and then we'll put testing capital t one two three four five six
testing one two three four five six and we will go down below we're fine with the settings here we're gonna go
next to disk we're gonna leave the disk to premium that's fine uh we'll let it create a new network that's totally fine
management is okay and we'll just actually go hit review and create
and now we'll just hit create so that it will go ahead and do that it'll tell us that it's in progress
and we'll just wait a little bit here i'll see you back in a moment all right so our instance is ready so
let's go ahead and go to this resource here and then on the left hand side you'll have connect and so i'm going to
show you and you don't it's not necessary for you to do uh this step because you're going to i'm going to
show you how to connect be the bastion but i'm going to go ahead and download this file the rdp file this will only
work if you're on windows by the way well i guess it'll work on mac but you'd have to install the um
uh the rdp service for the users with windows there and so here this is azure user
we're going to type in testing with a capital t just double check that there i'm going to log in make sure that this
works uh do we'll do that one more time oh you know it's testing one two three four
five six there we go we'll say yes
and we'll just make sure that we can uh remote desktop into this just before anything else and there we go so that's
all good to me i don't need to see any more we'll go over to bastian we'll say use
bastion and this is going to set up a bastion service in order to use bastion you need to have another
address space defined for it it makes it really easy to
make it here so i'm just going to go 10.0.1.04 and we'll go ahead and hit ok
and so down below it's going to choose an address space we have a security group um i'm just
going to put it for none i don't think i want one on that and if we scroll on down here we have
the resource group so we're going to put in the same resource group and we'll go ahead and create that
so now before this they didn't have this really nice wizard used to have to go and and create all those things
individually in your virtual network but this is really nice it does take a bit of time for this to provision so i'll
see you back here in a bit that took a bit of time for that to create that bastion but it is ready to go and so now
that we have it we can go ahead and utilize uh this connection here and so right away it i think it's setting up
for rdp here so what we'll do is type in azure user and then capital t testing one two three
four five six we'll go ahead and hit connect and so notice that i didn't have to use
an external application i could just run it in right here it's all in the web browser so that's
pretty much how the bastion works i can't remember the pricing on bastion i think it's a little bit of money so i
don't want to keep this laying around here but this is great if you let's say you're on a chromebook which are
becoming really popular where you can't install native applications uh or you're just having issues because you're on
like linux or something like that so there you go that's all there is to it we'll go ahead and clean this up
and so i'm just going to go here find the resource group and we'll go ahead and delete i'm just
making sure that bastion's within there so it is good and there we go
[Music] so we just launched a virtual machine for linux now let's go ahead and launch
one for windows i'm going to go to the top here and type in virtual machines we'll go to the first link i'm going to
hit add add virtual machine and what we'll do is we'll create a new
group the last one i had was called bajor i'm going to call this one cardassia
cardassia and i'm going to name this machine also named cardassia
and this time what we want to do is is we want to move over to a windows server i find the easiest one to learn with is
the windows 10 pro server just because i find these ones a little bit daunting so i'm going to go windows 10 pro
and then what we're going to do is go choose a larger size this is not going to work we cannot run a windows server
on a b1 ls so we're going to have to go a little bit larger and we don't have to go too much larger
here but the idea here is that there's going to be a more expensive spend here so we're not going to be running to keep
this running for long but here we have the b2s that is the appropriate size to run this anything smaller i don't think
is going to work and we are going to put in a password here so i'm just going to put in
cardassia and we'll do cardassio123 put a capital on it i guess
we'll just do this here and i'm just going to go back and lower case this one
and we're going to allow the inbound port of 3389 because that is what rdp needs i'm going to confirm that i have a
windows license i actually don't but the thing is you can still launch one for your test purposes it'll just complain
saying you're not activated so there are some limitations but it's good enough for us to learn okay and so now that
that is all great we'll go next to disks we're going to go with premium or standard ssd this time
uh we're going to go ahead and hit next and go to networking it's going to create us a new v-net which is a great
idea we're going to let it create a a network security group on the nick just like before we'll go ahead and hit
next uh we'll leave all these options alone this all seems fine to me
uh and we'll hit next review and create and we'll go ahead and create this
server all right and so that's gonna go ahead and create it so i'll just see you back
here in a moment when that's done deploying all right so after a short little while here it looks like our
windows server is now deployed so what we can do is go to that resource if you wanted to see what it's deployed it's
the same stuff as always you have your network interface card your virtual networks
nsg the ip address but let's actually go to that resource now and so let's see how we can gain access
to this virtual machine and so what we can do is use rdp luckily i am on a windows machine and so
i already have the rdb client that i can use so all you got to do is download the rdb file
and then once we have that file i can just double click it and i can open this up if you're on a
mac you can download the app in the app store and so i'll go ahead and type in my password so my username was cardassia
and then my password was capital c a-r-d-a-s-s-i-a one two three we'll hit okay
and then it'll give us another one we'll say yes and now we are in our virtual machine so
there you go how cool is that i'll just give it a moment to load up but this is a full uh windows 10 pro
uh and as i said before you know we don't actually have a license so if you're afraid of spinning it up because
you're gonna get charged a license fee uh for windows you do not have to worry that's not gonna happen you have to do
some manual intervention uh for that to happen so we'll just wait a little while here for this to load um it is not we're
not using the most powerful machine so it does take a little bit of time and so we just hit accept here
and here we are so we are on uh we have our nice windows machine here whoops
i don't know if it has any games let's go take a look maybe play minesweeper
um no maybe maybe you have to download the store i'm not that familiar with windows
machines but um so there you go so we'll go ahead and close that and you know if we were using the bastion it's the same
process you saw how we used it with ssh but if we had the bastion and it's so much work to set one up we already did
that before uh but all you do is enter your credentials in on the page just as we did and it and it's just a lot easier
that way uh so let's go ahead and just tear down this machine we're all done with it so i'm just going to hit um
uh delete and uh if we find that resource group we
should be able to easily delete them all i find the easiest ways to go up here go to all resources
and then there's the resource group there and then hit delete resource group and then i'll type in the name of it
which is cardassia and i'll delete all those resources but after that's done always just take a double check
on your all resources tab and just make sure that those resources are gone just because sometimes they
stick around but there you go that's as simple as it was to launch a windows machine
[Music] hey this is andrew brown from exam pro and let's take a look here at virtual
machines which i consider the backbone of most cloud service providers and azure keeps it really simple by calling
it virtual machine so we can go up here and type in virtual machine and make our way
over here but right now i don't have any options because i'm using a tenant that doesn't have a subscription applied to
it so what i'm going to do is go switch back to my original tenant and this one has this subscription applied to it
and so what i'll do is just click back up here and now we'll just type in virtual machines
and i can now see uh i have options of creating virtual machines let's go ahead and go create a linux one first and then
we'll go ahead and create a windows one and then we'll see how we can connect to it all right so first we'll go to the
top here hit add we'll click on virtual machine and we're gonna be present with a lot of
options so we'll have to choose a subscription and so there is mine i want to probably create a new resource group
here i'm going to call this one bajor and i will name this uh bajor again
and i'm going to launch this in us east i'll just set it to one availability zone for the time being
then here we have what we can choose as an image i can click on see all images and choose from a variety of them so if
i didn't want to use ubuntu i could launch something else like debian or something like that
but really i just want to stick with uh ubuntu because i'm fine with that version with 18. uh then here's what
what really matters is the size because that's going to affect our cost so if we click on see all sizes we have this
nifty table where we can sort the cost it's just loading the cost here it's dynamic
this is going to be based on uh what your base subscription is so if you're in canada you're going to see canadian
prices in the us you can see us prices etc etc and i care a lot about cost here so i'm
just going to sort this by cost and here we have the b1 ls which is very cost effective
we have a ram of 0.5 gigabytes and some other options there so we'll go ahead and select that there
and we have a couple options we can use ssh public key or we can uh utilize a password and so i think what we'll do is
use an ssh public key because that's pretty much the standard there we're going to name the username beige or if
it lets us probably won't probably want some additional options there nope it's okay
oh great and we'll go ahead and generate a new key pair and i'm just going to name that one
bajor and uh we have some options here for inbound rules uh so you could set to
none this is just setting up the nsg for you but we're probably going to want to have
that port open for ssh because that's how we're going to make our way back in here if we're running a um
like an apache server we'd want to have port 80 open so we can go ahead and do that
we'll take a look at now disks so here we have options between premium standard and standard hhd
i just want this to be cost effective so i'm just going to go with standard hdd but generally you you want to have
at least a standard or premium ssd when you're running real web development workloads
then there's encryption here and so it's always turned on by default which is great they also have this option of
double encryption with the platform managing customer manage key we're just going to leave that as default enable
alter discompatibility that's not something we need to do here because we are not using ultradisc
and here you can see that you can attach multiple uh disks here so i can go and do that but that's not
something i need to do today and some other advanced options which we do not care about we'll go over to
networking and so it's going to end up creating us a new v-net for us and we'll create a new subnet for us and assign it
a ip address uh it will also set up a nics network security group so the next
security group is not going to be applied at the subnet level it's going to be applied at the nic which is
attached to the um dc2 there and so we'll just leave it to basic we're going to allow inboard
inbound ports for port 80 and 22 that was carried over from earlier
we can put this behind a load balancer but i don't think we're going to do that right now
we'll go over to management uh we have some additional options here for monitoring uh this is all okay here we
can set it to auto shutdown actually i'll leave that alone you can also enable backups here
we'll go advanced and now we have this option here for custom data
i covered a section on cloud init and they don't call this user data but most other providers will call this user data
so we could provide a bash script or additional information here if we wanted to
then down below there's some host group options we're not going to worry about that in proximity placement group this
is really important if you need to have instances nearby uh i think this is pretty common with um
what's it called high capacity workloads hfc i can't remember the initialism right now but we covered in the core
content then we can tag our resource here uh we'll just leave that alone i don't care about tagging too much but
generally it's good to tag in practice and then we will get to review and create our server here we'll go ahead
and hit create and then we'll have to download our private key so we can utilize it later
and so that's downloaded there and now we're just waiting for it to deploy this and i'll see you back here
in a moment so we had to wait a little bit there and finally our deployment is complete
and we can go ahead and just review all the things that it created so notice that it created the virtual
machine it created a network interface a nic for us the nsg the network security group
the virtual network and also a public ip address when i do clean up a lot of things i
always miss are these ip addresses and i know that azure gave me a warning that said hey you're about to spend
uh 700 yearly on ip addresses because you weren't releasing them so when we do the cleanup step i'll
definitely emphasize about deleting those ip addresses and how to go about that
let's go take a look at the actual resource now so here we are and you can see we have a
lot of options the left hand side such as the disk so we can see the disk options there and
there's other additional security options let's go take a look at how we can go
ahead and connect to the server and so there's different options here so we have rdp ssh and bastion since we are
using a linux machine we're not going to be using rdp that's really for windows um but the trick here is that um
i would need to have a client on my computer to connect like um i think it's called putty if you're on a
linux based machine it's a lot easier uh and certainly i have the linux subsystem installed so i could probably
um connect that way but i figured let's just go ahead and connect via bastion because i think this
is a pretty darn cool feature so let's go ahead and create ourselves a bastion and this will take a little bit of time
here but we'll go ahead here and just set up subnet so to associate a virtual network
to a bastion they must contain a subnet with the azure bastion subnet so they actually have a special subnet for it
so what we'll do is we'll just go back to our um our server here
which we call bajor and i think we can find the subnet through here
so on the left-hand side if we go to networking we probably could find it that way um
so i'm just looking for that security group um in there
it should be um maybe it's not there if it's not there
um well you know we could just go over make our way over to subnets it's not a big deal
because it's called bajor it's pretty darn easy to find to begin with and so under subnets here what we need to do is
add a special one here and just gonna remember how this works um so you need to create a subnet called
azure bastion subnet with a prefix of at least 27. so we'll go ahead and add a new subnet
and we'll call it that uh we'll take out the space there and the range is 10 0 1 0 etc so we'll
just do it on two zero dot um two dot zero four slash twenty seven
uh ten zero zero two is not contained yeah it overlaps so we'll do two
let's not contain the virtual network address space oh right so we have to add the address space first
oops we'll just hit cancel here that's okay we'll discard that we'll make our way over to address space and
we'll go ahead and add 10.0.2.0424 they'll give us a pretty darn large range there
and so now what we'll do is go back to our subnet and we'll go ahead and create that there
and it said it only needed 27 so we'll just give it only 27. we don't need to go bigger than we need
and that should be okay we'll go ahead and hit save and it shouldn't take too long so now
that we have that we can go back here and we'll give give this another go here uh it's there so it shouldn't be
complaining maybe what we'll do is just start from the the start here again
yeah there you go the azure portal is like that a lot where you'll have something set up and it has the old
state of it and so you just have to trust yourself that you know what you're doing and you have to go back if you
don't have a lot of confidence a lot of times you'll get stuck and you'll think okay i don't have it right but i always
just try again and hit refresh because the azure portal is very inconsistent so we're just going to wait
for this to create this does take a little while to create so i'll see you back in a moment
so after waiting five minutes our bastion is now created and so what we can do is without even using a putty
client or having to use linux directly we can just connect through via the bastion
so here we'll see we have some options here so we want to do ssh private key from local file
okay and what we can do is go ahead and select our bajor key
and then i'll just scroll down here and hit connect oh um and i think we made the username
bajor and we'll go ahead and connect now and it's complaining about a pop-up here
so we'll go up here and say always allow and we'll try that again
and then we'll say allow again and so now that we're into our server here let's go ahead and try to install
apache and see if we can get at least the default page running um so this is using ubuntu if my memory serves me
correctly it should be app get install apache 2 and we'll just hit y for continue
and we'll just wait for this install doesn't take too darn long and after a short little wait there it
finally did install also if you notice this little icon here we have a little clipboard here
i don't seem to ever use that there so that's fine now when you install apache we might
have to go ahead and start it up so let's just take a look to see if it actually is in the running directory
here so we'll go to cd var www and so that's where the default directory is right
but we can just check to see if it's running by doing a ps aux i think it's httpd
or we can say apache here and so it looks like it's already running so that's pretty great for us
and since it's running on port 80 and we've opened up port 80 we should probably be able to access that
here so let's go back to our actual virtual machine so we'll go to virtual machines
and we have that virtual machine running i'm just going to click into it because i just want to find out its public ip
address so here it is there and for lucky this will just work just copy the clipboard
button right there and look at that we have the default page isn't that cool
so that's all there really is to it and i could even update this page you don't have to do it but i'm just going to
update it for fun actually i probably have to restart the server so maybe i won't do that
but yeah so we connected through the bastion so that was pretty darn easy we probably could have also used um the
cloud shell to connect um but maybe we should we could give that a go as well
since we're all done here let's go ahead and do some cleanup the first thing i want to do is the easiest way is
actually to go to all resources here at the left-hand side and this really gives you an idea of
everything that's running your account so i actually have other stuff in here that's not relevant
but the idea is that all of our stuff is running within a resource group and so i'm just taking a look there i'm
not saying this is all resources here um see if you see resource group here yeah they're all there right there so i
can go ahead and click that and so everything more or less should be self-contained within here see all that
stuff you can even see the v-net is part of it as well and so if i go ahead and delete
this resource group it should delete all this stuff so i'm just going to type bajor to confirm
and we'll go ahead and delete and that should do a good job of cleaning up all those files
i'm not sure if it'll delete the ip it should right there but if it doesn't what i recommend is after everything is
deleted just go back here to all resources and just double check to make sure they all
vanish because when this is done they're all going to start to vanish from this list
and if there's anything remaining you'll know because it's still here right so just be careful about that that's all
i want you to know and so that's the linux part and so let's go ahead and actually now set up a
windows server [Music] hey this is andrew brown from exam pro
and it's really important that we know how to monitor our virtual machines so we can kind of check their performance
or do some diagnostics on them and so a couple things we're going to look into we're going to set up some virtual
machines and we're going to look into automation accounts uh log analytics and metrics and alerts okay
so the first thing we'll need to do before we do anything else is make sure that we have particular resource
providers enabled so go to the top here and as always go to your subscriptions and we will click into our subscription
go all the way down the bottom click on resource providers and there's two in particular we're looking for uh one is
for alerts so it's alerts management so make sure that is registered if it's not press that button
and then we want insights so make sure insights is enabled as well they should be by default but just in case they're
not uh you should go ahead and do that so we're going to need some virtual machines i'm going to set up three and
the reason i want to do that is just to show you that there's many different ways in azure to do the exact same thing
and sometimes when you do something it just works and sometimes it just doesn't and it can work again and not again so i
want to give you a few different options available to you so the first thing we're going to spin up is a virtual
machine and this one in particular we'll make a new group we're going to
call it dax and so we're going to choose for this one an ubuntu linux i'm going to switch it over i'm going to choose a
minimal install so we'll choose this one over here which is the ubuntu server minimal
and uh what i'll do is name this and there's a bunch of different daxes in star trek so we're going to go with
kurzon dax here and we'll put all this in east us so wherever it defaults here so if that's
where it wants to go that's where it's going to be but let's pay attention to where that is okay
let's make sure that we're using a very inexpensive instance i'll give it a second to load if you do
not see the cost just drag these over until you do it just depends on your screen right
um so once this loads it will tell us that this is probably the cheapest i think
that is the cheapest because something's going to go lower than at 500 megabytes of ram so i think we're already set to
it i'm not going to wait for the load to take forever notice the red line there is no error is that's just what it shows
and so i'm going to go for password authentication here and what i'm going to do for this account is i'm going to
type in um dax as the username and then testing with a capital t e s t i g one two three four five six because it wants
an upper case a lower case some numbers and a certain length and that's what works for me
so now that i have those filled in ssh we're gonna keep that open we're gonna go to disk you can leave it on premium
if you want i'm going to go to standard i want to save some money just in case i forget to turn this machine off it's
going to set up some networking for us which is totally fine we're going to go to management
and i believe so there should be guest os install here it is not here it's the next step i
believe where is it i know you're in here let's go back one step here i have a
feeling it's on this page because you can install the um guess os metrics right away
so i'm just seeing here i cannot seem to remember where it is i might have skipped over it because i'm
going so quick here um well maybe it's not set here so when we
go to do the other virtual machine we'll see if it's actually there but for this one we'll just launch it without it
which is totally fine i was going to do one that way anyway and so we'll go ahead there and create
that virtual machine okay now while that is going and by the way if you think you call
that number that's not me so uh you know you can call if you want but it won't go to me
so that's going to go ahead and deploy that what i'm going to do now is go and launch another virtual machine in the
same uh in the same environment so this one this time around is going to be again
it's going to be linux we're going to choose dax here and this one is going to be
[Music] jadziadax and we this time around are going to
choose ubuntu server lts so this one's a minimal install and this one here has a
bit more to it we're going to choose gen2 uh this is now 4.86 which is strange it
looks like it was the same one before i don't know why the other one was still more expensive because where it said 40
dollars but maybe i was mistaking the red means nothing as per usual it's just as you're uh tricking us we're going to
call the username here dax testing with a capital t-e-s-t-i-n-g you know what i'm trying to say here
and i'm going to do uh testing one two three four five six and we will go next to disks we'll stick
with premium for this time it doesn't really matter if we go to advanced here there's no uh interesting options there
this is all fine this looks good we go to management so now notice here so we didn't have it for the minimal
install but for this one we do we can actually put in the guest os diagnostics and what it will do is it
will have to create itself a storage account so that will be in azure storage to store
our diagnostic data and so that seems like a good idea to me so what we'll do is we're going to go to
next but notice we didn't have it for the minimal install probably because it doesn't have the um the agent what's
called the wag agent installed for it to do that by default so just notice that it varies on some machines
we're going to go to next we're going to hit review and create and we're not done yet we're going to
create one more virtual machine and this time it's going to be a windows once i hit the create button here
uh we're going to go back to virtual machines and this time i'm going to launch a windows machine and i'm going
to use we're going to put in the same group here i'm going to call this one uh tobin or let's call it
little dax here and this time i'm going to choose a windows server so i'm going to go to
windows server here we have a lot of options i'm not that great with windows servers i'm going to choose a gen
2 windows server here it's not going to let us get away with this b1 l it's not
big enough you need a lot more compute and memory i think it's like two and four uh but i just remember it always
choose ds ds2 v2 um which is pretty hefty it's pretty expensive maybe i could choose something
cheaper like the ds1 no i need to i need two cpus so ds2 v3 that's when you're launching a windows
server if you don't do that they'll complain and that'll probably be pretty darn
expensive but we got to make sure that we just shut this off and get through this as quick as possible i'm going to
choose the same thing as always so i'm going to i'm going to put in dax and then for the password i'm going to do
testing 1 2 3 capital on that t 4 5 6 testing 1 2 3 4 5 6 because it wants 12
characters we're going to let it do on the rdp that's totally fine uh sure premium ssd we're not going to
keep this around for very long we're going to scroll on down go to management
and notice that you can enable os diagnostics here i'm not going to do that here just so i can show you show
you it in the other variation we're going to go to next we're going to go hit review and create
and we're going to go ahead and create this instance whenever it lets us do it there we go
okay we'll hit create and now it's deploying so we have these three virtual machines
we're creating and so what i'm going to do is make my way back to virtual machines here and so i have the two
there i'm going to give it a refresh make sure i can see the third one creating
we don't see it just yet but these ones are running so
what i'm going to do is open up kurzone i'm going to open up jedzia and one has the guest um the the uh the guests ins
or the what's it called diagnostic settings it's the guest metrics installed and the
other one does not so if i scroll down here so i just want to show you there's a lot of variation and sometimes you
know you do it one way it works another way it doesn't so for jetsea it was installed on default so that's the one
that is using ubuntu standard and then this is the minimal install where it's saying hey do you want to
install the metrics and you have to pick a storage account if you didn't then you would have the option to create one here
it's called dax diag so i just want to show you we're going to go ahead and enable those
guest level monitoring metrics okay so
we have a storage account and that's where the data is going to go um
and this will probably fail because i don't think it has the necessary things installed but i just wanted to show you
you could do it that way but what another thing we're going to need is we're going to need
um a log analytics workspace so all a log analytics workspace is is a place to store your logs it is
essentially a data lake for a lot of different resources so you can put all sorts of resources under here and that
way you can search across them see how this failed if you ever have a failure like this the
way you investigate this as you go in here even though it says assass token for the storage account couldn't
generate it's kind of a misleading thing here because if i actually click in up into my
notifications we go to our activity log we can see kind of what something has happened here so i know this failed
it might not show up here yet sometimes it takes time to show up so we'll revisit this later but it would show
red errors here and if we looked in there it would tell us that python's not installed on that machine because it's a
minimal linux install so if you run into those problems that's the reason why some vms are a bit easier to work with
than others but we're looking at log analytics and again it's just a place to collect your logs but i want to see
because i think jitsi is the one that actually is the one that is working properly but if we go down to
metrics or logs it's going to say hey you if you want to use logs you're going to have to go
ahead and create you have to enable it but what it's really doing is just creating a log
analytics workspace so if i click this here what's going to tell me is say hey you
don't have one we'll create a default one for you um i don't want to do it that way what i
want to do is create one myself and then link it through there or what i could do is make it through automation
so what i'm going to do is i think what i'm going to do is i'm going to do through automation
so there's another service called automation accounts and this particular service is for configuration management
update management and it's a way for us to keep our vms up to date and so this one's going to be called dax
oh it's too short it doesn't like that dax automation and i'm going to choose the resource
group dax it's e-s-e-s and here it's going to say azure run as
account so this is going to give it more permissions so that it can run as a contributor role
and that way it will have access to resources to do what it wants to do so we'll go ahead and deploy that and then
once this is deployed we'll create our our workspace through this because i found an issue where if i made this and
tried to link it just didn't link and i don't want to have those problems so i'm just going to make my life a
little bit easier by making it through here so under here if we go to update management
it's going to say hey you need a workspace in order to use update management if you're wondering what
update management is it keeps your vms up to date by applying patches so if we drop down here we're just going
to go ahead and create a new workspace and i'm going to do it that way because it'll be automatically associated with
that workspace on creation and uh we'll let that go there for a bit but while that's setting up a new
workspace for us if you go over to run books this is the power of well i'm not i'm not
it wants to make that thing there so i'm just going to click ok there don't worry about that discard but the whole power
of this is that it can apply patches it can it can manage the state of your vms
but if you need to do something like run something like a a series of run commands
they have a bunch of different run books here uh so there's a variety of different
kinds and i think we can click into them if there's something about sql that sound kind of how to use an escrow
command on a automation runbook so that's just a runbook so runbook just
means like a series of run commands something that you're automating on your server and you do it through here um so
update management looks like it is now working uh we didn't press that enable button uh initially but it worked there
but if we wanted to have vms under here we'd have to go ahead and add them manually
um and so we're just gonna wait for those to show up alternatively if we go back to our
server or sorry one of our vms we should be able to add it this way it will just tell us to go that way anyway
um so there should be like update management or something in here could be configuration management
um yeah that still would be through something right so it'd probably be
still through automation but i could have swore there was maybe guest and host updates
yeah so here it's just saying go to azure automation so you don't really set it through here you have to associate it
through azure automation and so these are ready to enable so i'm going to say go ahead and enable those i don't know
where our windows server is we definitely spun one up it's not a big deal if we don't have it it's not really
crucial to this tutorial but it would have been nice to show um the windows 10 there
i'm gonna go see what happened to our windows server oh it is there okay leela's there
so we'll take a look at that in a second uh but we're just adding those there we're not going to really apply any
patches i just want to show you how to associate them there um and just to highlight the fact that there are run
books which are pretty cool and you can also do other things like if you need to like install python packages or stuff
like that uh to to do stuff you could do that as well um so there's a bunch of interesting
things in there but it's kind of like a side dish to the follow along here so this would have
created our workspace so now let's go over to our workspaces and we have one here and if you're just
curious what it looks like if we go here something super exciting you just put the name and region in and it has the
default page you go so you're not really missing out on creating one uh by hand there
but underneath here what we can do is see if our virtual machines are actually associated uh with
this here so if we go under virtual machine you're gonna see that these ones are connecting
which is interesting because i didn't do anything to connect them i'm not sure why that's happening but i'm going to
hit connect here and that will connect that a lot of times i'll come in here i have to
manually connect them i don't know if it's because we put them in the uh what do you call it within the uh the
automation there if we go back to automation which ones did i choose i already forgot
update management um they're not showing up here now but i
know they're there maybe we triggered it when we were doing there but anyway the point is is that
you have to make sure that those are um configured so that it's actually sending data over to the workspaces so
that we can then use the logs and things like that so if we go back to our virtual machines
over here you can see they're connecting and this takes forever
while this is going let's go take a look at storage accounts and actually a better way would just be
to go look at the virtual machine individually here so we'll just go back to my virtual
machines and i go to the resource group we scroll on down here we should see a storage account within here
let's just type in storage there it is whoops
and uh the thing is is that we can actually view some of the data in here so if you go to open explorer you'd have
to install this it's for windows i don't i think it's for mac as well but once you have the storage explorer uh open
you can just click open here and it'll open up once it's installed on your computer of course
and what i can do if we have any data it might not be collecting any data yet but if we go
down to our storage accounts here oh here it is down below and expand it under tables see how this
wad that is the name of the um uh the agent that is collecting data and here you can see that it's already
collecting stuff all right and it's collecting for jet zia dax
and so i'm just kind of looking at the data that's collecting nothing super interesting
but the thing is is that we're gonna make our way over to logs because by default
azure collects host metrics so things about the instance like cpu usage but there's
things that it doesn't collect like memory and other things like that
so that's why we need to turn on this setting here the diagnostic settings
so we can collect those metrics these are called guest metrics so we have memory network file disk disk and
storage so if you wanted to know how much storage was left on the on the actual uh disk on with the with the
virtual machine or how much memory was being used you'd need that uh set up here
uh once this is enabled uh you can send data over with uh into azure monitor and other places um it's not showing app
analytics i think that's for or log insight whatever the name of the service is it's for uh
that one i think is for the windows one so we'll see that when we go over there but syncs just means we're gonna send
data uh from here to to um azure monitor right but we'd have to have preview to see
that uh nothing that interesting here uh but if we go over to logs now um this should
not be showing up here anymore so if this is still showing an enable screen then we got to go back to
our log analytics we'll click into here we'll go down to virtual machines and we'll see if it's connected yet so it
still says it's connecting right this one's ready though and i haven't even done anything with that one yet so
what we'll do while we're waiting for these linux ones to uh to spin up we'll go over back over here to our virtual
machines and we'll go find that uh windows machine which i don't know why it's not showing up here
there it is and what we'll do is we'll go ahead and connect to it
so i am on a windows machine so i'm going to shape here
and i'm going to click on rdp and i'm going to download that file i'm going to double click this file on my
windows machine and i'll be able to open this up instantly it was called dax testing one
two three oops testing one two three four five six looks good to me we'll hit okay
we'll say yes because if you want to collect um
uh particular metrics like guest metrics you have to enable like when you're on windows server you have to enable it to
uh to send performance counters so i'll give it a moment here it doesn't take too long
while that's going we should look to see if we actually have um the uh
the settings set up here the diagnostic settings and so this is what i'm talking about the enable guest level monitoring
so we want cpu utilization disk and network so we'll go ahead and click that there
and while that's going to go back here and so this has now started up i don't know much much about windows
servers but i do know how to turn on at least last time i did i know how to turn on the performance counter so see
here it says online performance counters are not started so i can right click this and then just say
start performance counters and that will have it start sending data over to our storage accounts assuming that this is
enabled here so this is going to go ahead and install wag into
the windows server so it can send back metrics uh and so we got a lot of things going
on here but let's go back to jadzia and um i want to see now if i have any if i can use logs now
there we go so it's now connected to the workspace so it knows where to send that data
and you can pull up when you go to logs it'll show different types of default queries if you're in the actual group
here you'll have the same screen but it'll show you across all possible resources so it's a little bit easier to
figure out like useful queries for virtual machines when you do it through here and there's some ones there's some
that we can run right away so if we go over to um
the diagnostics we could or actually availability is a good example so heartbeats will tell you
if the server is live so a server will have heartbeat so every whatever second or minute it's going to
say hey i'm still alive that's what a heartbeat is so we'll go ahead and run that
and we'll give it a moment here i'm not sure why it's crying that doesn't work i'll just click off
and try that again so go back to availability we'll hit run and it has the right scope if you're
wondering how it knows what to check that's all based on scope there and for whatever reason it just decides
that it doesn't really want to run right now that's a bit frustrating but if it's not
working for this one we can always check our other one which is curizon and we can go see if this one works
that's why i made multiple servers because i knew one of these might not work right away
so i'll go ahead and run this one here it says no logs are configured so that makes me think that
our workspace here if we go back over to here and we go down to virtual machines that they're actually not linked oh they
still are connecting there you go so it's a bit misleading it looked like we could query but we still can't
um let's go take a look at this virtual machine here our little one still
and let's see if we can do anything with it yet so we go down to
diagnostic settings it looks like it's installed and so if we go to performance counters these are
the counters that it should be collecting data on you could do custom if you want and change those values
but we're just going to leave it basic for the time being go ahead and save that
and i believe we can do logs over here on this one so we'll go over to availability i'm going to load that into
the editor this time instead of hitting run i can hit run and it will return and says that it has a count to seven so
seven heartbeats that's good if you wanted to create uh rules you could easily do that there's actually uh
some nice ones here if we go into here um this won't work unless our
our our metrics are working our guest metrics but there's a bunch down below here
i'm just trying to see one that might be interesting for us to set so you might go here
and i don't think i like that one say this one here i'm just going to
clear this all the way out oops so here they even say to create this
alert just hit the plus new button here so we go here and
sometimes it does this it doesn't actually bring it over which is weird so you have to go back
i told you like this the the ui for azure is super super buggy so if you don't have any confidence uh
don't worry it's it happens to all of us um so we'll go back to our alerts and i'm going to load that into the
editor and what i'm going to do is just copy it and um
we're going to go ahead and hit run and so here we're getting some data back i think it's going to complain about the
time generated but if we go and create a new alert oh man it just does not want to uh copy
anything over a and so it's like i can't even paste
we'll go back to here i'm going to copy this i noticed this because i had it double clicked maybe
just just creates one what you have selected and so it should complain about this but
it's not so that's great and so we can go here and we can put a threshold to five
i'm just putting any value here and that gives you a monthly cost for that alert so you hit review and create
please correct the following details where oh the alert name okay
my alert and we will hit review and create we'll hit create
and so there we can create an alert so we could create alert like our memory is running out of stuff and those are kind
of useful things to do so talking about metrics
we're going to make our way over here and notice we have host metrics and guest metrics so host metrics are
general ones that are available to us and guest metrics are memory and stuff like that
so if we have that you're going to notice now we have like disk and memory and things like that if we didn't have
that installed we wouldn't be able to access this information so what i can do is go ahead here and
try disk time i don't know if it'll show us anything right now because it might have not collected enough information go
over to virtual host we'll have different metrics here so a standard one would be like cp usage
okay so that one is displaying there the poor performance metrics always take a little bit more
time to collect so i'm not sure if i'll stick around to show you that but if we go over to availability sometimes
we need to go debug performance like you can hit run and this will tell you if it's actually
collecting information so see right now it shows me nothing so it hasn't collected anything for process memory or
processor but if it did then we could go and use these other ones down below here so we have
free disk space so that's a really useful one to have which we can't get metrics on that right now
but that's what we've been trying to do is collect that information so let's go back to our workspace
and what i'm going to do is take a look at our virtual machines that are
connected and this one has an error um and that's kurzon and i'm not surprised because
again it's a minimal windows linux instance so probably couldn't install the agent so that's expected but
i just wanted to show you that edge case if we go into the jet zeo one which is the one we were waiting for this entire
time we should hopefully be able to see some metrics so
if we go down here and we choose yes metrics i want something with memory here
uh like percentage okay so it's still not showing me anything and that's fine if we're not
getting any metrics what we can do is we can go log into this instance and give it some data so that it does something
all right so what i'll do is go all the way to up to the top here into my overview i'm
going to copy this public ip address we're going to open up our cloud shell and make sure that it's in bash all
right and we're we're going to type in ssh um
dax and then we're going to paste the ip address in we'll hit enter we'll
say yes and the password is testing123456 with a capital t
and what we can do here is we can install a tool called stressng what that tool does is it will
help us do stress testing and so that allows us to make some metrics
so we'll go ahead and install that via snap snap is the new package manager for
ubuntu used to be apt-get or apt it doesn't take too long to install and while it's installing i actually
have a pre-made uh line here to check the memory or to fill up the memory
i'm just going to go ahead and paste this line in so this is stress hyphen ng vm bytes and it uses awk it's going to
do memory availability and it's going to fill it up to 90 percent so we want to have 90 memory usage i'm going to go hit
enter i'm just going to let that run now it's not outputting anything but it definitely is running there we go and so
we're just going to leave it there and so soon enough we should have some information
and i think if i go there yep it's still there so it's fine so now if we go over to
um down to our logs and we go back to
performance and we just choose this one here we might see something now
again it takes time so you know it looks in the 15 minute uh window here but i just want to see that it's
collecting anything for me it doesn't matter what it collects just collects something for me you know
so i think it'll just take a little bit of time while we're doing that we should make our way back over to our workspace
because there's some other settings that are kind of interesting that i noticed if you go over to agent configuration
um you can collect additional information over here so we have performance counters for
windows and linux i think we have to set the memory one here if we wanted to actually appear here
so i don't know if there's a way to set all of them
but i'm gonna just choose some here so i'm gonna do memory used we'll do logical use space here
we'll go here and do free space i think that might be the reason why it's not showing up for us
maybe process time here we did use memory used percentage of use space
we will do um do reads and writes so here we have some for our linux
so i think if i we set that then we should be able to see some information uh syslogs is just a type of logs that
you can collect we're not going to look into those today but yeah that's the
management there we could also try setting some here maybe one for memory i can't remember
what the one for memory is called here because they do all of this kind of stuff
like windows has so much stuff i can't make sense of it i think we might want paged owls
and page so that went called there
bytes we'll give that a go and we'll see if that starts collecting information
i'm going to go back over to uh here and oh this is kurzon that's the windows
machine we're going to go to the linux machine here and we'll give it another go
see if we get anything this time around so we'll go back to performance
we'll say what is being collected run okay and so i think we're just going to have
to wait a little bit so i'm just going to stop the video here and i'll see you back in maybe 15-20 minutes okay
all right so i'm still waiting here and i don't seem to be seeing any data but that's okay because there's another way
we can kind of approximate this and we don't have to wait forever especially if you don't have a
lot of time like me the thing is is that azure has a log analytics tutorial and within here they
have a demo environment that i'm very familiar with and so this can approximate exactly what i'm trying to
show you here if you notice at the top here this is microsoft azure monitoring logs
demo log blade so if we go to queries
and we go down to virtual machines and we'd look at what data is being collected we can hit run here
and this is the kind of information we are trying to see right this is what we want to see what it's actually
collecting that's okay we're not doing remote desktop anymore here and if we go to
virtual memory available we'll just clear that out there and run that
this is kind of the information we're trying to find all right so i just wanted to show you that when you collect
those metrics that you can run these queries and this is that language up there with cousteau
and that's pretty much it that's all i really wanted to show you so let's go ahead and tear down all our stuff it's
all self-contained within a resource group so what we can do is go to all resources in the top left
corner there and we called it dax so we can search for
dax here whoops actually it's all over the place we just click here into the name
and we'll hit delete resource group type in dax we have a lot of resources created for
this one and there you go so yeah hopefully that helps you understand uh those
relationships between automation accounts where we can run run books do patching uh you know stuff like that
install python stuff um you know the fact that log log analytics is basically a data
lake for all your data that you can create alerts uh that you have metrics you have guest os metrics which collect
those three values the memory the network and the additional cpu information or disk space
and just the variance there so you don't get stuck so there you go [Music]
hey this is andrew brown from exam pro and this follow along we're going to learn about managed identities or system
managed identities so that we don't have to pass credentials or hard code them into our virtual machines or other
environments so what we're going to do is launch ourselves a new virtual machine this is going to be a windows
server so go ahead and hit create we'll create a new virtual machine and from here we'll say create new and i
say my managed identity probably say id so i'd have to spell the whole word and we'll
just say my managed id and from here central us is fine the zones are fine
but we're not going to use ubuntu we're going to hit see all images and from here we'll choose windows 10
and there's a lot of options here so i want windows 10 pro um
it's a bit hard to decide so i'll go gen 2 2 1 h2 hopefully you'll be okay doing this as well um it's using standard b2s
46 so just make sure you're not overspending so that should be fine i think we need at least a b2s to run this
um but we're not going to keep it around for very long so username i'm going to go admin user and for the password
capital t testing one two three four five six i can do that again capital t testing
one two three four five six exclamation mark just because of the requirements such a pain that's what i always do in
these follow alongs and we're going to use rdp to connect to it because we do have to uh remote into
it we'll just say i confirm we'll hit review create of course we don't actually have a license but we'll be
okay because we're not doing anything too serious and we'll give it a moment here
and we'll hit create so that is going to create while that is going i'm going to
uh we'll actually have to wait a little bit but we'll make our way over to the resource group because this is where
we're going to be adding an im policy at some point so if we go over to
i am over here and we'll wait we'll actually wait for this to provision so this takes
quite a few minutes so i'll see you back in maybe 5 10 minutes because we are launching
windows server they just take longer so after waiting you know five to ten minutes the environment is ready so
we'll go ahead and go to that resource and we're going to want to go connect and choose rdp this is going to be
remote desktop protocol i believe that's what it stands for if it doesn't not a big deal just know it's called rdp and
so we'll have an rdp file we'll double click it we'll hit connect this is going to open up the room remote desktop
client and so we will type in admin user and then capital t testing one two three four five six if you're on a mac you're
like how do i do this well it is in the mac store just type in remote desktop it can open here i'll just show you what
i mean over here we do rdp mac you can see that it's free to download
so it's just you download that and you can open those rdp files so we are just waiting for this to spin
up this takes a little bit of time so just give it a few minutes all right so after waiting a little
while the environment is ready so hopefully you can see what is going on here and so what we want to do is open
up powershell so we'll type in powershell here and we will right click and run as
administrator this does have an outbound connection the internet so i know that uh we are okay for our connection and
then this is where you will need to install azure modules because it's not
pre-installed and this part really sucks because we have to wait a lot more again so i hope you like
waiting a lot but anyway what we'll do is right click this properties here and we will bump this up because this font
is super super small and uh we'll type in install module
a z and i'll install all the commandlets for azure or azure and we'll wait for some prompts the prompts are a bit
finicky hopefully we can just do a for all but you might have to hit yes a couple times
but this part is just so so so slow there we go so notice it doesn't let me say all we'll just say y
and i know that it's going to prompt us again so we'll just wait a little bit here the progress will show up at the
top it's kind of glitchy um yeah so now we'll do a for all and so now we just wait a long time now
it seems like it's not doing anything but you will eventually see something appear up at the top here that shows you
that there's progress but you just have to be very patient yeah so it'll look like that i'm just
showing you what it looks like and i'm gonna go back and pause till this is all done because it takes forever
all right so i think it's done it's sometimes hard to tell because it'll just kind of like blank out here
and it's not doing anything so i'm not 100 sure but
what i'm going to do i'm going to see if i can just open it twice this is just the powershell experience
right and um to test this we'll just do a connect and see if it works so i'm going to do
connect i just want to close the old one if it's actually still doing something connect account
identity and so if this prompts us with something then we know that it's working correctly
so identity not found and that's fine so the thing is if we just just did this it
would actually prompt us to log in so see it's prompting us to log with microsoft so this this worked
um but we need to actually connect an identity to this virtual machine so that's what we're gonna do so we'll
minimize this we'll go back over here so go into your uh the resource group that we had before
under iem and we're going to add a new role assignment and from here we will uh choose contributor because that
will give us enough access for stuff we'll choose manage identity and we will
choose system identity no no no no that's not what i want because it should show the virtual
machine here maybe it's because um we opened this before it was done creating so that's
why it's not showing up so we'll try this one more time we'll go to contributor because it should show the
virtual machine manage identity and select and
[Music] i want to see the virtual machine
weird so i'll click way out i'll go back in i'll go to i am again we'll go to oh you know what
we launched this virtual machine we forgot to check box something so when you launch the virtual machine
you're supposed to checkbox manage system identities here so this would be
[Music] where would it be i only ever do it through the setup i
never ever have to retroactively do it oh what a pain identity maybe system managed so we'll just say on and
we'll save it uh grant permissions do you want to enable a system energetic yes
but normally when you you do the virtual machine hold on here we'll just go pretend like we're setting
up a new one we're not actually going to set one up but when you are setting it up
and we go over to advanced no no management we would check box check box it on uh
here that's not what we did so we forgot to do that but we turned it
on here so hopefully it works without us having to restart the image if we go to role assignments over here
i mean that's just another way of getting to this page so it doesn't really matter for the resource group
what we'll do is go back to our resource group we will find it here
and we will go to [Music] i am and we will add a role assignment
and we will add contributor we will go next we will say manage identity we will select we will go to virtual machine we
will select this one we'll hit select we'll review and assign we'll review and assign and then it will sign us
contributor access so now we should be able to connect our identity and then also get access to some stuff
um because what we really want is to do get a z like to just show that we can get
anything because right now we do this get ac subscription we're not
we're not um connected in any way so we'll go here and we'll do identity
fingers cross it just works yes it does that was nice if we didn't have to restart the machine
and so now if we do get ac subscription it should work
so i don't see it working do i type it wrong the term is not recognized oh i must have typed it wrong
subscription here let's get this description so if we were not authenticated that would not work
and so it does work now so we are pretty much all done here well we could probably set
some resources just to make sure this is working properly so maybe go get a z resource like that
there so list some resources and it's only listing what's in the um the resource group because that's all it
has permissions too it's not going to show things outside of that because that's the scope when we did it
at the resource group and that's why we went at the im level there so we are all done we will go ahead and close this out
okay we'll make our way back to our resource group we're already on it we'll go ahead and delete this resource group
say delete and there you go [Music]
hey this is andrew brown from exam pro and we are looking at virtual machines for azure cheat sheets so let's jump
into it so azure virtual machines allows you to create linux and windows virtual machines the size of the virtual machine
is determined by the image the image defines the combination of vpcus memory storage capacity the current limit on a
prescription is 20 vms per region vms are built at an hourly rate a single instance vm has an availability of 99.9
percent when all storage disks are premium two instances deployed into availability set will give you 99.5 95
availability you can attach multiple managed disks to an azure vm when you launch an azure
virtual machine other networking components will be either created or associated to your virtual machine
such as nsgs interface cards ips and v-net you can bring your own linux
by creating your own virtual hard disk azure vm comes with a variety of sizes that are also uh optimized for specific
use cases and there's a lot of different ones here uh so it's not super important but i mean you should know the broad
categories here uh azure compute unit acu provides a way of comparing uh cpu performance across azure skus and the
standard one that the one they're all benchmarked against is standard a1 all other skus then represent approxim
approximately how fast faster the sku can run on the standard benchmark you can install the azure
mobile app so you can monitor your vms on the go hyper-v is microsoft's hardware
virtualization product it lets you create and run software versions of a computer called virtual machines that's
how it all works there are two types or two generations of hyper vm generation one which works with most operating
systems and generation two that supports most 64-bit versions of windows and current
versions of linux and freebsc uh operating systems hyper v hyper vvms are packaged into
virtual hard disk formats such as vhd vhdx files not on the exam but just understand that uh hyper vm generations
are different from the azure hyper vm generation so it doesn't have all the features of hyper vm okay
there are three ways to connect to virtual machines the first is via secure shell it's not sure shell it's secure
shell but yeah so that'll have it get fixed at some point ssh happens on port 22
and rsa key pairs are commonly used for authorized access then you have rdp which is a graphical interface to
connect to another computer over the network connection this is how you can remotely connect to the windows server
via virtual desktop this happens on port 3389 on tcp and udp now i mark these red because i want you to remember these two
so make sure you know them okay azure bastions and we'll clear that because now it's getting a bit of a mess
here there we go so ask your azure bastion a service you can deploy
lets you connect to a virtual machine using your browser and azure portal supports both ssh and rdp useful when
you only have a browser like a chromebook or do not have permission to configure or install software then you
have update management this allows you to manage and install operating system updates and patches for both windows and
linux virtual machines that are deployed in azure on-premise or in other cloud providers update management will perform
a scan or update compliance a compliance scan by default is performed every 12 hours on a windows and three hours on a
linux machine that can take between 30 minutes and six hours for the dashboard to display updated data from the managed
computer so there you go that is the virtual machines chi chi [Music]
so let's take a look at arm templates uh and before we jump into it let's just make sure we're familiar with
infrastructure as code because that's what arm templates are all about and this is the process of managing and
provisioning computer center data centers such as azure through machine readable definition files such
as a json file and in this case an arm template because that's all it is a json file and rather than physical hardware
configuration or interactive configuration tools and just to simplify that even further basically you're
writing a script that's going to set up your cloud services for you and with iacs they usually come in two different
flavors we have declarative that's where exactly what you write is what you get and imperative so you're going to
generally define what you want and then the service will guess what you want it's going to fill in the blanks to save
you a lot of time writing those scripts and so arm templates are json files that are
that define azure resources that you want to provision uh and azure services that you want to configure and with arm
templates they are going to be declarative so you get exactly what you define uh they're gonna stand up tear
down or share entire architectures in minutes and they're going to reduce configuration mistakes and you know
exactly what you have defined for a stack to establish an architectural baseline for compliance so you
definitely want to use arm templates or iac whenever you can and try to avoid using the console unless you're doing
development or test workloads but let's just run through the big list of what you can do with an arm template i know
this is a big boring list but let's just get it get through as quickly as possible just so we know what we can do
with arm templates so with arm templates that are declarative so what you see is what you
get you can stand up tear down share entire environments minutes you can reduce configuration mistakes you can
establish an architectural baseline for compliance they're modular so you can break up your architecture multiple
files and reuse them they're extendable so you can add powershell and bash scripts to your templates uh it has
testing so you can use the arm ttk to test make sure exactly what what you've deployed is what you wanted
you have preview changes so before you create infrastructure via templates you see what it will create built-in
validation so it will only deploy your template if it passes track deployments keep track of changes to your
architecture over time policy is code so apply azure policies to ensure you you remain compliant uh and then you have
microsoft blueprints which we we did cover here uh which establishes relationships between resources and
templates so it's just one step further where arm templates don't have any relationship with the resources where
blueprints is like a better version of our templates and then you have ci cd integration exportable code so exporting
the current state of the resource groups and resources authoring tools i believe is the last on
our list here so you can use visual studio code that has advanced features for authoring arm templates makes it a
lot easier to write them so there you go [Music] so now we were talking about what arm
templates can do let's actually take a look at what one looks like and so just to get a good snapshot or overview let's
just define what the skeleton is the general structure of an arm template so here on the right hand side we have json
and you can see that we have a structure there so we have schema content version api profile parameters variables
functions resources outputs and let's go down the list here and see what all these things are so the schema describes
the properties that are available within a template and so the idea is that you have that
json link there and it's going to say we expect the schema the actual structure to have these parameters then you have
the content version this is the version of the template and you can provide any value for this element it's totally
abstract it's just your way of keeping track of the version of your current template then you have the api profile
you use this value to avoid having to specify api versions for each resource in the template you have parameters
these are values you can pass along to your template you have variables this is where you transform your parameters or
resource properties using function function expressions you have functions these are user-defined functions
available within the template you have resources these are the azure resources you want to deploy or update and then
you have outputs and these are the values that are returned after deployment so let's go
more into deep into some of these things [Music] so let's take a deeper look here at the
a resource section within your arm template and so a resource is an azure resource you want to provision could be
a virtual machine could be a database and so here on the right hand side look at where it says resources and we're
going to take a a breakdown of the actual columns or tributes that we can set so the first thing is the type and
this is going to follow the format of the resource provider and resource type so there you can see that we are setting
up a storage account then we have the api version and this is the version of rest api that we're going to use for
that resource and each resource provider publishes its own api version so you've got to go look up each one because they
all could be different then you have the name of the resource and so i believe there that is using a variable so that
is going to be dynamic then you have the location so most resources have a location property and that's the region
that you wanted to be deployed in then you have other properties and other properties can
will be based on different kinds of resources so for a storage account you want to be
able to set the kind and within the properties you're going to have a bunch of other options there and it's just
going to vary okay but anyway let's take a closer look next at parameters
so let's take a closer look here at parameters and these allow you to pass variables to your arm templates so on
the right hand side we have our arm template and we saw before
resources but if you look above there we have a thing called parameters and so there we are setting a parameter and
then down below in the resource we are accessing um a parameter and so
let's just actually talk about some of the parameter options we have so the first thing you'll want to do is set a
type and on the right hand side you can see that we're saying as a string and so we could define that as a string secure
string in blue object secure object and array and there are some other things that we
can provide when we when we are defining your parameters that we're not showing in that diagram but we have default
values so this is if you do not provide if there's no value being passed in this is what it should use then you have
allowed value so this is where it's an array and you're restricting it to only the values that are there then you have
the min value so if you let's say it's an integer you want to say this is the minimum value so it can only like
nothing lower than 10 then you the max value so nothing above 10 you have the minimum length so if you're working with
strings you might say it has to be a minimum of five characters then you have the maximum so let's say
you have a maximum of five characters uh then you have the description so this is just going to be something that when you
are using the arm template within the portal you know what it's for so if you don't have a great
description for that parameter or name and you want to provide more information that's what you can do so there you go
[Music] so let's take a look here at functions for arm templates and these allow you to
apply transformations to your arm variables and they come in two flavors we have template functions which are
built in functions and then user defined functions which are custom functions that we're creating to allow what other
kind of functionality that we want so the way functions work is you give the function name so here it's called equals
and then you have parentheses and you pass in uh what you want to transform so if you see parentheses that's how you
know that is a function so let's talk about some of the built-in functions and so there are a lot
available for us and they're generally self-explanatory so i'm not going to be showing examples but let's just go
quickly to the list so you have array functions like array concat contains create array empty first etc then you
have comparisons like less equals less lesser equals greater greater or equals you have date functions uh you have
deployment functions and for example parameters and variables are actually functions
so that's kind of interesting then you have a logical operator so end or if not or
numerical um functions like add div float int min max object so contains empty intersection and then you have
resources so extension resource id providers references etc like that uh
and there's one more i think we have string so we have base64 concat contains etc i'm not going to
show you how to do user defined functions i don't think that's that important
but i just want to show you that you have a lot of functions available to you okay
[Music] so let's take a look at variables and variables are used to simplify your arm
templates and the idea is that you're transforming parameter and resource properties using functions and then
assigning them to reusable variables so under your variables section notice that we have storage name and on the right
hand side we're just using a bunch of functions and assign it to storage name so the idea is that when we have to go
call them in our resources it's going to be a lot shorter than if we had to write that whole thing in there and
what's more interesting is that you can nest your variables within a json object so on the left-hand side you have this
variables environment settings test instance sizes etc and then on the right-hand side we have a parameter
that we're defined here and then down below you can see that we're calling that parameter and then we're calling
variables environment settings and then using the square braces to then call within that nested object i know that
seems really confusing but just take a moment to look at it and it will make sense and you'll just
understand that there's a lot of power there so there you go so last on our list here for uh arm
templates is outputs and outputs return values from deployed resources so you can use them programmatically uh this is
very simple the idea here is that you have outputs and let's say you want uh to output the resource id so you can say
that it's a string and in the value you could use a variable or a bunch of functions and the idea is that when you
use the cli so imagine here you are using the cli and you're saying show me this
deployment group and i want to see the output of value so see where it
says query says properties output resource id value the idea is that now i'm going to be able to pragmatically
access it after i've created the resource and this is a great way of chaining things so you might have a
bunch of arm templates you want to run in sequence and you're going to need the outputs to go into the next one and that
is what you're going to use outputs for so there you go [Music]
hey this is andrew brown from exam pro and we are looking at azure resource manager templates also known as arm
templates and this helps you deliver infrastructure as code meaning that when you have a resource such as a virtual
machine or a storage account instead of manually configuring it every single time through
the portal what you can do is provide a configuration file that defines all the properties that you want it to be
configured with and the idea is that you can keep this file and share with other
other people so they can easily create the same resources as you and then you know exactly how your stuff
is is configured so what we're going to do is uh launch a new template now you can't go up here and just type in arm
because these arm templates are managed at different levels so at one level is a
script subscription or they're resource groups so when you have a resource group you have deployments within them and
that's where these templates are deployed but just to deploy one from here what
we're going to do is type in deploy why they didn't make it so you can type in arm i do not know but if you go down
here we have deploy a custom template and so from here we have some common templates so if i click into web app and
i go edit a template we already have some stuff pre-filled in i'm just going to go back and discard that go back to
select a template and we're going to build our own and by default we'll have that schema that content version which
is 1.0.0.0 our parameters and our resources so today i want to launch a virtual machine
and what you normally would have to do is go here uh and look up what is that you want to create so if it's this uh
microsoft compute virtual machine you'd go through here and you'd have to make sure you have all these uh properties so
you define the resource here right the type and then you define the properties that
you want and down below you can go through here and see them all that's a lot of work i don't want to do that so
i'll go to add resource here drop this down and click uh where's it virtual machine where are
you there you are and i'm going to call this one wharf and then wharf and wharf because it's
not just going to create a virtual machine it's going to create the other things that i need with it as well such
as the storage account the network interface and the virtual network so you can see that we have a bunch of
parameters here so the name the type the name the admin username the password and the os version
oh you know what i think i chose a windows one i do not want a windows one i want a linux one
because that is easier for me to work with here so we choose ubuntu so i'll just fill this in again
all right and so um back up here you know we have the ubuntu version between some versions here and then there's the
type so that's for uh replication then we have variables here so if we go to vm size this is the vm it will it will set
here variables are either you can have string values or you can use functions to
transform other parameters into other stuff that you'll reference throughout your template then down below
we have those resources here so what we'll do is actually i'm going to copy this
because it's very highly likely we're going to want to make some kind of change and so i have vs code over here
on the on the left or right hand side i'm just going to paste that on in there and what we will do this is a json file
make things a little bit easier here great and what i'll do is just move that off screen and we'll go ahead
and we will save this and we'll see if we can deploy this so i'm going to type in wharf here and
we'll launch in canada east i'll name this wharf we will name the username warf but lowercase and then we'll do
testing one two three four five six capital on the t notice that it is hidden there
and then we will choose 14 which is defaulted here and lrs we'll go ahead and do review and create
and we'll hit create here so this is going to fail i already know because it has a misconfiguration it'll
tell us how but while that's going we'll take a look at our input so this is the values that were inputted these are the
outputs if we had defined any which we have not um and if we go back to our template i
just wanted to show you that we have that secure string so when we were typing our password that's why we didn't
see it so just things like that so i'll go back up here and our
deploy failed why what happened so we open it up here the requested vm size standard d1 is not available in the
current region so the template we have is not that great it needs some configuration because we
can't use d1 i think that doesn't exist anymore and so what we really want to use is the standard b1 ls
all right standard b1 ls so i'm going to cut that and for the time being i'm going to go
back to our original template and this is one big template i'm going to look for those variables oh
they're all the way at the bottom here nice and so i'm going to just go ahead and paste that in
b1 ls just double check making sure i spelled that right standard standard b1 ls looks good to me
so i'm going to move that off screen and the question is what do we do what do we do when a deploy fails so
let's go take a look at what has happened here so this all got deployed into a resource group and under here
this is where our deployments are so when we look at this template it we can see that it failed we
could click into here get the same information and if we click into here it just brings
us back to where we just were but if we go look at what was actually deployed under our resource group
under the overview we'll notice that it created the virtual network the storage account and the network interface so
when it fails it creates what it can but it doesn't roll back okay
so the question is is then how do you do cleanup so you might think i'll go to deployments and what i'll do is go ahead
and delete that template and we can go ahead and do that which by the way you can't edit this template all you can do
is all we can do here see i just want to show you that you cannot edit it
we can download it and stuff like that but so you might think well if i go ahead and delete that template
just making sure we're in the right place here you might think that might roll back
those resources but it doesn't it just deletes the template so if you really want to get rid of the stuff what you
got to do is go ahead and delete all these resources manually
so um i wish it kind of had a rollback feature but that's just how it is
but there are some nice things that uh azure does here which we'll talk about in a moment so i think we have adjusted
it to the correct value now so hopefully this is going to be all we need to make it work
so what we'll do is go to our deployments here and we can't do it here but so we'll go
back to the top here and type in deploy and we'll go to custom template and what we'll do is build our own
template in our editor and i'm just going to copy the contents here
okay we'll go copy and i will go paste
and we'll make sure that this is all good looks fine to me we'll go ahead and hit save
and we will choose wharf so we don't have to make a new one and we will fill in uh the name as worf
the username is warf i'll call warf2 just in case helps us keep track of what we're doing
here testing one two three four five six with a capital on the t
14 l rls lrs and we'll go ahead oh we have one issue here cannot deploy a resource group
worth deleting um we'll go back and we will hit create here
i don't think i deleted the resource group let me just go double check i almost i'm almost certain i deleted
all the contents of it right oh so there's already one here so we're just waiting for that to delete
just gonna go delete for us please thank you it failed to delete we'll go take a look
as to why resource is not found uh we'll go back to our resource groups
give us a refresh here okay so you know what i must have deleted the resource group which is
totally fine i i could have saw i only deleted the contents of it
but we'll just call this worth regular then we'll go ahead and hit
create here and so this time i have better feeling about this
and so we will just have to wait a little bit it won't take too long i'll see you back in a moment
okay so after waiting a little bit here our our thing seems to be deployed so if we go to resource groups we can see that
our virtual machine is deployed so that's pretty much all there is to it one other thing i'd like to show you is
that whatever you have whatever is in your resource group you can actually export the template so
if you did configure something manually all you'd have to do is find the resource
go up here to up it is export template and there's your template
so it just has that single resource in there i can't remember if if i go into here if i select multiples
um and i go x exper where's it export template look it's gonna include all that stuff
so if you already have existing resources that you provisioned and you want to have them that's what you can do
notice that some things won't be included in the template when you do that but you can just go ahead and
download them and then you have them for later so yeah that's all there really is to
arm other than learning the uh the nitty gritties of the actual language that's just how you work with it there so what
i'm going to do is make my way over to my resource group here and i'm just going to go ahead and
delete this here and we're all good to go [Music]
hey this is andrew brown from exam pro and we are looking at azure resource manager templates also known as arm
template so the thing we need to know is infrastructure as code this is the process of managing and provisioning
computer data centers through machine readable definition files such as json files rather than physical hardware
configuration or interactive configuration tools iec comes in two flavors we've got declarative which is
what you define is what you get and imperative so you say generally what you want and it will guess or it'll fill in
the blanks for you uh for arm templates uh they are json files as we're suggesting above there that want to
provision azure services you want to configure they are declarative so you get exactly what you define
an arm template is made of the following json structure you should know the structure pretty well because you might
see questions where they're showing you that code so be sure you know all these parts schema describes the properties
that are available within a template content version the version of the template you can provide any value for
this element api profile use this value to avoid having to specify api versions for each resource in the template
parameters values you can pass along to your template variables uh things you can transform parameters or resource
properties using functions and expressions uh and i did include them in this the cheat sheet but there is a
bunch of variations on variables and functions but i think that's practical skills you should just grab we don't
want this in a cheat sheet functions used to find functions available within the template there are so many functions
it wasn't even worth pulling them out and putting some here resources the azure resources you want
to deploy or update and under resources you've got type of resource api version the name the location other properties
which can be a bunch of different stuff so there's no consistency there and then outputs which are values that are
returned after deployment so you can do things with them pragmatically so there you go that is the arm templates cheat
sheet [Music] hey this is andrew brown from exam pro
and we're looking at azure container instances also known as aci and this allows you to package deploy and manage
cloud applications using containers or the way i like to think of it as fully managed docker as a service
azure container instances allow you to launch containers without the need to worry about configuring or managing the
underlying virtual machines and you're going to be able to design isolate containers for simple applications task
automations and build jobs let's talk about some of the uh reasons why you'd want to use containers over vms so
containers can be provisioned within seconds where vms will take several minutes containers are built per second
where vms are built per hour so you'll save a lot more money containers have granular
and custom sizing vpc vpcus memory and gpus where vm sizes are predetermined uh so those are the
benefits between containers and vms aci can be utilized for both windows and linux containers you can persist storage
with azure files using aci containers and honestly if you have containers or functions you have to have an external
storage mounted to persist that's just the way you do it acis are accessed via fully qualified domain
names which is one of the things i really appreciate about azure services because mostly services are like that
azure provides quick start images to help you start uh launching example apps but you can also source containers from
azure container registry docker hub and privately hosted container registries it looks like that the choice option there
let's just talk about container groups because this is pretty much the only major component you have to worry about
these are a collection of containers that get that get scheduled on the same host and the containers uh the
containers in a container group share life cycle resources local network storage volumes so the idea is that you
have these tightly coupled containers so all of them act as a service within that container group so here you can see an
example of a couple containers that are mounting azure files on different directories there and underneath all of
that is running on an azure virtual machine container groups are similar to
kubernetes pods yeah and it says similar to but not really the same thing multi-container
groups can currently support only linux containers which is kind of a bummer but that's just what it is and there are two
ways to deploy a multi-container group you can use arm templates when you need to deploy additional azure service
resources or just a yaml file when you want to deploy when your deployment only includes
container instances [Music] let's take a look at container restart
policies and what these do is allow you to change how the policies uh restart and there's three different ways we have
always uh never and on failure so the first one here always means always restart the container and the idea is to
keep your container running as long as possible and the reason why you'd want that is if you're running a web server
some other providers would call that a service then we have never so run only one time this is great for background
jobs and so other providers would just call this a task then you have on failures so containers
that encounter an error that's when it should restart
and so it's as simple as just choosing that option uh when you uh are creating that container
[Music] let's take a look at container environment variables also known as
nvars that allow you to pass configuration details to your containers and you can do this through the portal
the cli powershell which that's always the case with azure and so it's as simple as just putting in your uh key
and your value uh and one other thing i want to point out is that you can also pass in secured environment variables so
the idea is that sometimes you don't want them plain text so if you have like so you have that stripe secret key you
don't want anyone ever seeing that in production so the idea is that through and i don't think you can do this
through the portal but you can do this through the cli or powershell is provide the secure environment variables over
the regular one which isn't environment variables and that way you can pass it securely so it's never
exposed to human eyes [Music] let's talk about persisting storage and
we talked about that a little while there when we were looking at azure files but uh containers are stateless by
default so when a container crashes or stops all i'll state is lost to persist a state you need to mount an external
volume and there's quite a few different things we can mount as azure files secret volumes empty directory a cloud
git repo so you got a few options there and to mount a file volume you need to do this
via powershell or cli you're going to give the following detail so when you launch the container there's going to be
nothing in the portal so you got to do it this way all right [Music]
let's talk about some of the cli options that we can use to troubleshoot our containers a lot of this stuff is
probably uh accessible of the portal but it's great to know how to do this via the cli so the first thing is getting
the log so you can use azcontainer logs and that's going to bring you logs back then you can use az container attach
and this is going to give you diagnostic information about when the container is starting up probably with a cloud in it
information then you have a z container exact and this allows you to execute uh remote commands but what you can do is
use bin sh which actually will allow you to have an interactive container it's like having the terminal right to the
container which is very very very useful and the last is just going grabbing metrics
from azure monitor so azmonitor metrics list you could use the portal for that but i
just wanted to show you all those things because they might show up on the exam [Music]
hey this is andrew brown from exam pro and we're going to take a look at azure container instances so here it is so all
we got to do is go to container instances we'll hit add and the nice thing is that azure provides us with a
hello world one so it's very easy for us to get started it's a linux machine and it looks like
it's pretty inexpensive there so we'll stick with that i'm going to create a new group here we're going to call it
banana and we'll name the container instance banana
and east u.s 2 seems fine to me you'll notice we're on a quick start image if we wanted we could use something from
the docker hub and provide our own link but we'll just stick with the quick start image for today we're going to go
ahead and hit next to networking just to see what we have as options you can make it public or private we'll go to
advanced hold on here yep those are just the ports you can expose we'll go to advanced and for the
restart policy we can set on failure always or never we can pass in environment variables and i've covered
this a lot more in detail in the lecture content so we don't need to really dive deep into this
and we'll go ahead and create this instance and so we'll have to wait a little while
here and i'll see you back in a moment okay and so after a short wait our container instance is ready we'll go to
that resource there and take a look around so on the left hand side we can go to our containers and there we can
see it running we can see the events down below of what's going on so you can see that it's pulled the image
it successfully pulled it and it started the container some properties nothing interesting
there the logs if we wanted to see stuff and if we wanted to connect to the instance we could also go here and hit
connect which is kind of nice i don't have any purpose to do that right now so and it's also not going to
work the way we're doing it but i just wanted to show you you had those opportunities
uh you can do identity so that means manage it with role based access controls but what i want to see is
actually this hello world working i'm assuming there must be a hello page i've never looked at it
before so we're going to go here grab the public ip address and paste it on in the top and there we go so we have
deployed a instance onto azure container instances or a container i should say so nothing super exciting to talk about
here but we do need to know the basics uh there if we wanted to deploy other containers
it's just the one there so that's all you really need to do but yeah
so yeah hopefully that gives you an idea there i'll just go back to the list here so we can see it and we'll go ahead and
just uh delete that probably do it for the view the resources on the left-hand side like i always like to do
and we will go into banana here and we will delete banana and there you go
[Music] hey this is andrew brown from exam pro and we're looking at azure container
images cheat sheet and this is a two pager so let's jump into it so aci allows you to launch containers without
the need to worry about configuring or managing the underlying virtual machine acis is designed for isolate containers
for simple applications task automation build jobs containers can be provisioned within seconds where the vms can take
several minutes containers are built per second where vms are built per hour so you get greater savings when you're
using containers containers have granular and custom sizing vpc memory and gpu when vm sizes are predetermined
aci can deploy both on windows and linux you can persist storage with azure files acis
are accessed via fully qualified domains so it's just like a domain name then we have container groups these are
a collection of containers that get scheduled on the same host machine the container is a container group share
so you got lifecycle resources local network storage volumes container groups are similar to kubernetes pods
multi-container groups currently support only linux containers this is one of the cases where uh it's not windows it's
linux okay there are two ways to deploy multi-container groups you have uh that via an arm template and yaml file i
imagine you can do them via blueprints as well a container restart policy specifies what a container should do
when their process has been completed aci has three restart policies always never and on
failure okay we'll go on to the second one here so azure containers are stateless by
default when a container crashes or stops all state is lost to persist state you
need to mount an external volume you can mount the following external volumes so either azure file secret volume empty
directory or cloud git repo for a container tribute shooting these are just azure cli commands you should
really really know so i'm just going to list them out here you've got ac container logs ac container attached az
container exact which is for execute at az monitor metrics list so there you go that is the
aci images cheat sheet [Music] hey this is andrew brown from exam pro
and we're looking at azure container registry also known as acr which create and maintain azure canadian registries
to store and manage your private docker container images and related artifacts so azure container registry is a managed
private docker registry service based on the open source docker registry 2.0 and the idea here is that you can use
container registries with your existing container development deployment pipelines and it also has this thing
called registry tasks to build container images in azure and the idea here is that you can pull images uh from your
container registry to various deployment targets like kubernetes dc os which i forget what it stands for
but it's basically an operating system for containers docker swarm uh and there's also many azure services that
directly support acr so aks azure app service azure batch azure service fabric and a lot more so it's
just a matter of saying hey use this from acr and it works right away uh developers can also push to container
registry as part of a container development workflow with delivery tools such as azure pipelines and jenkins and
it's so easy to push to container registry there are many ways to work with acr via
the cli the power azure powershell azure portal azure sdk and there's also this really good extension called docker
extension for visual studio code something you absolutely want to install and maybe i'll make a full slide on it
because i like it so much [Music] let's take a look here at acr tasks
which allow you to automate os and framework patching for your docker containers and uh we have a few
different options here so the first is quick tasks these allow you to push a single container image to a container
registry on demand and you don't need to be running a local docker engine installation to do it so that's a really
good benefit uh you can also trigger some automated build actions so maybe you push some
source code updates you update the container base image you want to do it on a a timer that's on a schedule you
can also have multi-step tasks so you have to go for the various steps to complete that task
for each acr task it has an associated source code context this is the location of the set source files used to build a
container image or other artifact tasks can take advantage of run variables so reuse task definitions and standardized
tags for images and artifacts so there you go hey this is andrew brown from exam pro
and this along we are going to be working with acr or also known as container registries so type in acr at
the top actually that doesn't work type in container and we will go to the registries and we'll create ourselves a
new registry now list to have multiple container repositories or images hosted here on azure so i'm going to just type
in my acr and we'll say ok and the register name is going to be my acr i'm just going to put a bunch of numbers
here so maybe 8080 [Music] it probably doesn't like the hyphens
there we go all the names are crazy you just have to flip around to figure it out we're going
to choose basic because we can do everything we want on basic we'll go ahead and hit review
and create and we'll give it a moment to allow it to start deploying
and we'll just wait till this is done deploying our registry all right so that took less than five
seconds and we'll go ahead and go to that resource and so what we need to do is go to
access keys we're going to enable admin users so that we can actually log in via docker to our image so now what we need
to do is get some repositories going and if we go over to repositories tab i don't think there's much we can do here
i don't know if you can create repositories directly here i always just push
yeah so you don't you don't have a button to say create a repository like github you actually have to push to it
so i'm going to go to github and i'm going to create myself a new repository i'm going to call under the other
example we'll say my acr it's already there so i'll say new and
we'll go down below actually doesn't matter we'll just go ahead and hit create
and from there i'm going to open this up in git pod all you have to do to open something up in gitpod
is to attach this end here you can also do this in your local environment but you do have to have docker
set up and so that's why it's easier to use git pod now cloud shell in azure actually has docker installed but
doesn't run a docker instance so it's not that easy to work with so it really is easier to just work with git pod here
or locally if you have docker installed so we're going to say docker login and then we're going to provide the
login server we'll hit enter it's going to ask for our username so that is our username
there so i'm going to paste it in it's going to ask for our password so i'm going to copy that paste that on in
there hit enter and so now we can push to that repository i'm going to pull a image called hello world that's just a
standard application to say hello world if we do like docker run i t
d um hello world i think that's what it is to
type it whoops i can actually spell it right then we could probably run it over here
there's like a docker tab so we can see if it's running notice that it exited if we view the logs
it probably just says hello world yeah hello from docker so there you go that's a simple way of running a docker
container and terminal will be reused for other tasks
press any key to close it so i just hit space there i t d or t i think is for the tag name
so it's called hello world so we type docker images it shows up there in i's for i don't know interactive d is for
daemon so it runs in the background but anyway we want to push this to [Music]
azure so the way we're going to do that is we're going to type in docker tag because we have to tag this image
and we're going to choose the image id here and then we need to provide the repository name so i'm going to assume
it's the login server and then we just say example
hello world hit enter and we can say docker push and then copy
this here and that should push it over to azure
we'll go back over here give it a refresh so repository is there so
that's all it takes to push so this is one part but we'll figure the other part next here soon okay
hey this is andrew brown from exam pro and what we're going to do is use the last um
follow along in order to reference an image in our container here because we pushed an image but what if we want to
reference one as an application in an actual docker file because that is a very common use case so in our gitpod
environment which we still have i'm going to type in dockerfile and in here what we can do is reference
our image i always forget what the top line is export run import something so i'm going to just look for example i'm
going to go to um docker ruby because i know how to use this image
pretty pretty uh pretty good so we'll just go with it and it's from i always forget that so
we'll type in from and the idea is that we want to reference something like this but i know
if we use the hello world one it's a bit finicky to build so i don't want to use this one but i'm going to say ruby
or um yeah ruby's fine here and so we're going to pull the the ruby image so we say docker
pull ruby and we'll have to push this one so we'll pull it
give it a moment and now we'll type in docker um
images and we need to grab the ruby image id and we'll say docker
tag this one and we gotta go up and grab this part
here paste that in i could just say ruby here and then we can do docker push
ruby and while that's going i'm just going to go here and type in run
echo hello ruby because the idea is we just want to build a docker image that's from
a remote location so what i'm going to do is just save this so we'll say uh save my docker file
it's like the only file we saved here just waiting for that to finish pushing and then what we're going to do is we're
going to uh you know close this environment and then launch it again because i don't want to have any of
those images there i don't have to figure out how to delete them it's like docker rmi it can be really
finicky about deleting images but the idea is i just want to make sure they're not there so that when we pull we know
that it actually is pulling from there not locally we will have to do a docker login here
in a moment so type in we'll type in docker login
and we'll go back over here and we will log in say allow
we'll go back to here we'll grab the username we'll go back over to here
we'll grab the password so that's good and um hey where's our dockerfile
our dockerfile seems to be gone i guess we forgot to sync it and that's totally fine we'll just type it
in again it's not a big deal from here we'll say ruby and i'll say run echo
hello ruby and so now what i want to do is i want to do docker build period
and so if we are logged in and we can pull it so it's in great shape so it's the fact that we are pulling
that image and that was the other part i wanted to show you there so it doesn't matter if this finishes because it
obviously is working but we'll give it a second here to uh finish downloading there we go
um and so that's all so we'll go ahead and close this and we'll make our way back over to azure
and we will go and type in resource groups and we will choose my acr
and we'll go delete resource group and we'll delete that we're done so there you go
[Music] hey this is andrew brown from exam pro and we're taking a look here at azure
container registries cheat sheet so acr is a managed private docker registry service based on the open source docker
registry 2.0 it uses azure container registries with your existing container development or
sorry yeah development and deployment pipelines use azure or use acr tasks to build containers
images in azure pull images from an azure container registry to various targets uh and targets could be
kubernetes uh dc os which is i can't remember the name of the full name of that operating system docker swarm uh
for acr tasks this allows you to automate os and framework patching for your docker containers you can trigger
them you can trigger automated builds by source code updates updates to container
based images triggers on a schedule you can create multi-step tasks each acr task has an associated code context and
tasks can take advantage of run variables that's the end of it there you go see you in the
next section hey this is andrew brown from exam pro and we're looking at azure app services
which allows you to quickly deploy and manage web apps on azure without worrying about the underlying
infrastructure and specifically this is known as a platform as a service so azure app service is an http based
service for hosting web applications rest apis and mobile backends and you can choose your programming language and
it can either be windows or linux environment and it's a platform as a service so if you've ever used heroku is
basically the heroku of azure and so azure app service takes care of a lot of the underlying infrastructure for you so
it can do security patches of the os and languages load balancing auto scaling automated manager
and then um there's a lot of things that you can implement and so for integration such as azure
devops github integrations docker hub package management easy to set up staging environments custom domains
attaching uh ssl certificates so you can see that it just basically takes care of everything for you
if it's really hard for you or time consuming for you to do all this on your own in azure and the way it works is you
pay based on an azure app service plan honestly i find these really confusing um i really like how aws does elastic
bean stock because you're just paying for the underlying services but azure has all these crazy uh tiers here but
you have shared tier which is free and shared doesn't support linux you have the dedicated tier
which is basic standard premium premium version two and three and the isolated tier and so uh another thing i need to
note is that azure app services is not just for traditional vms for monoliths you can also run
docker single or multi containers and when you set up a project you're going to choose your domain name on the
azure websites.net obviously you can override that with your custom domain name but there you go
[Music] let's talk about azure app services runtimes and so let's define what
runtime is a runtime is software instructions that are executed while your program is running and so runtime
generally means what programming language libraries and frameworks you're going to be using and so runtimes for
azure app services are predefined containers that has your programming languages and probably some commonly
used libraries for those languages installed and probably commonly used languages for its web frameworks
and so the idea is that you're going to choose your runtime it could be net
net core java ruby which i'm very disappointed in azure because uh as of shooting this video
they do not support uh ruby for application insights but yet they have it here in azure app services node.js
php python and there's all the logos if you like seeing the logos and so azure app services generally has multiple
versions so they have like ruby 2.6 2.7 for php they have a lot of versions for node.js they have a lot of versions
but i just want to point out uh that it's pretty common for cloud providers to stop or to retire the old ones at
some point to stop supporting them uh you know that's just because they want to keep things modern
and the other thing is like it also helps you keep with your best security practices because really you should
always be trying to upgrade to the latest version uh for those security patches and and things like that so
there you go [Music] now let's say uh you wanted to use a
language that wasn't supported on um azure app services like you wanted to use uh elixir what you could do is
create your own custom container either for windows or linux uh and so uh you just go ahead and create your own docker
container in your local environment you can push it to an azure container registry and then the idea is you can
deploy your container image to your app service so i just wanted you to know that you could do that um if there's
some languages or other things or maybe you're using a language but you need uh some
bundle or packages that are uh they're just baked into the uh into the container so there you go
[Music] let's talk about deployment slots so deployment slots allow you to create
different environments for your web application and associate a different host name this is useful when you need a
staging or a quality assurance environment or maybe you need to like a developer environment any kind of
environment you want so think of it as a way to quickly clone your production environment for other uses and so down
below here you'd have your deployment slots and there's your slots to maybe you have apps staging beta so that's the
different host names there and so the idea is that not only do you
have other environments but there's also this thing called swapping and the idea is like imagine
uh you decide like you make a clone of your production environment and then you deploy the latest version to it and then
when you decide that it's good it's in good shape then what you can do is swap it out with your current production
environment and then just retire your old one this is called blue green deployment
and so that is a great way to do deployments and i just wanted you to be aware of
that so i wanted to talk about app service environment because i just wanted to show you how
azure app service is not just for a little toy apps or your small startup but they can be really useful for larger
enterprises so app service environment is an azure app service feature that provides fully
isolated and dedicated environment for securely running app service uh at high scale and this is
going to allow you to host web or windows web apps linux web apps docker containers mobile apps and functions
and app service environments are appropriate for application workloads that require very high scale isolation
and secure network access high memory utilization and again you know when you think of
platform as a service you don't think at this kind of scale so it's really impressive that azure does this
customers can create multiple ases within a single azure region or across multiple azure regions making ases ideal
for horizontal scaling stateless application tiers in support of high requests per second rp rps workloads and
ase comes with its own pricing tier and that's the isolated tier and ac can be used to configure security architecture
apps running ase can have their access gated by upstream devices such as a web application firewall also known as a
waff app or ssases can be deployed into availability zones
using zone pinning i don't know what that is a zone pinning but that sounds good to me
and there are two deployment types for ase we have external ase and ilb ase let's go take a quick look at what those
look like so here's a big diagram and look in the middle there that's where our azure
service environment is it's in our own v-net and a subnet and the idea is that you if the reason it's called an
external ase is because it exposes the esc hosted app on an internet accessible ip address and then down below
if you wanted to connect this this is generally what people are probably using for but what you want to do is you can
connect it to your on-premise via a site to site or express route vpn so that's something you can do with it
and the other part is like you can because the esc is within the same v-net it also has access to resources within
the v-net without any additional configuration so that's really nice and then the second uh a second one here it
looks it's exactly identical but there's one key difference and it has this ilb there and an ilb stands for internal
load balancer uh and that is basically the only difference so uh there you go
[Music] all right let's take a look here at uh deployment for azure app services and
let's just first define deployment so that's the action of pushing changes or updates from a local environment or
repository into a remote environment and azure app services has a lot of options for us and that's to me is the most
powerful thing about azure app services because it's easy to deploy a web app to a
virtual machine backed by a database but figuring out deployment is a very time consuming and tricky thing and azure app
services gives us so many options unbelievable amount of options it is so so great of them to do that for us so we
can run from a package deploy zip or or rar deploy via ftp deploy via cloud sync deploy continuously from like github or
use azure pipelines deploy using custom containers using docker hub azure container
registry deploy from a local git repo deploy using github actions deploy using github action containers or deploy with
an arm template so we're not going to look at all of these how they work but let's look at a few of them so we just
have an idea how robust of these options are the first one we're going to look at is running from a package and this is
when files in the package are not copied to the www uh root directory instead the zip package itself gets mounted directly
as a read only www route directory so basically all other deployment methods and app service
have to deploy to the following directory if it's if you're on a windows machine it's going to be home site wwe
root if you're on linux it's going to be home site www root and so since the same directory is used by your app at runtime
it's possible for deployment to fail because of file lock conflicts and for that and for that
reason uh the app might behave unpredictably because some of the files are not
yet updated so this is the reason why you might want to create a package um it's just because it it circumvents
the issue of just replacing files in the folder another method is the zip and rar
deployment this uses the kudu servers service that powers continuous integration based deployments and qd is
used for a lot of things but it's an engine behind git deployments and azure app services and it's open source
project that can also run outside of azure and so cuda supports the following
functionality for zip file deployments and it supports a lot more than just zips but it does deletion of files left
over from a previous deployment option to turn on the default build process which includes package restore
deployment customization including run deployment scripts deployment logs a file size of uh
was it two gigs two gigs and uh you can use it with the cli the api uh vrs with curl or the azure portal
uh so by the way that's that's you uploading a zip uh but you're essentially using kudu
underneath okay uh and so let's go take a look at another deployment method which is file
transfer protocol uh ftp has been around for forever and this is pretty much how people thought you were supposed to
deploy your apps in the late 90s and early 2000s i don't think it's a really great way to deploy but the point is is
that if you want to do it this way or you have a use case that makes sense you can do it so the idea is that the
deployment center you would uh say i want to use ftp and you just you get an ftp endpoint your username and password
and that's your credentials you use your ftp client to connect uh very old school but it's an option
for you which is really nice another way which to me is a bit bizarre but it's cool that you can do it is you can use
dropbox or onedrive to deploy using cloud sync so the idea is that you have dropbox it's a third party cloud storage
service onedrive's the same thing it's just microsoft's uh thing and so you go to deployment center
configure dropbox or onedrive and when you turn it on it will just sync or it'll just create a folder in your
dropbox drive and that will get synced so that's the one for onedrive that's the one for dropbox and this is going to
sync to that www route there i would have loved to take in some screenshots but i couldn't find how to
turn the service on but i know it exists i just was i thought it was so bizarre but yeah there you go that is the
deployment methods there [Music] so the way you pay
when you use azure app service is you need an azure app service plan and that's going to determine you know how
much you pay and what's going to be available to you they got three tiers which we're going to go uh through here
shortly and we did mention them earlier i honestly do not like this whatsoever this tells you this is a microsoft
product because it has these uh wonky pricing tiers i hope in the future they'll change it but that's just what
it is and so let's go learn it so basically what you do is you have like this big wizard uh that tells you all
the stuff that you can have it tells you what's included and stuff like that but let's work our way through it so the
first thing is the shared tier and there's two types here we got free and shared and so there's the free tier that
red one there it's called f1 it gives you one gigabyte of disk space up to 10 apps on a single shared instance no sla
for availability and each app app has a compute quota of 60 minutes per day so there you go you get some free tier
there then there's the shared tier this provides up to 100 apps on a single shared instance no sla availability each
app has a compute quota of 240 minutes per day uh and the thing is is that i didn't
know where the button is for that so like the next thing right beside it is the dedicated tier and i thought that's
what it would be because it says 100 total acus so
is it i'm not sure but anyway the point is there is a shared tier where it is i don't know uh and you can't use the
shared tier on uh on the on linux based system so you're using windows i'm using windows you gotta use bigger instances
anyway which i don't know i don't like that too much but that's what it is uh moving on uh over we're now into the
dedicated tiers and look it's right beside the free tier that's the green one it says b1
and if you expand it actually has a couple other tiers there so i just wanted to show you that there was uh
three uh there and so uh for dedicated tiers we've got basic standard premium premium version
two premium version three and we're looking at basically that's what that is more disk space unlimited apps three
levels in this tier that offer very amount of compute power memory disk usage it must be b1 b2 b3
uh and then the next thing over is uh the standard and i we had we had to switch tabs there onto the production
tab notice the terminologies don't really match the tiers uh and so uh with standard you can scale
out to three dedicated instances has an sla of 99.95 availability and three levels in this
tier that are offering varying amounts of compute power memory and storage disk and so then
uh that's that tier there and we're on to our last here which is the premium tier
and this scales to uh 10 dedicated instances it has availability sla of 99.95 percent and multiple levels of
hardware so that's the dedicated tiers then we're on to the last thing which is isolated and this is really only going
to be used i think for ase so the uh the isolated tier has dedicated azure virtual networks uh full network compute
isolation scales out to 100 instances availability sla of 99.95 and again i think it's just for those ases um but
there you go that is all the tiers and hopefully it makes sense to you but it is a little bit tricky to figure out
what to choose but you don't really get to like pick at a granular level that's what i don't like
but it is a really great service azure app service it does figure everything out
for you so maybe it's okay for you [Music] so let's say you're using azure app
services to host um one of your applications you need to run a random script how are you going to do that
that's where web jobs comes into play so it comes at no additional cost and web jobs is not yet supported for linux
which is of no surprise here because microsoft is all about windows but i hope one day they will support it the
following types they support as of today are command files bat files executables we've got powershell files bash files
php files python files javascript files and java files when you go ahead and create your job you're going to have
between two types you've got continuous and triggered a continuous means it's going to run continually until stopped
which is pretty clear and this particular mode supports debugging so if you need to bug in
that's the mode you're going to be using for trigger this only runs when a trigger occurs and you have different
kinds of triggered here so you notice we have scheduled and we can enter a quran job in and this will also expose a web
hook that can be called to enable scenarios like scheduling i think that would be like manual triggers
it doesn't support debugging though so looking at web job scales and this is for continuous only
uh we have a multi-instance and single instance so multi is will scale your web jobs across all instances for your app
service plan and single instance will only keep a single copy of your web job running regardless of the azure app plan
instance count so there you go [Music] hey this is andrew brown from exam pro
and we are going to be learning about azure app services in this follow along uh and it's a service that's supposed to
make it easy for you to deploy web applications i say supposed to because it really depends on your stack azure
has more synergies with other stacks than others so like if you're like me and you like ruby on rails
you're going to find a lot of friction with rails and linux but if you're using something like windows servers or python
or net you're going to have a much easier time still really great service just wish they'd make it a bit more
broad there but let's hop into it so before we can go use that service let's make sure that it's activated and so
we'll go over here and we'll go to azure subscription and then down below we're going to go to
resource provider now you'd think what you could do is just type in app services
and you'd be wrong because the the service is under a particular provider so if you want to figure out what
provider it is we can go um azure resource providers and they have a page on documentation
here that lists them all so if i search for azure app services it's under web and domain registration
so we're going to make sure this is registered if we're using a custom domain which we are not today we need
this one activated so going back here i will type in web and you can see it's registered so if yours is not registered
go ahead and hit that i believe this by default is generally registered with new azure accounts so i don't think that is
an issue for you but we'll go back up here close these additional tabs and we will type in azure app services
and we will look for that service so there it is and we'll go ahead and hit add
and so i'm going to give it a new name i just made it a moment ago but i'm going to try again and try to use the same
name so we're going to call this voyager great and then i'm going to go ahead and name this voyager and i already know
that that is taken so i'm going to type in delta flyer and these are fully qualified domains so
they are unique with azure app services you can run a docker container we're doing code this time around and what i
like to use is ruby but again you know if i want to use the ci cd i'm not going to be able to use
the deployment center with ruby so that is not possible and so we're going to go with python and
run either a flask or a django app i haven't decided yet i am in canada so let's go to canada east
and down below here we have the plans generally the plans will tell you the
cost underneath look you'll notice that it's loading but i just want to show you that there are some discrepancies in
terms of pricing so if i was to go to azure app services pricing and we were to pull this up here we can
kind of see the pricing here okay and if we scroll on down right now we're looking at a premium v2
uh and oh no i don't need help i'm okay you'll notice that it's 20 cents per hour so if i go here and do
that times 730 because there's 730 hours in the year that's 146 dollars i believe this is showing me in usd dollars yeah
and and here it's showing me 103 canadian which is lower um so it could be that because i'm running in a canada
east region it's the price is different but you can imagine that if i had this at this cost at uh what did we say here
at 146 usd to cad i'd actually be paying 182 dollars so you got to watch out for
that kind of stuff but i'm pretty sure this is what the cost is so just be aware that if you look stuff up in here
it's not necessarily reflective so you got to do a little bit more work to figure that out
if we wanted to go here we cannot choose the free tier when we're using linux if we're using windows i believe we can use
it we're working with linux today so that's just how it's going to be for the b1 this is totally fine but we
want to utilize deployment slots deployment slots is an advanced feature of the production version and that's the
only way we're going to be able to use it here this is 20 cents per hour again so i don't want to be doing this for too
long but i think what we'll do is before we do that we can just do an upgrade to dev to prod so we can experience that
i'm going to go and just choose b1 okay so go next we do not need any application insights
for the time being and it will not let us so it's okay we'll go next review and create
and we'll go ahead and create this resource here and i will see you back when this is
done so um our resource is now set up we'll go to resource and now that we're in
here you'll notice if we hit browse we're not going to see anything because we do not have anything deployed which
makes sense right so we're going to actually have to go ahead and deploy something so we're
going to make our way over to the deployment center and it's just going to tell us that we
have yet to configure anything and that's totally fine we're going to go to settings
it'll give it a moment and so the thing is is that we're going to need something to deploy
i did not create an app but the great thing is in the azure documentation they have
a bunch of quick starts here all right and apparently they have one for ruby as well but today we are looking at python
uh and so they actually have an example repository for us here which is github.com azure samples python
docs hello world and i mean i can go make a repo for you but we might as well just use the one that is already
provided to us so i'm just going to pull this up to show you what's in it it's a very very
simple application even if you don't know anything about building web apps i'm going to walk you through it really
easily here okay so we're going to open up app.pi so we are using flask if you've never heard of flask it is a very
minimal python framework for creating web apps uh very uninspiring uh home page here but it gets the job done it's
going to create a default route for us which uh we have there we're going to call hello here and we're going to have
hello world so that's all that's going on here very very simple and we have a
requirements this is our package manager i don't know why python uses txt files it's very outdated to me but that's what
they use and here we have flask all right so we're going to use that repo it's a
public repo so it should be very easy for us to connect so we'll drop down go to github
and uh the next thing we need to do is authorize github all right so i ran into a bit of trouble
there because i could not uh authenticate my uh github account but you know what i just made another github
account so that made it a lot easier i'm going to go ahead here hit github and we're going to try to authorize it and
so now i'm logged into this new one called exampro dev and we'll go ahead and authorize this application and we're
now in good shape this repository doesn't have anything in it so
if i want to clone something i guess i'll probably have to fork that repo so we'll give it a moment to authorize
and while that's going i think that's what i'm going to do i'm going to go and fork the example repo if i can find the
link again here myself i believe
it is that's still authorizing over there i'm still looking for it so
it was like examples or something samples or examples all right so i found a way around the
problem i just made a new github account so that's all i had to do um and i just won't be using my primary
account until i get my phone back but so what we'll do is go hit connect i'll hit authorize
and it didn't prompt me because it already connected to this new one called exam pro dev you might have to put your
credentials in here and it's going to ask me to select some things it's a new account so there are no organizations
there are no repositories there are no branches totally brand new so what i'm going to need to do is get a repo in
there so we'll just go ahead and fork the azure samples one so that is azure samples
python docs hello world if i type that right we're in good shape
i'm going to go ahead and fork this repository i'll say got it
and then i'll move this off screen here this is now cloned you should see it cloned here
and we'll go back here and this probably isn't live so there's no refresh button here so we'll have to hit discard
and we will give this another go here and we will select our organization which is our name there is the
repository uh should be main branch is kind of outdated i'm sorry but it's called
master that's what it is not my fault that's azure's fault okay um and i think that's it
i don't know if we need a workflow configuration file i don't think so [Music]
i'm just going to double check here no i don't think so and what we'll do is we'll just go ahead and save that
and so now we are set up for deployment [Music] all right so now that that's all hooked
up if we were to go to browse we're actually still seeing the default page a deployment hasn't been triggered just
yet so the way it works is it's using github actions so if we click into our we call
it main branch i know they got the wrong name but we're going to click into our github workflows and then below here we
can see we have a yaml file and this is for github actions integration here and so what it's doing
is it's specifying the branch what how it's going to build it's going to run on ubuntu latest the steps it's
going to do is going to check it out it's going to set up the python version it's going to build it it's going to do
that stuff and so in order for this to um take action we'd actually have to go ahead and make some kind of manual
change which we have yet to do so eh so what we'll do is we'll go back to our main here
and uh it should be as simple as uh just changing something here so it's not i'm not sure how it's
supposed to know that it's supposed to be doing the hello oh i guess yeah sorry so this means it's going to route over
to here so i'm just going to make any kind of change here doesn't matter what it is
just one space we'll go ahead and give it a commit and
if i go back to my latest commits we should see that i made that change there it is
we'll go back over here and this should be deploying so if we go over to logs
here you can see one's in progress right now okay and so that's what we're weighing we're just going to see that
finish there we could probably open the logs and get some more information there and so it just brings you back over to
github actions and so here's github actions and it's performing the stuff here so we're just going to give it time
here and i'll see you back in a moment so we didn't have to wait too long it only took one minute and 29 seconds if
we go back over here um we might need to do a refresh and so we can see this is reflected over here
and so if we go back to it doesn't really matter if we go to settings or logs here but i'm going to hit browse
and see if my page is deployed it still is not so we do have a small little problem here and it's really going to
just have to do with how the app is served so that's what we need to figure out next
all right so our app is not currently working and there's a few approaches we can take and the thing i can think right
away is we should go an ssh into that instance if you scroll on down here from developer tools you can go to ssh and
click this button and that's going to ssh you right into that machine right away you can also
access ssh via the um cli command so i believe it's like it's like a z web app
um ssh it'll do the exact same thing you do that from the cloud shell but that's not
what we're doing today if i give this an ls in here and we're in linux we can see we have our app here
and what i would do is i would see what's running so i i would do a puma uh or sorry not puma
ps ox grep uh python and you can notice that we have uh g unicorn that's running so that is where our python instances
are running so you're not looking for flash you're looking for python here and if we wanted to make sure that was
working we just type in curl local host um and so that is going to return a port
80. so that tells me that because like curl just means like let's go look at that page it should return some html
like print out the html to us so that means the app is not running so what you could do is run flask run
and it's going to start on port 5000 right so what i can do
is i can go up uh back to my deployment center here and i'm going to go get that link here
and just ignore the fact that it's working it's it's not working right now i know for certain it's not
but if we do 5000 that won't resolve because port 5000 isn't open so we can't really just
