>> You've learned a little bit about Infrastructure as Code.
In this episode of Data Exposed,
we'll dive a little bit deeper into how you can use
it with AKS and SQL Server.
[MUSIC]
>> Hi, I'm Anna Hoffman and welcome to
this episode of Data Exposed: MVP Edition.
This week we have back, Hamish Watson.
Thanks for joining us again.
>> Thank you. It's great to be part of this, yeah.
>> In the last episode,
we talked about Infrastructure as Code and how you can use
it to do things like deploy Azure SQL Database.
But in this episode, we're going to see how
you can use it for other things related to SQL.
Why don't you go ahead and kick it off
and tell us what else we can use it for?
>> Awesome. Thank you, Anna.
Today, I'm going to show people how we can
spin up a Kubernetes cluster,
and we're going to use Azure Kubernetes Services.
Why don't I jump in and I'll show you.
Here we have my Windows machine,
it's just a VM, and on here I have Visual Studio Code.
Today, what I'm going to be doing is deploying
out an Azure Kubernetes Services cluster.
Again, this is where the Infrastructure as Code is really
awesome because it means that I can
create a standardized resource.
I can feed in what I want to put in there,
different namespace whatever,
and deploy this out and then start using it.
What I would do is doing technically that.
I'm just using Bash.
This is going to go out and deploy my resources into Azure.
This will take awhile to do,
but what we'll do is we'll
come back when it's
deployed and then we'll start actually using it.
>> Okay, cool. It seems like this has
finished and it looks like it's pretty simple.
You just ran one file,
but what really happened underneath there and what did you do?
>> Yeah, absolutely. This is not [inaudible].
Basically, I've got a whole heap of commands in my file,
and to be honest,
I didn't know the hottest ones and the will to live.
Basically what we're doing is we're using YAML files.
This file here is for
LPA system storage because we
want to repossess storage against our cluster,
which is where we are going to store our databases,
and we then had a deployment YAML file,
which we were actually going to deploy
a SQL Server in a container on our Kubernetes cluster.
It's really just bringing all these commands into one place.
Again, we could have this file in source control,
we could fold it into our CI/CD pipelines in Azure DevOps,
doing [inaudible] , we pull this out,
build their cluster, deploy our containers,
do our stuff, then we might
just delete the containers and get rid of the whole cluster,
just opinions on whatever we want to do it.
What I'll do now is we'll actually connect to the cluster,
we'll have a look at SQL Server databases that we put on there,
and you'll notice that as we go along,
a lot of this feels very familiar.
I'm going to jump into Azure Data Studio,
I'm going to connect to my cluster entries.
Again, this is being provisioned using infrastructure as code.
In this particular case,
I was using the Azure CLI
and what I did do was part of the process,
I created a secret for
the inside password so
that I don't have to give that password out.
I don't have it in scripts and we can actually use it as a secret.
What we have here is
basically SQL Server that's running on the Kubernetes cluster.
I'll just quickly grab my file because what we're going to do is
actually run a script to create my database.
Let's do that. This is going to go away,
it's going to create a database.
What I'm doing is I'm installing tSQLt,
which is a testing framework for SQL Server.
What it means is that we now had
the ability to run
unit tests against the database written in tSQL.
This is actually the first time I've
decided to run it in Azure Data Studio.
Normally, I would run it on SQL Server Management Studio.
But the really cool thing is it works here as well.
We have a very simple database.
We've got our tSQLt framework.
By the way, tSQLt is free,
so that's a really nice aspect of it.
What we can now do is just do a really simple run of our tests.
I've written some unit tests in
this database which I've just deployed.
You'll notice here that thankfully my unit tests passed.
But this really opens up the doors for us because now we can build
Kubernetes cluster using Azure Kubernetes Services
because it's an important thing.
I have the Kubernetes clusters on
physical hardware as well as VMs and it's a [inaudible].
It's definitely not a one-line skirt.
When Azure platform came
out with Azure Kubernetes Services or AKS,
I immediately jumped on because it
manages all the horrible things that I've had to do.
The installation, the upgrade, the management,
and now being out to run SQL Server in a container on it,
it's just a game changer for me.
It changed how I use the platform, and more importantly,
how I provision that platform for
other people in a DevOps and CI/CD.
I'm hoping that, again,
this is another thing that shows you the audience,
some really cool things that you can do up in Azure.
>> Thanks Hamish. It was really interesting to
see how you basically built
this very repeatable set of scripts that you can use to either
deploy AKS and then deploy SQL Server into it,
as well as that whole automated script that you
used to install tSQLt and run some unit tests.
That's really interesting.
I wanted to flip it back to you and say
we've had these two videos about infrastructure as code,
what do you think the most important takeaway for a viewer is,
and what should they go do first?
>> Cool, thanks Anna. Look, I think
that people need to just jump on board.
Go out and just try things on the Azure platform. Start small.
There are a whole heap of people that are blogging,
myself included, on how to create resources out there.
How to use Azure Cloud Shell,
how to use Azure CLI.
Look, just start small.
Try a few things.
Because the thing is,
I think of Azure like this,
do I have a massive team of
security people looking after my databases?
No, I don't. But there's all heap of thins that
Microsoft is looking after the Azure platform.
There is a whole heap of things that are
default in Azure that people just don't do.
One of the things I'm really passionate about is
not only testing out data, but monitoring.
The number of times I talk to people and say, "Hey,
show me the monitoring of your
resources," and I just get a blank look.
That's default in Azure.
One click, it's there.
I think data professionals,
we need to get on board with this.
We need to become Data Platform Engineers.
It's so easy. There's always a learning curve,
but the thing is like I say,
just try it and you can just go from there.
It's really cool and it will definitely make your job
better because now you can scale
up and you can provide value for not only yourself,
but for other people by collaborating
with those scripts by source-control.
>> Thanks so much for being on the show Hamish.
It's been a pleasure and I think
our viewers have really enjoyed this.
Viewers, if you did like this video,
please like our video and let us know what
you'd like to see next on Data Exposed.
[MUSIC]